verbose-code-trim
Skill1 starsChanged 12 days agoMITView on GitHub
Cut verbosity without losing behavior — same, shorter.
In this repository10 other files it gives its agents.
- agent-regressionSkill
- dead-code-sweepSkill
- dedup-sweepSkill
- hermes-cron-stuck-job-recoverySkill
- live-probeSkill
- measure-firstSkill
- probe-firstSkill
- prose-hygieneSkill
- repo-organizeSkill
- verification-gatesSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Before reviews: reviewers spend budget on verbosity instead of substance
- Very specific: line 30
Don't use for: hot paths without a measurement (see measure-first — "shorter is faster" is a claim), public API signatures, …
- Distinctive: line 55
Trim one target at a time: After each: the same tests, the same lint.
- Distinctive: line 56
If a trim needs a behavioral argument ("this can't raise because..."), write that proof as a comment or a test — the proof is the trim's …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Verbose Code Trim
Cut bloat: verbose constructs, redundant ceremony, over-guarded logic, boilerplate a language idiom already covers. Every trim must preserve behavior exactly — the contract is "shorter says the same," verified by tests and by diff-reading. This is not about cleverness; compressed code must stay the MOST readable option, not the least.
When to Use
- Agent-generated batches: models pad code with ceremony (over-explicit checks, re-stated invariants, wrapper noise)
- Before reviews: reviewers spend budget on verbosity instead of substance
- Post-migration: old-style idioms a newer language version makes redundant
- "This function is 60 lines and I can't find the logic"
Don't use for: hot paths without a measurement (see measure-first —
"shorter is faster" is a claim), public API signatures, security-critical
validation (explicit > terse, always), or code that's long because the
domain is long.
The Trim Targets
| Target | Verbose form | Trimmed form |
| Manual loops | 5-line accumulate loop | comprehension / sum / itertools |
| Re-stated invariants | re-checking a precondition already guaranteed upstream | trust the contract, delete the re-check (prove it) |
| Over-exception | try/except around code that can't raise | delete the wrapper (prove it can't) |
| Boolean ceremony | if x: return True else: return False | return x |
| Chain-of-elif | elif ladder mapping values | dict dispatch / match |
| Wrapper passthrough | function that forwards args unchanged | call directly (see dead-code-sweep) |
| Overbuilt classes | class with state used once | function |
| Comment-code echo | comment restating the next line | delete the comment (prose-hygiene) |
| Defensive defaults | default parameter never exercised | delete or assert |
Procedure
- Pick a unit (function or module) and establish the green baseline: tests passing on it, lint clean.
- Mark the logic lines — the lines that DO the thing. Everything else is candidate ceremony.
- Trim one target at a time. After each: the same tests, the same lint. If a trim needs a behavioral argument ("this can't raise because..."), write that proof as a comment or a test — the proof is the trim's license.
- Re-read the result. The trimmed code must be MORE readable, not denser. If you have to unpack it mentally, un-trim — the target was wrong, not the code.
- Diff-verify: the final diff shows no logic-line changes — only
ceremony removal. (
git diffshould read like subtraction.)
Completion criterion: tests green before/after; lint clean; the diff is pure subtraction or idiom replacement; a cold reader picks the trimmed version.
Pitfalls
- Cleverness creep: comprehensions nested 3 deep "save lines" by spending readability. Rule: if the trim needs a comment to explain, it isn't a trim.
- Silent behavior change: deleting "redundant" checks that weren't (order-of-evaluation, side effects in the removed expression). The baseline gate catches these — never skip it for "obviously safe" trims.
- Trimming the explanation with the bloat: a long function may be long
because it carries WHY-comments. Those move to
prose-hygienefor tightening, not deletion. - Public contracts: signatures, exception surface, and return types are behavior. Trims that change call sites aren't trims — they're refactors.
Verification
Runnable check: the unit's tests before and after, plus a line-count delta:
bash <repo>/scripts/run_tests.sh <unit-tests> -- -q # green, both sides
git diff --stat # net subtractionExpected: identical pass set both sides; net negative diff (or neutral where a comment moved); no logic-line additions in the diff.
Evidence to capture: both test outputs, the diff, and the line-count delta (before → 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.

