code-simplification
Skill72 starsChanged 7 months agoMITView on GitHub
code-simplification reduces code complexity while preserving exact behavior. It is not a feature workflow, not a bug fix workflow, and not permission for drive-by refactors. The goal is code that is easier to read, review, test, and maintain with the smallest safe diff. Prefer simplifications that deepen modules instead of flattening behavior across callers. A small interface hiding real complexity is valuable; a wrapper that only moves complexity around is not. Use this workflow when: - The implementation is working…
46 other projects use a version of this.
Adopted by
Most recently taken up by
- GuillemRoca/agent-skills-androidtheir own version, first seen Oct 3, 2026
- addyosmani/agent-skillstheir own version, first seen Oct 3, 2026
- weisser-dev/agentic-skillstheir own version, first seen Oct 3, 2026
- JPeetz/agent-skillstheir own version, first seen Sep 29, 2026
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
Used with
Projects with it also use constraint-driven-development, observability-and-instrumentation and 8 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.
vinvcnSkillconstraint-driven-development
把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。
Also in 4 projects that use this
borhen68Skillobservability-and-instrumentation
Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.
Also in 13 projects that use this
mycelium-hqSkilldoubt-driven-development
Use when correctness matters more than speed: about to commit non-trivial code, make an architectural call under uncertainty, work in unfamiliar code, or assert what the compiler cannot check (''this is safe'', ''thread-safe'', ''this scales'', ''matches the spec''). Strongest on high-stakes surfaces (production deploys, security-sensitive logic, data migrations, irreversible operations) and when the user asks to sanity-check, red-team, double-check, or get a second opinion on a decision.
Also in 19 projects that use this
luischanciSkillinterview-me
Interactive interview to formalize a research idea into a structured specification with hypotheses and empirical strategy.
Also in 16 projects that use this
Jonathan0823Skillminimalist-ui
Clean editorial-style interfaces. Warm monochrome palette, typographic contrast, flat bento grids, muted pastels. No gradients, no heavy shadows.
Also in 4 projects that use this
OpenAISkillimage-to-code
Implement a selected image, screenshot, mockup, or Image Gen reference as a faithful, responsive frontend.
Also in 3 projects that use this
Other versions46 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 46
- addyosmani/agent-skills★ 101ksame name
- shashankswe2020-ux/whoop-mcp★ 165same name
- HybridAIOne/hybridclaw★ 157same name
- muratgur/ordinus★ 109same name
- thiientv/godmode★ 96same name
- lgbarn/shipyard★ 66same name
- c-kick/hnl-agent-skills★ 51same name
- az9713/addyosmani-agent-skills★ 38same name
- vinvcn/addyosmani-agent-skills-zh★ 38same name
- jmxt3/gitscape.ai★ 32same name
36 more not listed
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 repository117 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-healthSkill
- agent-styleSkill
- angular-best-practicesSkill
- annotateSkill
- api-designSkill
- architecture-decision-recordsSkill
- aws-serverlessSkill
- backend-architectSkill
- backend-patternsSkill
- brainstormSkill
- bug-reportSkill
- changelogSkill
- claude-apiSkill
- cloud-architectSkill
- cloud-run-puppeteerSkill
- code-review-checklistSkill
- code-reviewSkill
- codex-sddSkill
- commitSkill
- context-engineeringSkill
- database-architectSkill
- db-reviewSkill
- deep-interviewSkill
- design-reviewSkill
- design-systemSkill
- devops-deploySkill
- diagnoseSkill
- django-patternsSkill
- docker-patternsSkill
- dotnet-backend-patternsSkill
- dreamSkill
- drizzle-orm-expertSkill
- estimateSkill
- event-sourcing-architectSkill
- fastapi-proSkill
- fork-joinSkill
- freezeSkill
- frontend-designSkill
- frontend-patternsSkill
- frontend-ui-dark-tsSkill
- gate-checkSkill
- gemini-api-integrationSkill
- gitlab-ci-patternsSkill
- guardSkill
- handoffSkill
- hotfixSkill
- hybrid-cloud-architectSkill
- kubernetes-architectSkill
- laravel-patternsSkill
- launch-checklistSkill
- learnerSkill
- llm-app-patternsSkill
- localizeSkill
- map-systemsSkill
- map-workflowSkill
- markdown-injection-scannerSkill
- microservices-patternsSkill
- milestone-reviewSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 18 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 45 edited versions we read keep these.
18
Distinctive
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
- Distinctive: line 31
Prefer simplifications that deepen modules instead of flattening behavior across callers.
- Distinctive: line 37
Use this workflow when:
- Distinctive: line 47
Do not use this workflow when:
- Very specific: line 78
If a simplification requires changing externally visible behavior, API shape, data model, error behavior, timing, permissions, or user …
- Distinctive: line 84
Before editing, all must be true:
- Distinctive: line 108
Read the smallest necessary context and answer:
- Distinctive: line 116
If you cannot answer, do not simplify yet.
- Distinctive: line 120
Only act on specific signals:
- Distinctive: line 134
Use the deletion test on wrappers, helpers, and extracted modules:
- Distinctive: line 136
If deleting the abstraction would force several callers to re-learn hard behavior, it is probably earning its keep.
- Distinctive: line 138
If deleting it mostly removes indirection and does not spread meaningful complexity, it is probably shallow.
- Distinctive: line 141
Prefer deeper modules with clearer seams over helper sprawl.
- Distinctive: line 143
Keep comments that explain why, tradeoffs, gotchas, or external constraints.
- Distinctive: line 150
Run the relevant verification if cheap and available.
- Distinctive: line 151
If verification fails, revert or diagnose before continuing.
- Distinctive: line 152
Stop when further cleanup would broaden scope.
- Distinctive: line 154
Do not batch unrelated simplifications.
- Distinctive: line 159
Use the strongest available proof:
- Very specific: line 167
Before claiming completion, use verification-before-completion.
- Distinctive: line 196
Stop and ask or reroute when:
“Common” is measured: kept by at least 6 in 10 of the 45 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
Code Simplification
Purpose
code-simplification reduces code complexity while preserving exact behavior.
It is not a feature workflow, not a bug fix workflow, and not permission for
drive-by refactors.
The goal is code that is easier to read, review, test, and maintain with the smallest safe diff.
Same behavior.
Less cognitive load.
Fresh verification evidence.Prefer simplifications that deepen modules instead of flattening behavior across callers. A small interface hiding real complexity is valuable; a wrapper that only moves complexity around is not.
When to Use
Use this workflow when:
- The implementation is working and relevant tests pass.
- Code review flags readability, complexity, naming, duplication, or avoidable abstraction.
- The user asks to simplify, clean up, reduce complexity, or refactor without changing behavior.
- A recently changed area has nested logic, long functions, unclear names, or repeated conditionals that make future changes risky.
Do not use this workflow when:
- Behavior must change. Use
spec-driven-development,test-driven-development, orspec-evolution. - The code is not understood well enough to preserve behavior.
- There is no verification path.
- The cleanup would touch unrelated files.
- The work is a hotfix where cleanup is not required for the fix.
Position in SDD
Preferred placement:
test-driven-development -> code-simplification -> verification-before-completionReview feedback placement:
code-review -> receiving-code-review -> code-simplification
-> verification-before-completionTechnical-debt placement:
tech-debt identifies issue -> user approves focused cleanup
-> code-simplificationIf a simplification requires changing externally visible behavior, API shape,
data model, error behavior, timing, permissions, or user flow, stop and route to
spec-evolution.
Preconditions
Before editing, all must be true:
- Target scope is explicit: file(s), function(s), or review finding.
- Intended behavior is known.
- Relevant tests, build, lint, typecheck, or manual verification are known.
- The current worktree state has been checked.
- The simplification is within the approved scope.
State the gate before edits:
Pre-code gate: Fast satisfied for behavior-preserving simplification of <scope>; verification: <command/check>.For cleanup attached to an approved task:
Pre-code gate: Plan satisfied by approved Task N; simplification scope: <scope>; verification: <command/check>.Workflow
1. Understand Before Touching
Read the smallest necessary context and answer:
- What does this code do?
- Who calls it, and what does it call?
- What inputs, outputs, errors, side effects, and ordering matter?
- Which tests or checks prove behavior?
- Does git history or nearby code explain why it exists?
If you cannot answer, do not simplify yet. Gather context or ask.
2. Identify Concrete Simplification Targets
Only act on specific signals:
| Signal | Typical simplification |
| Deep nesting | Guard clauses or named predicates |
| Long function with mixed responsibilities | Extract focused helper(s) |
| Nested ternaries | Readable conditional or lookup |
| Boolean flag parameters | Options object or separate functions when warranted |
| Repeated conditionals | Named predicate |
| Generic names | Names that describe domain meaning |
| Duplicate logic | Shared helper, if it reduces real duplication |
| Unused wrapper | Inline only if the wrapper has no semantic value |
| Comments explaining obvious "what" | Remove or replace with clearer code |
Use the deletion test on wrappers, helpers, and extracted modules:
- If deleting the abstraction would force several callers to re-learn hard behavior, it is probably earning its keep.
- If deleting it mostly removes indirection and does not spread meaningful complexity, it is probably shallow.
Prefer deeper modules with clearer seams over helper sprawl.
Keep comments that explain why, tradeoffs, gotchas, or external constraints.
3. Apply One Safe Change at a Time
For each simplification:
- Make the smallest behavior-preserving edit.
- Run the relevant verification if cheap and available.
- If verification fails, revert or diagnose before continuing.
- Stop when further cleanup would broaden scope.
Do not batch unrelated simplifications. Do not modernize adjacent code just because it is nearby.
4. Verify Behavior Preservation
Use the strongest available proof:
- Unit/regression tests for pure logic.
- Integration tests for boundaries.
- Typecheck/build/lint for structural cleanup.
- Manual or visual check for UI-only simplification.
- Diff review when no automated command exists, with limits stated plainly.
Before claiming completion, use verification-before-completion.
Output Format
## Code Simplification: [Scope]
**Target:** [files/functions/review finding]
**Behavior contract:** [what must remain unchanged]
**Changes made:** [short list]
**Verification:** [commands/checks and key result]
**Verdict:** VERIFIED | PARTIAL | NOT VERIFIED | FAILED
**Limits:** [anything not checked]Anti-Rationalizations
| Thought | Required correction |
| "Shorter means simpler." | Simpler means easier to understand while preserving behavior. |
| "This nearby cleanup is harmless." | If it is outside scope, note it instead of editing it. |
| "The tests should still pass." | Run the check or state it was not verified. |
| "This abstraction might be useful later." | Keep only abstractions earning their complexity now. |
| "Every extraction is a simplification." | Extraction only helps when it increases leverage or locality instead of creating a shallow wrapper. |
| "I can simplify while adding the feature." | Separate behavior changes from cleanup unless the plan explicitly couples them. |
| "This changes behavior only slightly." | That is not simplification. Route to spec-evolution or TDD. |
Stop Conditions
Stop and ask or reroute when:
- You discover the code has intentional complexity you do not understand.
- Simplification would alter behavior or public contracts.
- Tests are missing and the code is high risk.
- Cleanup would touch unrelated files.
- The diff is becoming too large to review safely.
Integration
using-sddroutes cleanup/refactor-without-behavior-change here.code-reviewmay recommend this for readability and complexity findings.receiving-code-reviewclassifies review feedback before this workflow fixes it.tech-debttracks broad debt; this workflow performs one focused cleanup.verification-before-completionis required before claiming the cleanup is complete.
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.

