Skills
Skill 4 of 14
Simplify the changes of the current PR or working tree with an ablation study - remove each piece of the diff and keep only what is proven needed - so the result has just-right…
4 minutes · 859 words · 7 sections
Install
npx skills add antfu/skills --skill antfu-simplifynpx skills add antfu/skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
Review the current changes (PR branch or working tree) and cut them down to the smallest correct diff, the way a skilled developer would. The method is an ablation study: remove each piece, check whether anything that matters breaks, and keep only what earns its place.
Goal: clean, minimal code with the just-right abstraction, that is also robust (handles real edge cases) and universal (solves the general case, not only the one that triggered the change).
git merge-base HEAD origin/<default>), else git diff HEAD for uncommitted work. Read the full diff and the files around it. Note the goal of the change in one sentence; it is the yardstick for everything below.git diff --stat). Do not commit unless asked.For every piece in the diff, ask: if I delete this, what concretely breaks?
| Piece | Ablation | Keep if |
|---|---|---|
| New function / helper | Inline it at the call site | Called from 2+ places, or the name explains a non-obvious step |
| Wrapper / abstraction layer | Call the underlying thing directly | It hides real complexity or a likely-to-change boundary |
| Parameter / option / config | Hardcode the only used value | A real caller needs a different value now |
| Type / interface / generic | Use the inferred or existing type | It is exported, or inference gives a worse or wrong type |
| Branch / guard / try-catch | Delete it and run tests | It guards a reachable case (real input, real failure), not an impossible one |
| New file / module | Merge it into its only consumer | It has multiple consumers or a distinct responsibility |
| Dependency | Replace with a few lines or an existing dep | It handles hard edge cases you would otherwise get wrong |
| Duplicate logic | Reuse an existing util in the repo | No equivalent exists (search first) |
| Comment | Delete it | It explains why (constraint, workaround, surprising choice), not what |
| Test | Remove it and see what is unprotected | It covers behavior or a regression nothing else covers |
| Changed lines unrelated to the goal | Revert them | Never keep drive-by edits |
Cut when the piece is:
Keep (or even add) when the piece is:
If an abstraction is too small, merge; if a function does several unrelated things, split. The target is neither fewest lines nor most layers, it is the fewest concepts a reader must hold.
if (name === 'foo')) where a general rule would cover them.typeof, ReturnType, Parameters, utility types).| # | Piece | Action | Why |
|---|-------|--------|-----|
| 1 | `parseOptions()` in src/cli.ts | inlined | one caller, 3 lines |
| 2 | `retry` option | removed | no caller passes it; default is enough |
| 3 | `try/catch` in fetchData | kept | network errors reach users; test covers it |
Diff: +142 -8 -> +61 -8. Tests, typecheck, lint pass.List anything noticed but out of scope (unrelated bugs, wider refactors) separately, and leave it alone.
Simplify the changes of the current PR or working tree with an ablation study - remove each piece of the diff and keep only what is proven needed - so the result has just-right abstraction, minimal clean code, and stays robust and universal. Use when asked to simplify, slim down, clean up, or reduce the current changes or PR.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 5 November 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:/antfu/skills.md, and each skill at its own .md URL.