quality-loop
Skill1 starsChanged 3 days agoMITView on GitHub
The measure-and-fix loop for agent-written code, after Robert C. Martin: CRAP scores from crapper, duplicate pairs from dryer and surviving mutants from mutator, fixed worst first until clean or three rounds. Use when the user says "clean up this code", "run the quality loop", "measure the CRAP scores" or "find surviving mutants". Not for writing the tests of a new feature, use `tdd-workflow`.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- wolverin0/claude-skillstheir own version, first seen Nov 15, 2026
- cskwork/quality-loop-skilltheir own version, first seen Nov 8, 2026
- TomSzenessy/AI_TEMPLATEtheir own version, first seen Nov 6, 2026
- crftwr/keyhactheir own version, first seen Oct 25, 2026
- cskwork/skillstheir own version, first seen Oct 17, 2026
- Thingscorp/skillstheir own version, first seen Sep 25, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- wolverin0/claude-skills★ 41same name
- crftwr/keyhac★ 15same name
- sukirman1901/frontend-expert★ 9same name
- CodyAMaughan/agent-first-engineering★ 3same name
- cskwork/skills★ 3same name
- cskwork/quality-loop-skill★ 1same name
- Thingscorp/skills★ 1same name
- gavinzzc/quality-loop★ 0same name
- TomSzenessy/AI_TEMPLATE★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository71 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agentic-engineeringSkill
- ai-regression-testingSkill
- angularSkill
- ansibleSkill
- api-designSkill
- application-security-reviewSkill
- architecture-decision-recordsSkill
- arch-linuxSkill
- ascend-memorySkill
- ascend-web-hunterSkill
- asus-routerSkill
- audio-scribeSkill
- automation-inventorySkill
- backend-patternsSkill
- bashSkill
- build-dependency-managementSkill
- cachyosSkill
- code-formatterSkill
- code-reviewerSkill
- coding-standardsSkill
- dart-flutter-patternsSkill
- database-migrationsSkill
- deployment-patternsSkill
- design-systemSkill
- docker-patternsSkill
- e2e-runbooksSkill
- e2e-testingSkill
- embedded-c-arduinoSkill
- frontend-designSkill
- g-code-3d-printingSkill
- github-opsSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- home-assistantSkill
- homelab-servicesSkill
- java-coding-standardsSkill
- jetbrains-ide-opsSkill
- jira-integrationSkill
- kde-plasmaSkill
- keycloak-patternsSkill
- kicadSkill
- machine-healthSkill
- macosSkill
- markdown-writerSkill
- mongodb-patternsSkill
- nextjs-app-router-patternsSkill
- node-backend-patternsSkill
- observability-and-loggingSkill
- obsidianSkill
- performance-optimizationSkill
- postgres-patternsSkill
- powershellSkill
- project-trackingSkill
- proxmoxSkill
- python-patternsSkill
- pytorch-patternsSkill
- react-patternsSkill
- researchSkill
- The first 60 shown.
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 7 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
- Very specific: line 41
Run the tools only through the wrapper, .metrics/tools/run on Linux and macOS and .metrics\tools\run.cmd on Windows.
- Very specific: line 42
Start with measure, a full run of all three tools, and read the result with summary.
- Very specific: line 43
When .metrics/tools/run is missing, get the tools before anything else, the way the running reference says.
- Very specific: line 48
After each round of fixes, run mutate --changed for the mutants and measure for the full scores, and keep the project's own tests green.
- Distinctive: line 49
Stop when nothing is over the limits, or after three rounds, and report what is left with the reason it is left.
- Very specific: line 50
Commit the fixes and the full-run scores in .metrics/ only when the caller asked for commits, with a JaCoCo block the wrapper added to a …
“Common” is measured: kept by at least 6 in 10 of the 7 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.
Files
Quality Loop
Measure the code, fix the worst mess first, and measure again. The method and the three measuring tools are the work of Robert C. Martin (Uncle Bob): crapper scores every function by complexity and coverage, dryer lists functions with the same shape, and mutator plants small bugs and reports the ones the tests miss. A project carries his tools unchanged under .metrics/tools/, with a wrapper that runs them, and keeps the scores in .metrics/.
| Task | Open |
Running measure, mutate --changed and summary, the exit codes, the first run, getting the tools into a project, Windows, what to commit | references/running-the-tools.md |
Reading .metrics/crap.edn, .metrics/dry.edn and .metrics/mutate/, and the bands that decide what must be fixed | references/reading-the-scores.md |
| Fixing each kind of mess, per-language notes, and the before and after report | references/fixing-the-worst.md |
When to activate
- A feature is done and its code needs measuring before review, or the user says "run the quality loop"
- The user says "clean up this code", "measure the CRAP scores", "find surviving mutants" or "find duplicated code"
- A review cites a high CRAP score, a surviving mutant or a duplicate pair from
.metrics/ - The project is in Clojure, Java with Maven or Gradle, Go, TypeScript or JavaScript, Rust, or Python
When not to activate
- Writing the tests of a new feature first, use
tdd-workflow - Deciding whether two similar blocks are one rule, use
review-duplication - Reviewing a change without changing it, use
code-reviewer, which reads.metrics/but never runs the tools - Kotlin, C#, PHP, Dart or any other language the tools do not read: report it as not measured
- Profiling a slow path, use
performance-optimization
Rules
- Run the tools only through the wrapper,
.metrics/tools/runon Linux and macOS and.metrics\tools\run.cmdon Windows. Never edit anything under.metrics/tools/crapper,dryerormutator, which is Robert C. Martin's code copied unchanged. - Start with
measure, a full run of all three tools, and read the result withsummary. Never run crapper on changed files only: a partial run replaces.metrics/crap.ednwith a subset. - When
.metrics/tools/runis missing, get the tools before anything else, the way the running reference says. Never write a tool of your own in their place. - Fix the worst first: a CRAP score over 30, then every surviving mutant in code the change touched, then the duplicate pairs at or above 0.82.
- Fix a high CRAP score by splitting or simplifying the function, or by adding the test that covers it, whichever the function needs. Never raise coverage with a test that asserts nothing.
- Kill a surviving mutant with a test that fails on the mutated code and passes on the real code. Never weaken, skip or delete a test to make a score look better.
- Merge a duplicate pair only when both copies encode the same rule and change for the same reason.
review-duplicationandcoding-standardsdecide, and a pair that only looks alike stays as it is. - After each round of fixes, run
mutate --changedfor the mutants andmeasurefor the full scores, and keep the project's own tests green. - Stop when nothing is over the limits, or after three rounds, and report what is left with the reason it is left.
- Commit the fixes and the full-run scores in
.metrics/only when the caller asked for commits, with a JaCoCo block the wrapper added to a Gradle build file in its own commit. Otherwise leave them staged for the caller.
Limits
| Score | Limit |
| CRAP | Over 30 must be fixed. A function the change touched aims under 10 |
| Surviving mutants | None in code the change touched |
| Duplicate pairs | Every pair at or above 0.82 is reviewed, not merged blindly |
Related skills
tdd-workflowowns the red-green loop each new test followscoding-standardsowns how a function is split and namedreview-duplicationowns the call on whether a duplicate pair is one rulecode-reviewerreads.metrics/and turns the worst scores into review findings
Checklist
- The wrapper ran
measureandsummary, and no tool ran on its own - Nothing under
.metrics/tools/crapper,dryerormutatorchanged - Every CRAP score over 30 was fixed or reported with its reason
- No surviving mutant is left in code the change touched, or each one left is reported
- Every duplicate pair at or above 0.82 was reviewed, and merged only when both copies are one rule
- No test was weakened, skipped or deleted
- The project's own tests pass after the last round
- The full-run scores in
.metrics/are committed when the caller asked, staged otherwise, and the report shows them before and after
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
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.

