simplify-code-safely
Skill0 starsChanged 4 months agoMITView on GitHub
Simplifies existing code while preserving externally observable behavior, public contracts, and required performance. Use when reducing accidental complexity, removing dead or duplicated logic, clarifying control flow, shrinking an over-engineered change, or performing a focused behavior-preserving refactor; do not use for feature development, architecture replacement, or read-only code review.
In this repository72 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agents-md-initSkill
- analytical-frameworksSkill
- appkit-accessibility-auditorSkill
- assess-security-controlsSkill
- audit-accessibilitySkill
- automated-security-reviewSkill
- changelogSkill
- check-ai-onboard-updatesSkill
- agents-sdkSkill
- cloudflare-email-serviceSkill
- cloudflare-oneSkill
- durable-objectsSkill
- sandbox-sdkSkill
- turnstile-spinSkill
- workers-best-practicesSkill
- wranglerSkill
- cobra-commandSkill
- competitive-intelSkill
- component-scaffoldSkill
- conduct-open-source-investigationSkill
- conduct-user-researchSkill
- conventional-commitSkill
- coordinate-data-viewsSkill
- core-data-expertSkill
- data-storytellingSkill
- datavizSkill
- debug-systematicallySkill
- define-brand-foundationSkill
- dependency-vuln-scanSkill
- design-and-build-websiteSkill
- design-product-contentSkill
- design-product-interfaceSkill
- develop-apple-platform-appSkill
- develop-test-firstSkill
- evolve-design-systemSkill
- gh-issueSkill
- gh-prSkill
- gh-releaseSkill
- identity-managementSkill
- input-sanitizationSkill
- manage-vulnerability-riskSkill
- map-attack-surfaceSkill
- market-researchSkill
- measure-product-experimentsSkill
- obsidianSkill
- pr-descriptionSkill
- preserve-web-evidenceSkill
- prisma-migrateSkill
- retrieve-technical-docsSkill
- secret-managementSkill
- secret-scanSkill
- secure-codingSkill
- security-auditSkill
- shape-product-opportunitySkill
- swift-api-design-guidelinesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Read the project instructions, callers, tests, public interfaces, error behavior, side effects, data formats, performance constraints, and …
- Distinctive: line 27
Do not collapse distinct domain concepts merely because their current implementations look similar.
- Distinctive: line 33
Prefer deletion, direct control flow, precise names, and existing language features.
- Distinctive: line 36
Run the narrow checks after each risky transformation.
- Distinctive: line 39
Avoid speculative frameworks, generic helpers without a stable concept, broad formatting changes, and dependency upgrades unrelated to the …
- Distinctive: line 44
Run focused tests and the relevant broader suite.
- Distinctive: line 48
Use a separate reviewer agent when independent code review is requested.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Simplify code safely
Make the code easier to understand without quietly changing what it does.
Establish the behavior boundary
Read the project instructions, callers, tests, public interfaces, error behavior, side effects, data formats, performance constraints, and compatibility requirements. State the simplification target and what must not change. If behavior is unclear, characterize it with focused tests before refactoring.
Find accidental complexity
Look for:
- dead code, unreachable branches, stale flags, and unused indirection;
- duplicated rules that represent the same concept;
- conditionals that can become early exits or explicit state transitions;
- abstractions with one caller and no meaningful policy boundary;
- misleading names, hidden side effects, and values recomputed across layers;
- comments that compensate for unclear structure rather than explain intent.
Do not collapse distinct domain concepts merely because their current implementations look similar.
Simplify in small steps
- Record a passing baseline for the relevant checks.
- Make one coherent transformation at a time.
- Prefer deletion, direct control flow, precise names, and existing language features.
- Preserve public APIs, error semantics, ordering, concurrency, persistence, and security checks unless the user explicitly includes them in scope.
- Run the narrow checks after each risky transformation.
- Review the final diff for accidental behavior changes and unnecessary churn.
Avoid speculative frameworks, generic helpers without a stable concept, broad formatting changes, and dependency upgrades unrelated to the simplification.
Prove the result
Run focused tests and the relevant broader suite. Compare before/after behavior, and measure performance only when performance is part of the contract. Report what became simpler—deleted branches, reduced state, removed duplication, or clearer ownership—without using line count as the only quality measure.
Use a separate reviewer agent when independent code review is requested. This skill edits code; the reviewer remains read-only.
Finish when the behavior boundary still holds, the diff is smaller or conceptually clearer, and every claimed improvement is visible in the code rather than asserted from taste.
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.

