agentleFS
MammadovEshginMammadovEshgin/clean-code-skill/skills/finish/SKILL.md

finish

Skill1 starsChanged 2 months agoMITView on GitHub

Finish a change before it is committed. Interrogates the diff, removes slop, audits its tests, hunts bugs and security flaws in it, runs the gates, reviews it in a fresh context, applies the findings, and leaves the tree ready to commit with one report. Sized to the risk of the change. Target is the uncommitted diff, or the branch when a base ref is given.

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use status, bootstrap and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 5 projects that use this

  • OpenAISkill

    bootstrap

    Project bootstrapping orchestrator for repos that depend on Vercel-linked resources (databases, auth, and managed integrations). Use when setting up or repairing a repository so linking, environment provisioning, env pulls, and first-run db/dev commands happen in the correct safe order.

    Also in 3 projects that use this

  • AnthropicSkill

    debug

    Structured debugging session — reproduce, isolate, diagnose, and fix. Trigger with an error message or stack trace, "this works in staging but not prod", "something broke after the deploy", or when behavior diverges from expected and the cause isn't obvious.

    Also in 5 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 6 projects that use this

  • dillonluiSkill

    design-review

    Review a view or flow for UX and UI issues. Provides severity-ranked, actionable findings grounded in established design heuristics. Use when the user asks for design feedback, UX review, or UI critique.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 8 projects that use this

  • +1 more from anthropics

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write the change record, once, and hand it to every step and to the reviewer:

    line 17
  2. Very specific:

    Read ${CLAUDE_SKILL_DIR}/../interrogate/SKILL.md and apply it to the target with the record.

    line 45
  3. Very specific:

    Read ${CLAUDE_SKILL_DIR}/../deslop/SKILL.md and apply it to the target's files with --refactor-only and the record, the hunks the target …

    line 49
  4. Very specific:

    Read ${CLAUDE_SKILL_DIR}/../test-audit/SKILL.md and apply it to the tests the target added or changed and to the seams it changed that have …

    line 53
  5. Very specific:

    Read ${CLAUDE_SKILL_DIR}/../audit/SKILL.md and apply it to the target's hunks and the functions they call.

    line 57
  6. Very specific:

    Run the level's check. Red caused by the target is fixed before the review.

    line 61

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “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

Finish

One command between "it works" and git commit. It runs the finishing skills in the order that wastes the least work (interrogate first, because a deleted function needs no cleaning), sized to the risk of the change, with the discovery done once and handed to every step.

Arguments: $ARGUMENTS. The first argument that is not a flag is the base ref. --commit commits when the verdict is ready. --fast, --standard, --deep force a level; otherwise the level comes from the change.

0. Pin the change and write the record

  • Target: with uncommitted changes, git diff HEAD plus untracked files from git status --short; with a clean tree, git diff <base>...HEAD (default base: the merge-base with main or master), and edits below land in the working tree on top of the branch. Empty target: stop and say so.
  • Write the change record, once, and hand it to every step and to the reviewer:

    Purpose   <one sentence, from the request, commit messages, branch name, or a spec file>
    Target    <working tree | base..HEAD> · <files> · <hunks per file>
    Checks    check: <command> · fast: <lint + typecheck command> · focused tests: <command>
    Standards <CODING_STANDARDS.md | CONTRIBUTING.md | CLAUDE.md sections, or none>
    Baseline  tests <N/N> · diff-stats <+a / -r>
    Risk      <markers present: auth, persistence, concurrency, external side effects, public contract, migrations, >10 files, or none>
    Level     <fast | standard | deep>

    A step that receives the record skips its own discovery. A check result is reused until a file it covers changes; after an edit, only typecheck and the focused tests rerun; the full check runs once before the review and once at the end.

  • Level. fast when the target is one module, under about 40 changed lines, and carries no risk marker. deep when any risk marker is present. standard otherwise. A flag overrides.
Stepfaststandarddeep
1 Interrogateyesyesyes
2 Deslop the hunks (--refactor-only)passes 1 to 7 on the hunksall passesall passes
3 Test audit of the change's testsnoneprobes on touched functions, six at mostmutation tool where installed, twelve probes at most
4 Audit of the diff and its calleesnoneyesyes, entry points and callers two levels out
5 Gatefast commandcheck commandcheck command
6 Reviewinline, after re-reading the diff from the topfresh contextfresh context, second round even without changes
7 Apply and re-gateslop findingsall axes, two rounds at mostall axes, two rounds at most

1. Interrogate

Read ${CLAUDE_SKILL_DIR}/../interrogate/SKILL.md and apply it to the target with the record. Make the cuts, verify with the focused tests. Keep its counts.

2. Deslop

Read ${CLAUDE_SKILL_DIR}/../deslop/SKILL.md and apply it to the target's files with --refactor-only and the record, the hunks the target touches first. Behaviour-preserving throughout.

3. Test audit

Read ${CLAUDE_SKILL_DIR}/../test-audit/SKILL.md and apply it to the tests the target added or changed and to the seams it changed that have no test, with the probe cap for the level.

4. Audit

Read ${CLAUDE_SKILL_DIR}/../audit/SKILL.md and apply it to the target's hunks and the functions they call. A bug in the change is fixed with a test that failed first; a pre-existing bug the change did not introduce is reported with its reproduction, not fixed here.

5. Gate

Run the level's check. Red caused by the target is fixed before the review. Red caused by something outside the target stops the run with needs decision.

6. Review with fresh eyes

Use the Agent tool with the general-purpose agent and this prompt: "Read ${CLAUDE_SKILL_DIR}/../clean-code-review/SKILL.md and apply it with the arguments <base-ref> <spec-path, if any>. Change record: <the record>. Return the review block only." The reviewer sees the diff, the nearby code, the standards, and the record, not this session's reasoning. At fast, or on a host without subagents, review inline after re-reading the diff from the top, hunk by hunk, before writing a finding.

7. Apply

  • Slop: apply all. Design: apply those with a concrete fix that keeps behaviour and stays inside the target's files; the rest are decisions in the report. Correctness: reproduce each (a failing test, a command that shows the wrong outcome); fix what reproduces, drop what does not with a note; restore any weakened check and fix the code instead. Scope: revert changed lines the purpose does not explain; a missing spec requirement is a decision, not something to build here.
  • Verdict rethink: stop, apply nothing further, report needs decision with the reviewer's worst issue.
  • Re-gate. When findings were applied, review once more and apply once more. Two rounds at most; a finding that survives two rounds is reported, not chased.

8. Land

Without --commit: leave the working tree as it is; nothing is staged on the user's behalf. With --commit and verdict ready: stage the target's files and commit with a conventional message from the purpose (feat:, fix:, refactor:), the body naming what was decided and ruled out. Any other verdict commits nothing.

Report

## Finish Report
Purpose     <one sentence> · level <fast | standard | deep> (<why>)
Scope       <working tree | base..HEAD> · <N files>
Interrogate deleted <n> · simplified <n>
Deslop      dead code <n> · comments <n> · abstractions <n> · defensive <n> · duplication <n> · naming <n> · filler <n> · hotspots <n> · design <n> · docs <n>
Tests       deleted <n> · rewritten <n> · added <n> · probes killed <k>/<m>   (or skipped at fast)
Audit       fixed <n> (bugs <n> · weaknesses <n> · security <n>) · reported <n>   (or skipped at fast)
Review      round 1: <n> findings (slop <n> · design <n> · correctness <n> · scope <n>) · round 2: <n | skipped> · verdict <merge | fix then merge | rethink> · <fresh | inline>
Diff        +<added> / -<removed> lines · net <±n>   (was +<a> / -<r> before finishing)
Gates       check <pass|fail|n/a> · typecheck <pass|fail|n/a> · lint <pass|fail|n/a> · tests <passed>/<total>
Complexity  max <n> · over budget <n> · erosion <x%>   (or n/a)
Unverified  <what could not be run, and why, or "nothing">
Verdict     <ready to commit | committed <sha> | needs decision: ...>
Commit      <suggested one-line message>

Numbers from diff-stats.sh and complexity.sh in the clean-code skill folder (${CLAUDE_SKILL_DIR}/../clean-code/scripts/) and from the commands that ran. Below the block: the findings left open, each with file, line, and the reason. Nothing else.

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.