Token导航 LogoToken导航

Agent Skill · 研究检索

refactor(代码重构)

refactor 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

refactor 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 65,745。

总安装 275周安装 11GitHub Stars 公开资料未说明下载 89核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:refactor(代码重构)
来源仓库:https://github.com/cerico/macfair
仓库路径:skills/refactor
安装命令:
npx skills add https://github.com/cerico/macfair --skill refactor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cerico/macfair --skill refactor

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

Refactor 审查当前分支代码变更质量,迭代优化至达到 90/100 评分阈值。适用于 PR 前的代码质量提升,涵盖正确性、可读性和测试覆盖检查。结合 Vitest 测试结果动态调整评分,但不运行 Playwright 端到端测试。安装前需确认项目是否配置了 pnpm vitest,否则无法执行评估。

输出为改进建议列表,需人工确认后再实施具体修改。

来源仓库内路径:skills/refactor

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/cerico/macfair --skill refactor;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

refactor 怎么安装?

在终端执行 npx skills add https://github.com/cerico/macfair --skill refactor。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

refactor 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

refactor 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

refactor 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

refactor 用的人多吗?

公开数据是累计安装 275 次,近一周安装 11 次,下载 89 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

refactor 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
refactor

代码重构 · 本页

275—操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Refactor

Review code changes in current branch against main, grade the quality, and iteratively refactor until the code meets a minimum quality threshold of 90/100.

Instructions

1. Get Changed Files

git diff main --name-only

Get the full diff for context:

git diff main

2. Run Vitest

Run Vitest in CI mode before grading:

pnpm vitest run --reporter=verbose

If tests fail, factor that into the grade (deduct from Test Coverage score). Don't run Playwright - ask the user to run those manually if needed.

3. Review and Grade

Review the code changes for:

  • Correctness: Does the code do what it's supposed to?
  • TypeScript: No any, proper types, strict mode compliance (see TypeScript Check below)
  • React patterns: Proper hooks usage, client/server boundaries
  • Code style: Follows project conventions (no semicolons, proper imports)
  • Error handling: Appropriate error boundaries and handling
  • Performance: No obvious N+1 queries, unnecessary re-renders
  • Security: No vulnerabilities (XSS, injection, etc.)
  • Accessibility: Proper aria attributes, semantic HTML
  • Test coverage: New logic/features have tests, edge cases covered (checks tests exist, doesn't run them). See Test Coverage Deep Check below.
  • DRY: No unnecessary duplication
  • Clarity: Code is readable and self-documenting

Also include all checks from /preflight (dead code, git hygiene, env vars, imports, dates, etc.). A score of 90+ means preflight would pass.

Assign a letter grade (A-F) and a score out of 100.

4. Branch Logic

If score >= 90
  1. Output to terminal: "Good enough, let's ship it!"
  2. List what could have made the score higher (but don't block on it)
  3. Get the current branch name: git branch --show-current
  4. Create tmp/ directory in project root if it doesn't exist
  5. Write suggestions to tmp/{branch-name}.md with:

- Final grade and score - Summary of what's good - List of potential improvements (nice-to-have)

If score < 90
  1. Identify the issues bringing the score down
  2. Refactor the code to fix those issues
  3. After refactoring, re-review and grade again
  4. Repeat until score >= 90
  5. Then follow the >= 90 flow above

Grading Scale

GradeScore RangeMeaning
A+97-100Exceptional - production ready, exemplary code
A93-96Excellent - minor nitpicks only
A-90-92Very Good - meets quality bar
B+87-89Good - small issues to address
B83-86Above Average - some improvements needed
B-80-82Satisfactory - multiple issues
C+77-79Adequate - significant issues
C73-76Acceptable - needs work
C-70-72Below Average - substantial issues
D60-69Poor - major problems
F<60Failing - fundamental issues

Output Format

Terminal Output (always)

## Code Review: {branch-name}

> **Tests:** Vitest ran in CI mode. Playwright skipped - run manually if needed.

**Grade: {grade}** ({score}/100)

### Summary
{Brief description of what the changes do}

### What's Good
- {positive point 1}
- {positive point 2}

### Issues Found
- {file}:{line} - {issue description}

### Score Breakdown
- Correctness: {x}/15
- TypeScript: {x}/10
- React Patterns: {x}/10
- Code Style: {x}/10
- Error Handling: {x}/10
- Performance: {x}/10
- Security: {x}/10
- Test Coverage: {x}/10
- Accessibility: {x}/5
- DRY: {x}/5
- Clarity: {x}/5

{If score >= 90: "Good enough, let's ship it!"}
{If score < 90: "Refactoring to improve score..."}

Markdown File (tmp/{branch-name}.md)

Only written when score >= 90 (either initially or after refactoring):

# Code Review: {branch-name}

**Date:** {date}
**Final Grade:** {grade} ({score}/100)

## Summary
{What the changes accomplish}

## What's Good
{List of positive aspects}

## Potential Improvements
{Things that could have pushed the score higher - nice to have, not blockers}

## Refactoring History (if applicable)
{If refactoring was needed, list what was changed and score progression}

TypeScript Check

Some projects have legacy type errors in unrelated files. To check only changed files:

# Check if 'types' target is available in make output
make 2>/dev/null | grep -q 'types' && make types || pnpm tsc --noEmit

Use make types if available (checks changed files only), otherwise fall back to pnpm tsc --noEmit.

Test Coverage Deep Check

Don't just check if new helper functions have tests - trace the code path:

  1. Integration over unit: If you add a helper function getX(), find where it's called (e.g., calculateY()) and verify calculateY() has tests covering the new logic
  2. Follow the call chain: New code in utils/foo.ts → used by calculateBar() → verify calculateBar.test.ts covers the new behavior
  3. Test the behavior, not just the function: A test for getMonthsInBillingInterval() returning 3 is good, but a test proving calculateLettingInvoiceCosts() actually multiplies by 3 for quarterly is better

Example gap to catch:

  • ❌ "Added tests for getMonthsInBillingInterval()" (tests the helper)
  • ✅ "Added tests for calculateLettingInvoiceCosts() with QUARTERLY billing" (tests the integration)

Edge Case Analysis

Actively question defensive code patterns:

  1. Fallback values: When you see x?? defaultValue or x? fn(x): fallback, ask:

- What happens when the fallback is used? - Is the fallback correct for all scenarios? - Should this be an error instead of a silent default?

  1. Optional chaining: When you see obj?.prop, trace what happens when obj is null:

- Does downstream code handle the undefined correctly? - Are there tests for the null case?

  1. Type narrowing: When interfaces allow null/undefined, verify the code handles both branches

Example to catch:

const months = billing?.interval ? getMonths(billing.interval) : 1
const cost = new Decimal(billing?.rate || 0).mul(months)

Ask: "If billing is null, we get 0 * 1 = 0. Is that correct, or should this throw?"

Notes

  • Focus on meaningful improvements, not bikeshedding
  • Each refactoring iteration should target the highest-impact issues first
  • Don't over-engineer - fix what's wrong, don't add unnecessary complexity
  • If stuck in a loop (same issues keep appearing), break out and explain why
  • Maximum 5 refactoring iterations to prevent infinite loops

平台分布

Codex

33.85%
按下载量换算30

Claude

29.11%
按下载量换算26

Cursor

20.8%
按下载量换算19

Gemini CLI

9.41%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills