跳到正文
cccskills
免费在 GitHub 公开中文介绍

simplify-code

从复用、质量、效率和修复是否触及根本机制四个角度检查近期代码改动,整理重复逻辑与过度复杂的结构。按风险处理修改建议,并在应用后进行测试。

原文查看原文说明

Parallel 4-agent cleanup of recent code changes.

AI 评分100分/ 100查看安装方法

适用场景

  • 整理近期代码改动
  • 查找重复逻辑和可共用的处理
  • 检查最近一次提交的效率
  • 仅查看建议,不修改文件

中文介绍

功能

从复用、质量、效率和修复是否触及根本机制四个角度审查近期代码改动。检查与现有共用逻辑的重复、过深的条件分支、无效计算及临时变通方案,并汇总发现。安全的整理会直接应用,需要谨慎处理的修改会通过测试确认。可能影响行为或公开 API 的建议会交由使用者判断。

适用场景

适合在仍清楚改动内容时,整理已经能够正常运行的代码。可以限定为最近一次提交、已暂存的改动或指定文件,也可以重点检查效率,或只获取问题清单而不修改代码。

使用示例

  • “整理近期改动,减少重复逻辑和不必要的复杂结构。”
  • “从效率角度检查最近一次提交。”
  • “不要修改文件,只报告改进建议。”

注意事项

通常会并行运行四名审查代理,改动较多时,词元消耗也会增加。无法使用任务委派功能时,会依次检查相同的四个角度。本技能并不以查找缺陷为主要目的。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确以整理近期改动为目标,并说明不以查找缺陷为目的。
步骤具体性步骤、输入输出和示例是否具体
A良好提供用 git diff 选择改动的命令,以及问题、成本、置信度和风险的报告格式。
安全性发送数据、删除文件、执行命令等是否有说明
A良好按风险分类修改,要求测试验证,并将高风险改动交由人工审查。
安装难易度所需工具和 API 密钥是否少且有说明
A良好不要求额外密钥或服务,并提供无法委派时的顺序审查流程。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月20日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md14.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Simplify Code — Parallel Review & Cleanup

Review your recent code changes with four focused reviewers running in parallel, aggregate their findings, and apply the fixes worth applying.

This is a cleanup pass, not a bug hunt. You are improving the quality of code that already works — removing duplication, flattening needless complexity, cutting waste, and deepening band-aid fixes. Do not go hunting for correctness bugs here; that's what requesting-code-review is for.

Core principle: Four narrow reviewers beat one broad reviewer. Each one deeply searches the codebase for a single class of problem — reuse, quality, efficiency, altitude — without diluting its attention across all four. They run concurrently, so you pay the latency of one review, not four.

When to Use

Trigger this skill when the user says any of:

  • "simplify" / "simplify my changes" / "simplify these changes"
  • "review my code" / "review my recent changes" / "clean up my changes"
  • "/simplify" (if they're carrying the Claude Code habit over)

Optional modifiers the user may add — honor them:

  • Focus: "simplify focus on efficiency" → run only the efficiency reviewer (or weight the aggregation toward it). Recognized focuses: reuse, quality (also accepts simplification), efficiency, altitude.
  • Dry run: "simplify but don't change anything" / "just report" → run the four reviewers, present findings, apply NOTHING. Ask before applying.
  • Scope: "simplify the last commit" / "simplify staged" / "simplify src/foo.py" → narrow the diff source accordingly (see Phase 1).

Do NOT auto-run this after every edit or tack it onto the end of unrelated tasks. It costs four subagents' worth of tokens — invoke it only when the user explicitly asks.

The Process

Phase 1 — Identify the changes

Capture the diff to review. Pick the source by what the user asked for, in this default order:

# 1. Default: uncommitted working-tree changes (tracked files)
git diff

# 2. If that's empty, include staged changes
git diff HEAD

# 3. Scoped variants the user may request:
git diff --staged                 # "staged changes"
git diff HEAD~1                    # "the last commit"
git diff main...HEAD              # "this branch" / "my PR"
git diff -- src/foo.py            # specific file(s)

If git diff and git diff HEAD are both empty and there's no git repo or no changes, fall back to the files the user explicitly named or that were recently created/edited in this session. If you genuinely can't find any changed code, say so and stop — there's nothing to simplify.

Capture the full diff text. Note its size: if it's very large (say >2000 changed lines), warn the user that four subagents each carrying the full diff will be token-heavy, and offer to scope it down (per-directory, per-commit) before proceeding.

Phase 2 — Launch four reviewers in parallel

Use delegate_task batch mode — pass all four tasks in one tasks array so they run concurrently. Four is the right fan-out for this pattern; it's within the delegation.max_concurrent_children budget on any default install.

No delegation available? If you can't call delegate_task in this context (you're a leaf subagent, delegation is disabled, or the budget is exhausted), do NOT skip the review or drop angles. Work through all four reviewer angles yourself, sequentially, in this context — same search standards, same finding format. Then say clearly in your final summary that this was a single-pass inline review, not the parallel fan-out, so the user knows what actually ran.

Give every reviewer the complete diff (not fragments — cross-file issues hide in the gaps) plus the absolute repo path so they can search the wider codebase. Each reviewer gets terminal, file, and search toolsets (so they can git, read_file, and search_files/grep).

Tell each reviewer to:

  • Search the existing codebase for evidence (don't reason from the diff alone).
  • Apply Chesterton's Fence: before flagging anything for removal, run git blame on the line to understand why it exists. If you can't determine the original purpose, mark it confidence: low — don't guess.
  • Report findings as structured output with the concrete cost, confidence, and risk:
    file:line → problem → cost (what's duplicated/wasted/harder to maintain) → suggested fix | confidence: high/medium/low | risk: SAFE/CAREFUL/RISKY
    
    The cost field forces each finding to justify itself — a finding that can't articulate what the problem actually costs is probably a nit.
    • SAFE = proven not to affect behavior (unused imports, commented-out code, pass-through wrappers). Auto-apply these.
    • CAREFUL = improves without changing semantics (rename local variable, flatten nested ternary, extract helper). Apply with test verification.
    • RISKY = may change behavior or breaks public contracts (N+1 restructuring, public API rename, memory lifecycle change). Flag for human review — do NOT auto-apply.
  • Skip nits and style-only churn. Only flag things that materially improve the code.

Pass these four goals (drop any the user's focus excludes):

Reviewer 1 — Code Reuse

Review this diff for code that duplicates functionality already in the codebase. Search utility modules, shared helpers, and adjacent files (use search_files / grep) for existing functions, constants, or patterns the new code could call instead of reimplementing. Flag: new functions that duplicate existing ones; hand-rolled logic that an existing utility already does (manual string/path manipulation, custom env checks, ad-hoc type guards, re-implemented parsing). For each, name the existing thing to use and where it lives.

Reviewer 2 — Code Quality

Review this diff for quality problems. Look for: redundant state (values that duplicate or could be derived from existing state; caches that don't need to exist); parameter sprawl (new params bolted on where the function should have been restructured); copy-paste-with-variation (near-duplicate blocks that should share an abstraction); leaky abstractions (exposing internals, breaking an existing encapsulation boundary); stringly-typed code (raw strings where a constant/enum/registry already exists — check the canonical registries before flagging); deeply nested conditionals (ternary chains, 3+-level if/else pyramids — flatten with guard clauses, early returns, or a lookup table); AI-generated slop patterns (extra comments restating obvious code like // increment counter above count++; unnecessary defensive null-checks on already-validated inputs; as any casts that bypass the type system; patterns inconsistent with the rest of the file). For each, give the concrete refactor.

Reviewer 3 — Efficiency

Review this diff for efficiency problems. Look for: unnecessary work (redundant computation, repeated file reads, duplicate API calls, N+1 access patterns); missed concurrency (independent ops run sequentially); hot-path bloat (heavy/blocking work on startup or per-request paths); TOCTOU anti-patterns (existence pre-checks before an op instead of doing the op and handling the error); memory issues (unbounded growth, missing cleanup, listener/handle leaks; long-lived callbacks or objects built as closures that capture the whole enclosing scope — everything captured stays alive as long as the object does, so prefer a small class or explicit-fields struct that copies only what it needs); overly broad reads (loading whole files when a slice would do); silent failures (empty catch blocks, ignored error returns, except: pass, .catch(() => {}) with no handling, error propagation gaps — these hide bugs and should at minimum log before swallowing). For each, give the concrete fix and why it's faster or safer.

Reviewer 4 — Altitude

Review this diff for changes implemented at the wrong depth — band-aids layered on top of shared infrastructure instead of fixes to the infrastructure itself. Signs of a too-shallow fix: a special case added to a generic code path to handle one caller (an if (caller == X) branch, a type check, a magic-value escape hatch); a symptom patched at the call site while sibling call sites keep the same flaw; a workaround stacked on an earlier workaround; a wrapper added to avoid touching the thing that actually needs changing; configuration or flags introduced to route around a broken default instead of fixing the default. For each, identify the underlying mechanism the change is dodging and describe the deeper fix — generalize the shared path, fix the root default, or fix the whole bug class — and honestly note when the deeper fix is large enough that it should be its own task rather than part of this cleanup. Read the surrounding code and git blame first: what looks like a band-aid is sometimes a deliberate boundary (compat shims, staged migrations, vendored-code isolation). Don't flag those.

Phase 3 — Aggregate and apply

Wait for all four to return (batch mode returns them together).

  1. Merge the findings into one list, deduping where reviewers overlap — when two findings target the same line or the same underlying mechanism, collapse them into one.
  2. Discard false positives — you have the most context; you don't have to argue with a reviewer, just drop weak or wrong suggestions silently.
  3. Resolve conflicts. Reviewers can disagree (Reviewer 1: "use existing util X"; Reviewer 3: "X is slow, inline it"). Default resolution order: correctness > the user's stated focus > readability/reuse > micro-perf. Don't apply a perf "fix" that hurts clarity unless the path is genuinely hot. When two suggestions are mutually exclusive and both defensible, pick the one that touches less code and note the alternative.
  4. Apply in risk-tier order:
    • SAFE first (auto-apply): unused imports, commented-out code, pass-through wrappers, redundant type assertions. Run tests after.
    • CAREFUL next (apply with verification, one file at a time): rename locals, flatten ternaries, extract helpers, consolidate dupes. Run tests after each file. Revert any that break.
    • RISKY last (flag for review — do NOT auto-apply): N+1 restructuring, public API changes, concurrency fixes, error-handling changes. Present each with risk description and test coverage status. Altitude findings usually land here — deepening a fix means touching shared infrastructure, so present the deeper fix and let the user decide whether to do it now or as a follow-up. If the user opted for a dry run, present all three tiers and apply nothing.
  5. Verify you didn't break anything: run the project's targeted tests for the touched files (not the full suite), and re-run any linter/type check the repo uses. If a fix breaks a test, revert that one fix and report it.
  6. Summarize what you changed: a short list of applied fixes grouped by reviewer category and risk tier, plus any findings you deliberately skipped and why. If you ran inline (no delegation), say so here.

Pitfalls

  • Don't fan out wider than 4. More reviewers means more cost and more conflicting suggestions to reconcile, not better coverage. The four categories cover the space.
  • Give the WHOLE diff to each reviewer. Splitting the diff across reviewers defeats the design — cross-file duplication and N+1s only show up with the full picture.
  • Reviewers search, they don't guess. A reuse finding with no pointer to the existing utility ("there's probably a helper for this") is noise. Require file:line evidence; drop findings that lack it.
  • Apply ≠ rewrite. This is cleanup of the user's recent changes, not a license to refactor the whole module. Keep edits scoped to what the diff touched plus the minimal surrounding change a fix requires. Altitude findings are the exception that proves the rule: when the right fix is deeper than the diff, FLAG it — don't unilaterally rebuild the shared mechanism inside a cleanup pass.
  • Don't drift into bug-hunting. If a reviewer surfaces a genuine correctness bug, report it prominently — but as a separate "found a bug" note, not folded into cleanup fixes. Correctness review is a different pass with different verification standards.
  • Respect project conventions. If the repo has AGENTS.md / CLAUDE.md / HERMES.md or a linter config, fold those rules into the reviewer prompts so suggestions match house style instead of fighting it.
  • Large diffs blow context. If the diff is huge, scope it down before delegating — four subagents each carrying a 5000-line diff is expensive and may truncate.
  • Over-trusting dead code tools. knip, ts-prune, and depcheck flag exports that ARE used dynamically (string-based imports, reflection). Always grep for the symbol name before removing — a clean tool report is not proof.
  • Renaming without checking public contracts. Export names, API route paths, DB column names, and config keys are contracts — even if the name is bad, renaming breaks consumers. Tag public-contract changes as RISKY; never auto-rename them.
  • Removing "unnecessary" error handling. An empty catch block or ignored error might be intentional — the error is expected and benign in that context. Flag it, don't remove it; let the human decide.
  • Not every special case is a band-aid. Compat shims, staged migrations, and isolation layers around vendored code look like altitude violations but are deliberate design. Check git blame and surrounding comments before flagging; when the intent is unclear, mark confidence: low.

Related

If your install has the subagent-driven-development skill (optional), it covers the complementary case: parallel review during implementation, per task. This skill is the standalone after-the-fact cleanup pass. Use requesting-code-review for the pre-commit security/quality gate — that's the bug hunt; this is the cleanup.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

1password

免费有简介AI 评分 100分

通过1Password CLI,将保存的密码和API密钥用于命令及配置模板,完成安装、认证、秘密值读取,并通过环境变量向命令传递凭据。

  • 安装并配置1Password CLI
  • 使用已保存的API密钥运行命令
  • 向配置模板填入秘密值
NousResearch/hermes-agent25.5万2026年10月19日 更新

3-statement-model

免费有简介AI 评分 90分

创建用公式联动利润表、资产负债表和现金流量表的 Excel 模型,分阶段填入历史实际数据与预测假设,比较不同情景,并检查三张报表之间的一致性。

  • 向财务模板填入历史实际数据
  • 建立三张财务报表联动的预测
  • 比较基准、乐观和悲观情景
NousResearch/hermes-agent25.5万2026年10月19日 更新

accelerate

免费有简介AI 评分 80分

以少量修改让现有PyTorch训练代码适用于多GPU或多台机器,指导混合精度、节省内存的DeepSpeed与FSDP配置,以及训练启动方法。

  • 将单GPU训练迁移至多GPU
  • 配置混合精度训练
  • 通过DeepSpeed或FSDP节省内存
NousResearch/hermes-agent25.5万2026年10月19日 更新

actual-setup

免费有简介AI 评分 100分

帮助配置Hermes,通过Actual Computer在自己的设备上运行AI模型。支持加密中继与本地连接,涵盖模型选择、响应测试,以及请求报错或空响应的排查。

  • 使用Actual密钥连接Hermes
  • 在本地设备上运行模型
  • 查找、下载并加载本地模型
NousResearch/hermes-agent25.5万2026年10月19日 更新

adversarial-ux-test

免费有简介AI 评分 80分

扮演不擅长技术、容易不满的用户测试应用,发现难懂的操作和导致放弃使用的障碍。将实际可改进的问题与个人抱怨分开,整理截图、修复建议和任务单。

  • 在发布或演示前检查易用性
  • 检查新用户的使用体验
  • 查找注册和付费流程中的障碍
NousResearch/hermes-agent25.5万2026年10月19日 更新

agent-merge-conflict-arbiter

免费有简介AI 评分 100分

从中立立场解决两个智能体分别修改代码产生的Git冲突,对照双方差异和意图,记录每处冲突的取舍理由,并通过构建或测试验证合并结果。

  • 解决两个智能体的分支冲突
  • 整合并行工作树中的修改
  • 核对冲突设计决策的理由
NousResearch/hermes-agent25.5万2026年10月19日 更新

查看 NousResearch 的全部技能

报告此技能的问题