skills/simplify/SKILL.md
Review changed code for reuse, quality, and efficiency, then apply low-risk simplifications that preserve behavior exactly.
npx skillsauth add jankneumann/agentic-coding-tools simplifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Inspect a focused diff or module for behavior-preserving simplifications: dead code, deep nesting, long functions, premature abstractions, generic names. The goal is fewer moving parts, not stylistic preference.
This skill is read-then-edit: it reviews first, names the candidate simplifications, gates each one against Chesterton's Fence, and only then makes changes. Simplifications that span large surface areas are deferred to automation (Rule of 500).
Before removing or refactoring any non-trivial piece of code, answer all three questions. If any answer is "I don't know," stop and investigate — do not simplify.
git blame on the relevant lines and read the introducing commit message.grep for callers / references — what else depends on this?If all three questions have clear answers and the answer to (2) is "nothing — the original reason is no longer relevant" then the fence is safe to remove. Otherwise: rewrite the explanation as a code comment and leave the fence standing.
Simplifications that would touch more than 500 lines OR more than 5 files SHALL NOT be done by hand. Manual large-scale refactors are error-prone, hard to review, and tend to ship regressions in the long tail of edge cases.
When the candidate change exceeds the 500/5 threshold:
sed/grep script. The automation itself is reviewable, and the diff it produces is mechanical.If neither (a) nor (b) is feasible, the simplification is too risky for this skill — escalate to a planning step (/plan-feature) so the work gets a proposal, design, and review gates.
Six common simplification patterns that this skill is allowed to apply (subject to Chesterton's Fence and Rule of 500):
if/for/try nesting is a smell. Invert the conditions and return early. The body of the function then reads top-to-bottom as the happy path.if/elif/else chain, or — if the branching is value-based — a dict/map lookup.bool parameter that switches its behavior is two functions wearing one name. Split into do_thing() and do_thing_with_X() (or whatever distinguishes the two paths). Bonus: the call sites become self-documenting.data, info, obj, temp, result, value) → domain names. Names that don't say what kind of thing the variable is force every reader to re-derive the type. Replace with the domain term: user_record, pending_invoice, parsed_request.# CHESTERTON: kept because <reason> comment if the reasoning isn't already obvious.refactor(parser): extract guard clauses from validate_input).| Rationalization | Why it's wrong |
|---|---|
| "I don't need to read git blame — the code is obviously dead" | "Obviously dead" code is the #1 source of subtle regressions. The blame log frequently reveals a comment like "DO NOT REMOVE — handles legacy clients on /v1". Run blame; it's free. |
| "It's only 600 lines — I can do it by hand carefully" | The Rule of 500 isn't about your skill, it's about reviewer attention. A 600-line manual diff has tail-end edge cases nobody will catch. Automate or split. |
| "This abstraction will pay off when we add the second implementation" | The second implementation may never arrive, and if it does, its requirements will reshape the abstraction anyway. Inline now; abstract later when the shape is real. |
| "Renaming data to user_record is a stylistic preference, not a simplification" | It's a cognitive load simplification: every reader saves a re-derivation step. The pattern catalog lists it because it pays off in proportion to read frequency. |
| "The function is 80 lines but it's all one algorithm — splitting hurts readability" | If it's truly one algorithm, name the steps as helpers — the outline becomes the readable artifact. If splitting hurts readability, the steps weren't really steps; revisit Chesterton's Fence question 1. |
git blame investigation recorded in the PR description (Chesterton's Fence question 1 skipped).implement-feature violation — split the commits).NOTICED BUT NOT TOUCHING: from implement-feature).git blame line(s) or commit that introduced it, demonstrating the Chesterton's Fence check was performed.git diff main...HEAD --stat | tail -1 shows ≤ 500 lines and ≤ 5 files, OR the PR description names the codemod / automation that produced the diff.git diff main...HEAD -- '*test*' shows no changes to test assertions — only test renames or restructurings consistent with the simplification.development
Open the artifacts relevant to a review (OpenSpec proposal, branch changes, or explicit paths) in VS Code, in a curated read-order, in the right worktree.
tools
Render and seed coordinator-owned task status block in OpenSpec tasks.md
testing
User-invocable skill that omits the tail block
tools
Missing several required keys