griffinwork40/agent-afk/src/bundled-plugins/awa-bundled/skills/simplify/SKILL.md
simplify
Discovers incidental complexity, duplication, and dead code in a codebase and produces a ranked, behavior-preserving reduction plan — optionally applying safe changes. Dispatches four parallel read-only discovery lenses (clone detection, dead code, complexity hotspots, wrong abstraction), synthesizes into a prioritized reduction plan, and gates apply mode behind /refactor and a hard test check.
- Source repository stars
- 45
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-07-28
- Source checked
- 2026-07-28
Decision brief
What it does—and where it fits
Discovers incidental complexity, duplication, and dead code in a codebase and produces a ranked, behavior-preserving reduction plan — optionally applying safe changes. Dispatches four parallel read-only discovery lenses (clone detection, dead code, complexity hotspots, wrong abstraction), synthesizes into a prioritized reduction plan, and gates apply mode b…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/griffinwork40/agent-afk --skill "src/bundled-plugins/awa-bundled/skills/simplify"Inspect the Agent Skill "simplify" from https://github.com/griffinwork40/agent-afk/blob/803066d4f1e0cd57e983658dc670d647fcd893c9/src/bundled-plugins/awa-bundled/skills/simplify/SKILL.md at commit 803066d4f1e0cd57e983658dc670d647fcd893c9. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Sub-agent contract
/simplify is a discovery-and-prioritization skill, not a correctness auditor (that is /review's job) and not a blind executor (that is /refactor's job). It answers: what incidental complexity, duplication, and dead weight exists in this code, and what is safe to remove? Default…
/simplify is a discovery-and-prioritization skill, not a correctness auditor (that is /review's job) and not a blind executor (that is /refactor's job). It answers: what incidental complexity, duplication, and dead weig…Scope is diff-bounded by default (git diff origin/main, or working-tree/HEAD if no remote). Pass --all for a whole-repo sweep (where duplication and dead-code analysis pay off most). Pass an explicit [target] path or PR… - 02
Argument parsing
Parse arguments before dispatching Wave 1. Resolve scope to a concrete file list or diff stat and attach it to every sub-agent prompt.
Parse arguments before dispatching Wave 1. Resolve scope to a concrete file list or diff stat and attach it to every sub-agent prompt. - 03
Wave 1 — Parallel discovery (read-only)
Dispatch all four lenses simultaneously as research-agent sub-agents. All are strictly read-only — no writes, no installs that modify package.json. Optional tooling (jscpd, knip) is an accelerant only; degrade to grep/structural reasoning when absent or network-gated.
A file:line citation for the symbol.A structural evidence path — who would import it, and why nothing does.Dispatch all four lenses simultaneously as research-agent sub-agents. All are strictly read-only — no writes, no installs that modify package.json. Optional tooling (jscpd, knip) is an accelerant only; degrade to grep/s… - 04
(a) Duplication / clone detection
Find exact and near-duplicate logic blocks across modules within scope. Optionally seed with:
Find exact and near-duplicate logic blocks across modules within scope. Optionally seed with:If jscpd is absent, use grep for literal repetition and structural reasoning for semantic clones. Output: clone clusters with file:line ranges, estimated token overlap, and a suggested extraction site. - 05
(b) Dead code / unused exports
Find module-graph-dead exports, unreachable branches, and obsolete feature flags — beyond what tsc --noEmit --noUnusedLocals already catches. Optionally seed with:
A file:line citation for the symbol.A structural evidence path — who would import it, and why nothing does.Find module-graph-dead exports, unreachable branches, and obsolete feature flags — beyond what tsc --noEmit --noUnusedLocals already catches. Optionally seed with:
Permission review
Static risk signals and limitations
Runs scripts
The documentation asks the agent to run terminal commands or scripts.
npx jscpd <scope> --reporters json --silentRuns scripts
The documentation asks the agent to run terminal commands or scripts.
npx knip --reporter jsonEvidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 82/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 45 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- griffinwork40/agent-afk
- Skill path
- src/bundled-plugins/awa-bundled/skills/simplify/SKILL.md
- Commit
- 803066d4f1e0cd57e983658dc670d647fcd893c9
- License
- Apache-2.0
- Collected
- 2026-07-28
- Default branch
- main
View the original SKILL.md
Sub-agent contract
/contract
Overview
/simplify is a discovery-and-prioritization skill, not a correctness auditor (that is /review's job) and not a blind executor (that is /refactor's job). It answers: what incidental complexity, duplication, and dead weight exists in this code, and what is safe to remove? Default mode is read-only: a ranked reduction plan is emitted but nothing is changed. Writes only happen when --apply is explicitly passed.
Scope is diff-bounded by default (git diff origin/main, or working-tree/HEAD if no remote). Pass --all for a whole-repo sweep (where duplication and dead-code analysis pay off most). Pass an explicit [target] path or PR reference to override both. Code with no test coverage is safe to analyze but must never be auto-applied — the skill surfaces that gap and recommends /simplify [target] --all after adding tests, or produces the plan and stops.
Argument parsing
| Argument | Effect |
|---|---|
| (none) | Scope = git diff origin/main (working-tree fallback) |
[target] | Explicit path, glob, or PR ref |
--all | Whole-repo sweep; excludes node_modules/, dist/, generated files |
--apply | Opt-in write mode; default is read-only plan |
Parse arguments before dispatching Wave 1. Resolve scope to a concrete file list or diff stat and attach it to every sub-agent prompt.
Wave 1 — Parallel discovery (read-only)
Dispatch all four lenses simultaneously as research-agent sub-agents. All are strictly read-only — no writes, no installs that modify package.json. Optional tooling (jscpd, knip) is an accelerant only; degrade to grep/structural reasoning when absent or network-gated.
(a) Duplication / clone detection
Find exact and near-duplicate logic blocks across modules within scope. Optionally seed with:
npx jscpd <scope> --reporters json --silent
If jscpd is absent, use grep for literal repetition and structural reasoning for semantic clones. Output: clone clusters with file:line ranges, estimated token overlap, and a suggested extraction site.
(b) Dead code / unused exports
Find module-graph-dead exports, unreachable branches, and obsolete feature flags — beyond what tsc --noEmit --noUnusedLocals already catches. Optionally seed with:
npx knip --reporter json
MANDATORY GROUNDING: every "X is unused/dead" claim MUST carry:
- A
file:linecitation for the symbol. - A structural evidence path — who would import it, and why nothing does.
Dynamic imports, reflection, string-keyed access, and barrel re-exports are common false-positive vectors. Never assert dead code without grounding. Flag uncertain cases as POSSIBLE-DEAD rather than DEAD.
(c) Complexity hotspots
Identify over-long functions (>40 lines), deep nesting (>3 levels), boolean-flag parameters, primitive obsession, and sprawling switch/if chains. The target repo has NO ESLint — this lens is pure agent reasoning over the code, not lint output. Rank by cyclomatic complexity estimate × call-site frequency. Output: hotspot list with file:line, smell label, and a plain-language refactor suggestion.
(d) Reuse / wrong-abstraction-level
Find code that reimplements an existing helper, sits at the wrong layer (leaky abstraction, unnecessary wrapper), or is a thin pass-through with no added value. Cross-reference the project's existing utilities before flagging. Output: reuse candidates with file:line, what existing construct could replace them, and estimated call-site count.
Synthesis — inline, after Wave 1
- Dedup: one site often trips multiple lenses. Merge duplicate entries; annotate each with the lens(es) that flagged it.
- SANDI-METZ WRONG-ABSTRACTION GUARD: flag but do NOT propose collapsing two code paths if unifying them requires introducing a new boolean/flag parameter. Record these as "defer — duplication is cheaper than the wrong abstraction" with an explanation.
- Rank by impact × safety:
- HIGH IMPACT: multi-site duplication, provably dead exports, complexity hotspots at high call frequency.
- LOW RISK: purely local changes, full test coverage, no public API surface.
- Deprioritize: single-use private helpers, style preferences, anything touching uncovered code.
- Emit the reduction plan — one row per finding:
| # | Location (file:line) | Smell | Proposed simplification | Risk note | Behavior-preservation note |
|---|
- Append a Coverage gate summary: list files in scope with no test coverage where apply was requested — recommend tests first.
In default (read-only) mode: STOP here. Print the plan and exit.
Wave 2 — Gated apply (only when --apply is passed)
Before any write, verify the test suite is green:
pnpm lint && pnpm test
If the gate is red before any change, abort apply and report. Do not attempt to fix pre-existing failures.
Delegation decision (per ranked item, high-to-low):
- Multi-site mechanical changes (extract duplicated block into a shared helper used at N≥2 sites): delegate to
/refactorif available./refactorhandles DAG-layered, worktree-isolated parallel application with a hard test gate at each layer boundary and a behavioral diff. Pass the reduction plan item as the refactor spec. /refactorNOT available, OR single-site local simplifications: apply directly inside a git worktree. One change at a time; runpnpm lint && pnpm testafter each. On regression → route to/diagnose; revert the change; continue with remaining items.- Items touching uncovered code: skip apply, preserve in plan output as "plan-only — no test coverage".
On full success, chain to /ship for commit + PR.
Guardrails
- Behavior-preserving only — never change observable behavior under the guise of cleanup.
- Exclude
node_modules/,dist/, vendored code, and auto-generated files from all analysis. - Optional tooling (
jscpd,knip) must not modifypackage.jsonor lock files — usenpxwith no persistent side effects. - Diff-scoped by default; whole-repo only on
--all— avoids signal-drowning noise on large codebases. - Max 3 apply-layer retries per item before skipping and continuing.
Failure modes to surface explicitly
| Failure mode | Mitigation |
|---|---|
| Over-DRYing / wrong abstraction | Sandi-Metz guard (see Synthesis step 2) |
| False dead-code positives | Mandatory grounding rule on lens (b) |
| Behavior change disguised as cleanup | Pre/post test gate; worktree isolation |
| Scope creep on large repos | Diff-scope default; --all is explicit opt-in |
Chains to
/refactor— multi-site mechanical apply/ship— commit + PR after successful apply/diagnose— when an applied simplification breaks a test
Alternatives
Compare before choosing
yun520-1/mark-heartflow-skill
simplify
Refactor code for clarity, consistency, and maintainability without changing behavior. Use when the user types /simplify or asks to simplify code.
coreyhaines31/marketingskills
ab-testing
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
event4u-app/agent-config
testing-anti-patterns
Use BEFORE writing/changing tests, adding mocks, or test-only methods on production classes — vs mocking-the-mock, production pollution, partial mocks, and overfit/tautological assertions
event4u-app/agent-config
design-review
Use when the user says "review the design", "check the UI", or wants a comprehensive UI/UX review. Uses a 7-phase methodology covering interaction, responsiveness, accessibility, and more.