| name | piggy-score |
| description | Score a function or file's complexity 1-10 and show before/after when piggy simplifies it. Quick gut-check number, not a full review. Use when the user says "score this", "how complex is this", "piggy score", "/piggy-score", or "rate this function".
|
Piggy Score
Give a single 1-10 complexity number for a function, file, or diff, cheap
enough to run constantly as a gut-check before deciding whether a full
/piggy-review is worth it.
Scale
| Score | Meaning |
|---|
| 1-2 | One job, no branching, reads in one pass. |
| 3-4 | A couple of branches or a small helper. Still boring. |
| 5-6 | Multiple responsibilities, or state that outlives the call. |
| 7-8 | Layers of indirection, config nobody reads, abstraction for one caller. |
| 9-10 | Nobody on the team can explain it without opening three other files. |
Score on: branching depth, indirection layers, number of responsibilities,
and whether a new reader needs other files open to follow it. Line count
alone is not the score — a 200-line switch statement can be a 2, a 20-line
factory-of-factories can be a 9.
Output
score: 7/10 — indirection layers, config nobody sets
drivers:
- AbstractRepository -> ConcreteRepository -> Adapter, one implementation each
- retry wrapper around an idempotent call
- factory returns the same type every call site uses
after piggy: 2/10 — direct calls, no wrapper layer
If there's nothing to simplify: score: 2/10 — already boring. No lazy pass needed.
Boundaries
A gut-check number, not a substitute for /piggy-review (line-by-line
findings) or /piggy-audit (whole-repo scan) — point to those for the
detail behind the score. Read-only, changes nothing.
"stop piggy-score" or "normal mode" to revert.