Generated banner for Antfu Simplify
Generated logo for Antfu Simplify

Antfu Simplify

Anthony FuCommunityCreated by Anthony Fu

  • Skill
  • Review and audit
  • Software development
  • MIT
  • No issues found

From the author

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 description by Anthony Fu

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill guides developers through a systematic ablation study to refine PRs or working tree changes. By evaluating each piece of a diff—such as functions, parameters, or abstractions—against the core goal of the change, it helps remove speculative, redundant, or noisy code. The process ensures that the final result remains robust and universal while adhering to the existing codebase's style and constraints.

What it does

  • Analyzes diffs to identify components that can be removed, inlined, or merged.
  • Validates removals by running tests, typechecks, and linting.
  • Provides a structured framework for deciding whether to keep or cut specific code elements.
  • Generates a summary report detailing the actions taken and the resulting change in diff size.
  • Ensures changes remain focused on the stated goal without introducing unrelated refactors.

When to use it

  • When you need to reduce the complexity of a pull request.
  • When you want to ensure your changes are minimal and clean.
  • When you suspect a change contains speculative or 'just in case' code.
  • When you need to verify that every part of a diff is necessary for the intended behavior.

Advantages

  • Reduces code bloat by eliminating unnecessary abstractions and speculative features.
  • Ensures that remaining code is verified against existing tests and linting rules.
  • Promotes the use of existing utilities rather than hand-rolled alternatives.
  • Provides a clear, objective report of the simplification process.

Usage examples

“Simplify the changes in my current PR branch.”
The agent performs an ablation study, identifies redundant helpers and unused parameters, and provides a report showing the reduced diff size.
“Review my uncommitted changes and remove anything that isn't strictly necessary.”
The agent analyzes the working tree diff, suggests removals for speculative code, and confirms the remaining changes pass all project tests.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/antfu/antfu-simplify/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip antfu-simplify.zip -d .agents/skills

Documentation by Anthony Fu

Simplify Changes

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).

Hard Rules

  • Behavior stays the same. Simplify only. Do not add features, change public APIs, or fix unrelated issues. Report unrelated findings instead.

  • Scope is the diff. Only touch code the change introduced or modified, plus code that must change to remove it. Do not refactor the surrounding codebase.

  • Every removal is verified. Run the repo's tests, typecheck, and lint after each batch. If a check has no coverage for the removed piece, reason about it explicitly or keep it.

  • Match the surrounding code's style, naming, and comment density.

Workflow

  1. Get the diff. Pick the base: PR target branch merge base (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.

  2. Inventory the pieces. List each unit the diff adds: function, parameter, option, branch, type, file, dependency, abstraction layer, comment, test. See Ablation Study.

  3. Ablate. For each piece, try removing, inlining, or merging it. Decide keep or cut using Keep vs Cut.

  4. Apply the cuts in small steps. After each batch run focused checks (tests, typecheck, lint). Revert a cut that breaks behavior; that piece is now proven needed.

  5. Check the result. Re-read the final diff as a reviewer. Is each remaining line explained by the one-sentence goal? Is it still robust and general?

  6. Report. Show a short table of what was cut or kept and why, plus the diff size before and after (git diff --stat). Do not commit unless asked.

Ablation Study

For every piece in the diff, ask: if I delete this, what concretely breaks?

PieceAblationKeep if
New function / helperInline it at the call siteCalled from 2+ places, or the name explains a non-obvious step
Wrapper / abstraction layerCall the underlying thing directlyIt hides real complexity or a likely-to-change boundary
Parameter / option / configHardcode the only used valueA real caller needs a different value now
Type / interface / genericUse the inferred or existing typeIt is exported, or inference gives a worse or wrong type
Branch / guard / try-catchDelete it and run testsIt guards a reachable case (real input, real failure), not an impossible one
New file / moduleMerge it into its only consumerIt has multiple consumers or a distinct responsibility
DependencyReplace with a few lines or an existing depIt handles hard edge cases you would otherwise get wrong
Duplicate logicReuse an existing util in the repoNo equivalent exists (search first)
CommentDelete itIt explains why (constraint, workaround, surprising choice), not what
TestRemove it and see what is unprotectedIt covers behavior or a regression nothing else covers
Changed lines unrelated to the goalRevert themNever keep drive-by edits

Keep vs Cut

Cut when the piece is:

  • Speculative: built for a future need nobody has (extra options, hooks, plugin points, "just in case" generics).

  • Redundant: repeats what the language, framework, types, or an existing util already provides.

  • Defensive against the impossible: null checks on values the types or callers guarantee, fallbacks that never run, catch blocks that swallow errors.

  • Indirection without payoff: one-use helpers, pass-through wrappers, classes where a function works, factories that build one thing.

  • Noise: commented-out code, narrating comments, unused imports and exports, formatting-only churn.

Keep (or even add) when the piece is:

  • Robustness: handles real edge cases (empty input, concurrency, cleanup, cross-platform paths, error propagation with context).

  • Universality: solves the general problem instead of special-casing the reported one. If the fix hardcodes a name, path, or value from the bug report, generalize it.

  • Right-sized abstraction: the third repetition of something gets extracted; the first and second usually do not. A good abstraction removes more code than it adds.

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.

Smells to Look For

  • A fix that patches the symptom at the call site instead of the cause.

  • Special cases (if (name === 'foo')) where a general rule would cover them.

  • Two code paths that do the same thing with small differences; unify them.

  • State, flags, or caches that can be derived from existing data.

  • Long parameter lists or option bags where most values are never varied.

  • Types duplicated by hand when they can be derived (typeof, ReturnType, Parameters, utility types).

  • Hand-rolled utilities that the repo, runtime, or an existing dependency already has.

  • Tests that assert implementation details or mirror the code line by line.

Report Format

| # | 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.

Files

LICENSE

MIT License

Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Anthony Fu
Publisher
Anthony Fu (Community)
Source
antfu/skills · skills/antfu-simplify · commit f63e9ec
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Anthony Fu.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download antfu-simplify.zip