一键导入
simplify
Review changed code for duplication, complexity, and over-engineering at batch boundaries. Blocking gate — must pass before next batch proceeds.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review changed code for duplication, complexity, and over-engineering at batch boundaries. Blocking gate — must pass before next batch proceeds.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when implementation is complete and all tests pass. Verifies with fresh evidence, presents completion options (merge, PR, keep, discard), and cleans up.
Use when creating or updating a pull request. Analyzes the full diff against the base branch, writes a concise title and structured body, and creates or updates the PR via gh.
Interactive, phone-drivable idea→spec loop. The operator hands the host agent a raw idea; the agent routes it to the right repo, runs the FULL DECIDE phase (explore [track] → complexity → prd [product track] → architecture-diagram → architecture-review → stories → conflict-check → plan, tier-aware) in that repo, opens a spec PR there, and nudges that repo's daemon. Runs independently of any build/execution loop. Use when capturing and routing new work, NOT when building inside one repo (that's plain conduct).
Use after stories are written and conflict-check has passed clean. Converts user stories into a step-by-step implementation plan with 2-5 minute task granularity.
Use after /finish to validate stories via curl (API) or browser (full-stack). Bugs found loop back through /tdd.
Use when executing an implementation plan with multiple tasks. Factory orchestration with three autonomy levels, quality gates, rework budgets, and audit trails.
| name | simplify |
| description | Review changed code for duplication, complexity, and over-engineering at batch boundaries. Blocking gate — must pass before next batch proceeds. |
| enforcement | gating |
| phase | build |
| standalone | false |
| requires | [] |
| model | sonnet |
Runs at pipeline batch boundaries. Catches accumulated duplication, complexity, and over-engineering before they compound across batches. Enforces "dry business logic, not dry code" — extract shared behavior, not shared shape.
This is NOT a full codebase audit. It is scoped to the current batch's changes only.
Identify files changed in the current batch:
git diff <batch-start-commit>..HEAD --name-only
Only analyze these files. Do not scan the full codebase — that would be slow and noisy.
The batch-start commit is available from .pipeline/audit-trail/batch-N/ or from the
pipeline's progress log.
Look for duplicated business logic across batch-changed files. Distinguish between:
| Type | Example | Action |
|---|---|---|
| Duplicated behavior | Same validation logic in two services | Must extract |
| Duplicated shape | Two serializers with similar structure | Leave alone |
| Copy-paste with tweaks | Same method with 1-2 param differences | Extract with parameters |
Flag when 3+ similar blocks exist across different files. Two similar blocks in the same file are a judgment call — flag only if the logic is non-trivial.
Flag methods that exceed these thresholds:
| Metric | Threshold | What It Means |
|---|---|---|
| Conditional branches | >4 per method | Too many paths to reason about |
| Method length | >25 lines | Doing more than one thing |
| Nesting depth | >3 levels | Extract inner logic |
| Parameter count | >4 parameters | Consider parameter object |
These are guidelines, not absolutes. A 26-line method that reads clearly is fine. A 15-line method with 5 nested conditionals is not.
Identify patterns that should be extracted:
Do not flag test setup duplication — test readability trumps DRY in specs.
Flag abstractions that add complexity without value:
| Pattern | Problem | Fix |
|---|---|---|
| Single-caller abstraction | Indirection without reuse | Inline it |
| Wrapper that just delegates | No added behavior | Remove wrapper |
| Config-driven with one config | Premature generalization | Hardcode it |
| Interface with one implementer | Speculative abstraction | Remove interface (unless ADR justifies) |
Exception: If an ADR in .docs/decisions/ explicitly justifies the abstraction
(e.g., "interface for future payment providers"), do not flag it.
Check for code added in this batch that is never called:
Use the linter output if available (tech-context may specify one). Otherwise, grep for references to each new symbol.
Write findings to .pipeline/audit-trail/batch-N-simplification.md:
# Simplification Check: Batch N
**Date:** YYYY-MM-DD
**Files analyzed:** [count]
**Batch commits:** <start-commit>..<end-commit>
## Findings
### Duplication
| # | Description | Files | Severity |
|---|-------------|-------|----------|
| 1 | [description] | [file1:line, file2:line] | must-fix / advisory |
### Complexity
| # | Method | File:Line | Issue | Metric |
|---|--------|-----------|-------|--------|
| 1 | [method_name] | [file:line] | [too many branches / too long / too nested] | [value] |
### Extract-Worthy Patterns
| # | Pattern | Occurrences | Suggested Extraction |
|---|---------|-------------|---------------------|
| 1 | [description] | [file1:line, file2:line, file3:line] | [extract to where] |
### Over-Engineering
| # | Abstraction | File:Line | Callers | Recommendation |
|---|-------------|-----------|---------|----------------|
| 1 | [class/method] | [file:line] | [count] | [inline / remove / keep with justification] |
### Dead Code
| # | Symbol | File:Line | Reason Unused |
|---|--------|-----------|---------------|
| 1 | [symbol] | [file:line] | [no callers / unreachable branch] |
## Verdict: CLEAN | SIMPLIFY_REQUIRED
**Must-fix items:** [count]
**Advisory items:** [count]
| Verdict | Condition | Action |
|---|---|---|
| CLEAN | Zero must-fix items | Proceed to next batch |
| SIMPLIFY_REQUIRED | One or more must-fix items | Fix before next batch; counts toward rework budget |
Advisory items are noted but do not block. They feed into the micro-retro.
Rework from simplification counts toward the pipeline rework budget (3 cycles per task). If the rework budget is exhausted, escalate to user.
.pipeline/audit-trail/batch-N-simplification.md