Simplify A Diff - alexherrero/crickets GitHub Wiki
Note
Goal: Run a targeted simplification pass over a diff, file, or directory — reduce accidental complexity without removing structure the rest of the code depends on.
Prereqs: the code-review plugin installed (Install crickets plugins); git.
/simplify is distinct from /code-review. /code-review hunts for bugs. /simplify hunts for accidental complexity — code that is harder to read, longer, or more indirected than the behavior requires. It applies Chesterton's Fence (understand why code exists before removing it) and the Rule of 500 (long functions and files are signals, not violations) to produce a rationalization table before it changes anything.
-
Invoke the command with a target — or none, to simplify the working-tree diff:
/simplify # uncommitted working-tree diff (git diff HEAD) /simplify src/auth.py # a single file /simplify src/ # a directory /simplify main...HEAD # a commit range -
Read the rationalization table. Before touching anything,
/simplifyproduces a table with one row per candidate:Location Candidate Chesterton check Rule of 500 signal Verdict file.py:423-layer wrapper Unknown origin function is 12 lines investigate util.py:88duplicate helper Confirmed dead — remove The Chesterton check column is the key column: if the origin of a piece of code is unknown, the verdict is
investigate, notremove. -
Confirm or reject the proposed changes.
/simplifyreports; it does not apply changes without your confirmation. -
After applying, re-run any affected tests to confirm nothing behavioral changed:
python3 -m pytest # or your project's test runner
Run /simplify after a feature lands, not before — you need the tests green first so the simplification pass can confirm it didn't change behavior. Typical moments:
- After a sprint of fast feature work that accumulated debt
- After a refactor that left scaffolding behind
- Before opening a PR, to keep the diff reviewable
Do not run /simplify instead of /code-review — run both; they look for different things (see the intro above).
| Symptom | Cause | Fix |
|---|---|---|
Candidate marked investigate — you think it's safe to remove |
Chesterton check is uncertain | Grep for callers (grep -rn 'function_name' src/); if genuinely dead, remove and confirm |
| Rule of 500 flags a long file that's intentionally long | Long ≠ wrong; the rule is a signal | Override: mark the finding as intentional in the reconciliation; the command skips it |
| Simplification breaks a test | Behavioral change slipped through | Revert the specific change; report via a /code-review pass to confirm the invariant |
-
Review a change for bugs —
/code-reviewfor adversarial bug-finding -
In-flight decision review —
/doubtfor pre-commit decisions -
Why adversarial review — the adversarial framing behind the
code-reviewplugin -
Install crickets plugins — get the
code-reviewplugin onto your host - Manifest schema — command primitive frontmatter reference