Simplify
Run a narrow readability pass on a real diff.
Make code easy to consume. Optimize for readability, skimmability, directness, and early returns. Avoid cleverness.
This is not a redesign skill. It is a pre-commit cleanup pass.
If the current repo has a local simplify skill, apply that addendum after this base skill.
When to Use
- before every commit on the pending diff
- when asked to simplify, clean up, or reduce slop
- when code works but feels noisy, indirect, over-abstracted, or hard to scan
Goal
Simplify changed code without changing:
- externally observable behavior
- compatibility surfaces
- ownership boundaries
- validation, auth, telemetry, logging, or safety guards
Bias toward:
- deletion over addition
- derived values over stored flags
- tagged states over boolean soup and optional bags
- early returns over nested branches
- explicit function contracts over mixed side effects
- direct names over clever helpers
- local code over one-off abstractions
- tables or maps when branches only differ by data
- existing canonical patterns over new micro-patterns
Read This First
Always read:
- repo
AGENTS.md if present
- nearest package or subdirectory
AGENTS.md if present
Read only if needed:
- repo architecture or ownership docs when system boundaries are unclear
- the current repo's local
simplify skill, if one exists
- Simplify Gotchas when deciding whether a cleanup is real simplification or fake simplification
- Simplify Checklist before applying or reporting changes
Hard Stops
Do not:
- change behavior just to make code look cleaner
- remove compatibility paths or migrate domains during simplify-only work
- replace established model, service, or context helpers with raw access when those helpers enforce invariants
- remove validation, telemetry, logging, auth, or guard code
- store derived state just to save a line of computation
- widen types into optional bags when a tagged shape would remove ambiguity
- let a pure helper quietly mutate data
- mix mutation and return-value semantics in a way that hides side effects
- introduce a new abstraction unless it makes the code clearly easier to read
If safety is unclear, downgrade to proposal-only or skip it.
Core Loop
- Build scope from explicit path, otherwise working diff, otherwise latest commit.
- If there is no diff, stop with
nothing to simplify.
- List all changed files. If more than 6 files, use the parallel strategy below. Otherwise, process inline.
- Sweep every changed file. Find all readability problems, not just a few. Be thorough — scan every function, every branch, every type, every import.
- Apply every fix that passes the Safe Fix Test below. Do not self-limit to a small count.
- Run the smallest relevant verification.
- Report what got simpler, what was skipped, and why it was safe.
Do not force a cleanup pass if nothing clearly gets better, but do not artificially stop early when there is more to fix.
Parallel Strategy (Large Diffs)
When the diff touches more than 6 files, split the work across parallel subagents to avoid context bloat and attention drift.
- Group changed files into batches of up to 6 files each. Keep related files together when obvious (e.g. a component and its test, a module and its types).
- Launch one subagent per batch using the Task tool. Max 5 subagents at once to avoid bogging down the device. If there are more batches, run them in waves of 5 until all are addressed.
- Each subagent prompt:
Load the simplify skill. Run it on only these files: <list>. Do not run verification — just apply fixes and report back.
- After all waves complete, the orchestrator runs verification once and produces the unified Output report.
Hunt These (All of Them)
Sweep every changed file for all of these. Do not stop after the first few wins:
- wrappers that only rename or forward behavior
- one-off exported types or interfaces with no real reuse
- boolean mode soup and optional bags that want a tagged state
- effect-driven derived state or mirrored state
- speculative memoization or callback churn
- helper extraction that moves logic away from the source of truth
- hard-to-skim branching that wants early returns
- repeated branches that all return the same shape and want a table
- tiny abstractions added for aesthetics, not clarity
Safe Fix Test
Apply a simplification only when the answer is clearly yes:
- Is the code easier to scan than before?
- Did we remove a layer, branch, flag, or rename-only wrapper?
- Did we make the state model or function contract more explicit?
- Does the code still live in the same correct home?
- Would a new reviewer understand the flow faster?
- Is verification straightforward?
If the answer is weak, move it to proposal-only instead of silently skipping.
Verification
Use the smallest check that proves the cleanup is safe:
- targeted tests for changed modules when available
- the smallest relevant typecheck or lint command
- add focused checks beyond typecheck when async behavior, interaction flow, or visible UI changed
- if no automated check exists, state the manual verification plan explicitly
Typecheck alone is not enough when the cleanup changes async behavior, interaction flow, or visible UI structure.
Output
Return concise sections:
Scope used
Applied fixes
Skipped or proposal-only items
Verification evidence
Residual risks or assumptions
For each applied fix, say:
- path
- what got simpler
- why it is safe
In This Reference
1---2name: simplify3description: Pre-commit readability pass for pending diffs. Use when simplifying changed code to make it easier to consume, skimmable, non-clever, and locally obvious without changing behavior or important boundaries.4---56# Simplify78Run a narrow readability pass on a real diff.910Make code easy to consume. Optimize for readability, skimmability, directness, and early returns. Avoid cleverness.1112This is not a redesign skill. It is a pre-commit cleanup pass.1314If the current repo has a local `simplify` skill, apply that addendum after this base skill.1516## When to Use1718- before every commit on the pending diff19- when asked to simplify, clean up, or reduce slop20- when code works but feels noisy, indirect, over-abstracted, or hard to scan2122## Goal2324Simplify changed code without changing:2526- externally observable behavior27- compatibility surfaces28- ownership boundaries29- validation, auth, telemetry, logging, or safety guards3031Bias toward:3233- deletion over addition34- derived values over stored flags35- tagged states over boolean soup and optional bags36- early returns over nested branches37- explicit function contracts over mixed side effects38- direct names over clever helpers39- local code over one-off abstractions40- tables or maps when branches only differ by data41- existing canonical patterns over new micro-patterns4243## Read This First4445Always read:4647- repo `AGENTS.md` if present48- nearest package or subdirectory `AGENTS.md` if present4950Read only if needed:5152- repo architecture or ownership docs when system boundaries are unclear53- the current repo's local `simplify` skill, if one exists54- [Simplify Gotchas](./references/gotchas.md) when deciding whether a cleanup is real simplification or fake simplification55- [Simplify Checklist](./references/simplify-checklist.md) before applying or reporting changes5657## Hard Stops5859Do not:6061- change behavior just to make code look cleaner62- remove compatibility paths or migrate domains during simplify-only work63- replace established model, service, or context helpers with raw access when those helpers enforce invariants64- remove validation, telemetry, logging, auth, or guard code65- store derived state just to save a line of computation66- widen types into optional bags when a tagged shape would remove ambiguity67- let a pure helper quietly mutate data68- mix mutation and return-value semantics in a way that hides side effects69- introduce a new abstraction unless it makes the code clearly easier to read7071If safety is unclear, downgrade to `proposal-only` or skip it.7273## Core Loop74751. Build scope from explicit path, otherwise working diff, otherwise latest commit.762. If there is no diff, stop with `nothing to simplify`.773. List all changed files. If **more than 6 files**, use the parallel strategy below. Otherwise, process inline.784. Sweep every changed file. Find **all** readability problems, not just a few. Be thorough — scan every function, every branch, every type, every import.795. Apply every fix that passes the Safe Fix Test below. Do not self-limit to a small count.806. Run the smallest relevant verification.817. Report what got simpler, what was skipped, and why it was safe.8283Do not force a cleanup pass if nothing clearly gets better, but do not artificially stop early when there is more to fix.8485## Parallel Strategy (Large Diffs)8687When the diff touches **more than 6 files**, split the work across parallel subagents to avoid context bloat and attention drift.88891. Group changed files into batches of **up to 6 files each**. Keep related files together when obvious (e.g. a component and its test, a module and its types).902. Launch one subagent per batch using the Task tool. **Max 5 subagents at once** to avoid bogging down the device. If there are more batches, run them in waves of 5 until all are addressed.913. Each subagent prompt: `Load the simplify skill. Run it on only these files: <list>. Do not run verification — just apply fixes and report back.`924. After all waves complete, the orchestrator runs verification once and produces the unified Output report.9394## Hunt These (All of Them)9596Sweep every changed file for all of these. Do not stop after the first few wins:9798- wrappers that only rename or forward behavior99- one-off exported types or interfaces with no real reuse100- boolean mode soup and optional bags that want a tagged state101- effect-driven derived state or mirrored state102- speculative memoization or callback churn103- helper extraction that moves logic away from the source of truth104- hard-to-skim branching that wants early returns105- repeated branches that all return the same shape and want a table106- tiny abstractions added for aesthetics, not clarity107108## Safe Fix Test109110Apply a simplification only when the answer is clearly yes:111112- Is the code easier to scan than before?113- Did we remove a layer, branch, flag, or rename-only wrapper?114- Did we make the state model or function contract more explicit?115- Does the code still live in the same correct home?116- Would a new reviewer understand the flow faster?117- Is verification straightforward?118119If the answer is weak, move it to `proposal-only` instead of silently skipping.120121## Verification122123Use the smallest check that proves the cleanup is safe:124125- targeted tests for changed modules when available126- the smallest relevant typecheck or lint command127- add focused checks beyond typecheck when async behavior, interaction flow, or visible UI changed128- if no automated check exists, state the manual verification plan explicitly129130Typecheck alone is not enough when the cleanup changes async behavior, interaction flow, or visible UI structure.131132## Output133134Return concise sections:135136- `Scope used`137- `Applied fixes`138- `Skipped or proposal-only items`139- `Verification evidence`140- `Residual risks or assumptions`141142For each applied fix, say:143144- path145- what got simpler146- why it is safe147148## In This Reference149150| File | Purpose |151|------|---------|152| [references/gotchas.md](./references/gotchas.md) | High-signal pitfalls: fake simplification, boundary drift, and readability traps |153| [references/simplify-checklist.md](./references/simplify-checklist.md) | Quick safety and verification checklist |