agentleFS
bInference-LabbInference-Lab/bInference/.agents/skills/clean-diff/SKILL.md

clean-diff

Skill2 starsChanged 2 days agoMITView on GitHub

Strips filler from a change before review. Use on your own diff when the code works and before review-diff, to remove narrating comments, speculative helpers, one-use wrappers, duplicate guards and words the style guard refuses.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run this on the diff you wrote, after the tests pass and before review-diff.

    line 8
  2. Distinctive:

    Read every changed line once, top to bottom, with the questions below.

    line 18
  3. Distinctive:

    Every public export keeps one TSDoc block: what it does and what a caller must know.

    line 22
  4. Distinctive:

    Delete comments that narrate the next line, explain syntax, record history or name a task.

    line 25
  5. Very specific:

    Delete commented-out code.

    line 26
  6. Distinctive:

    Every new word a person sees exists in English and Simplified Chinese.

    line 45
  7. Distinctive:

    Test names are sentences that state the behavior.

    line 49
  8. Distinctive:

    No conditional expects, no focused or skipped tests, no sleeps or real timers.

    line 50
  9. Distinctive:

    Delete tests that only repeat the implementation.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Clean the diff

Run this on the diff you wrote, after the tests pass and before review-diff. It removes what a reviewer should never have to read. It changes no behavior.

1. Read the diff

git diff --staged
git diff master...HEAD

Read every changed line once, top to bottom, with the questions below.

2. Comments

  • Every public export keeps one TSDoc block: what it does and what a caller must know.
  • A // comment stays only when it states a constraint the code cannot show: ownership, lifecycle, ordering, cleanup, platform or a dependency's quirk.
  • Delete comments that narrate the next line, explain syntax, record history or name a task.
  • Delete commented-out code. Delete TODO, FIXME and XXX; open an issue instead.

3. Code that earns nothing

  • A helper with one caller and no second user coming: inline it.
  • A wrapper that only renames or forwards: call the target.
  • A guard for a state the types or an earlier check rule out: delete it.
  • A parameter, option or export no caller uses: delete it.
  • A second copy of logic that exists elsewhere: call the first copy, or move it to the lowest package both callers share.
  • An abstraction with one implementation and no test fake: remove the layer.

4. Names and words

  • Names come from docs/GLOSSARY.md, never from other agent frameworks.
  • Units sit in names: timeoutMs, slippageBps, amountBase, usdMicros.
  • Booleans read as questions: isFrozen, hasQuote, canSign.
  • Text is short, active and in the present tense. No em or en dashes, no emojis, no words from config/style/banned-words.txt.
  • Every new word a person sees exists in English and Simplified Chinese.

5. Tests

  • Test names are sentences that state the behavior.
  • No conditional expects, no focused or skipped tests, no sleeps or real timers.
  • Delete tests that only repeat the implementation; keep the ones that pin behavior.

6. Check and report

pnpm format
pnpm check:style --files <each changed file>
pnpm check

Report what you removed and why, in a few lines, then run review-diff.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.