code-simplifier
Skill0 starsChanged 6 days agoMITView on GitHub
Autonomous post-implementation code refinement, AST-aware structural refactoring, and 80/20 code-smell cleanup without altering behavior. Triggered automatically after feature/refactor implementation or when simplifying, cleaning up, or refactoring code.
61 other projects use a version of this.
Adopted by
Most recently taken up by
- gromov0737/skillstheir own version, first seen Nov 29, 2026
- yeisonrestrepo/code-conductortheir own version, first seen Nov 26, 2026
- DulajDil/claude-skills-managertheir own version, first seen Nov 22, 2026
- kopp0510/claude-ddtheir own version, first seen Nov 17, 2026
- axot/agent-skillstheir own version, first seen Nov 16, 2026
- aktsmm/Agent-Skillstheir own version, first seen Nov 10, 2026
Used with
Projects with it also use tdd-rust, comment-analyzer and 10 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.
FlorianBruniauxSkilltdd-rust
Also in 3 projects that use this
PaulKinlanSkillcomment-analyzer
Analyzes code comments for accuracy, completeness, and long-term maintainability. Identifies misleading comments, comment rot, and documentation gaps.
Also in 4 projects that use this
PaulKinlanSkilltype-design-analyzer
Analyzes type design quality focusing on encapsulation, invariant expression, usefulness, and enforcement. Provides quantitative ratings (1-10) for each dimension.
Also in 3 projects that use this
ufodev-ioSkillsecurity-guardian
Comprehensive security layer for all interactions with Claude: audits code, dependencies, commands, configs, and AI-generated output for vulnerabilities. Protects against prompt injection, data leaks, unsafe advice, and social engineering. Works in Cursor, Claude Code, claude.ai, and API contexts. Use always as a background security protocol in any Claude-powered environment.
Also in 3 projects that use this
SentrySkillfind-bugs
Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.
Also in 3 projects that use this
GitHubSkillpr-triage
Triage open pull requests in github/explore, producing a status table with CI results and merge recommendations. Use when asked to review, triage, or summarize open PRs in this repository.
Also in 3 projects that use this
- +1 more from PaulKinlan
Other versions61 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 61
- rtk-ai/rtk★ 88ksame name
- elie222/inbox-zero★ 13ksame name
- getsentry/skills★ 1.2ksame name
- Azure/azqr★ 804same name
- DoubleML/doubleml-for-py★ 799same name
- deadlock-mod-manager/deadlock-mod-manager★ 617same name
- microsoft/ghqr★ 532same name
- feiskyer/codex-settings★ 248same name
- wesm/middleman★ 199same name
- OpenHands/extensions★ 167same name
51 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 repository60 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/agent-browser/AGENTS.mdAGENTS.md
- skills/reverse-skill/AGENTS.mdAGENTS.md
- spec-kit/AGENTS.mdAGENTS.md
- skills/reverse-skill/CLAUDE.mdCLAUDE.md
- skills/taste-skill/skills/llms.txtllms.txt
- multimodal-media-directorSkill
- novel-story-architectSkill
- screenplay-manga-directorSkill
- ui-ux-pro-maxSkill
- appsec-reviewSkill
- ask-mattSkill
- codebase-designSkill
- code-reviewSkill
- decompile-reconstructionSkill
- diagnosing-bugsSkill
- diagram-flowchart-architectSkill
- domain-modelingSkill
- gh-pr-ci-triageSkill
- grill-with-docsSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- prototypeSkill
- prSkill
- researchSkill
- resolving-merge-conflictsSkill
- retroSkill
- setup-matt-pocock-skillsSkill
- skill-evaluatorSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wayfinderSkill
- wizardSkill
- chrome-extensionsSkill
- modern-web-guidanceSkill
- web-data-visualizationSkill
- web-game-studioSkill
- nano-banana-proSkill
- ponytail-auditSkill
- ponytail-debtSkill
- ponytail-gainSkill
- ponytail-helpSkill
- ponytail-reviewSkill
- ponytailSkill
- grillingSkill
- grill-meSkill
- handoffSkill
- office-pro-suiteSkill
- product-requirements-grillingSkill
- role-persona-routerSkill
- teachSkill
- to-questionnaireSkill
- wait-whatSkill
- writing-for-agentsSkill
- writing-great-skillsSkill
- reverse-skills-routerSkill
- self-improving-agentSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 5 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 57 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Do NOT wait for the user to type /code-simplifier or name this skill.
- Distinctive: line 24
Never simplify or refactor against a broken baseline.
- Distinctive: line 25
Verify that the relevant test, typecheck, or build command passes before structural refinement begins.
- Very specific: line 26
Read CONTEXT.md (if present), CODE_MAP.md, and local conventions so naming and module boundaries match the repository's established …
- Distinctive: line 43
When applying the refinements identified in Phase 2:
- Very specific: line 46
Check whether ast-grep (sg) is available on the host (Get-Command sg -ErrorAction SilentlyContinue or ast-grep).
- Very specific: line 47
When sg is available and a structural pattern is being rewritten across multiple locations, use sg run --pattern '<pattern>' --rewrite …
- Very specific: line 49
When ast-grep is unavailable or the refinement is local to 1–2 hunks, apply bounded file edits one cohesive transformation at a time.
- Very specific: line 50
Preserve Documentation & Shortcut Ledger Integrity: Never delete unrelated comments, docstrings, shortcut: <limit>, <when to upgrade> (or …
- Distinctive: line 51
Balance Clarity over Brevity: Do not compress readable 4-line logic into an unreadable 1-line clever expression.
- Distinctive: line 56
If any test or check breaks, revert the offending simplification hunk immediately rather than piling on workarounds.
- Very specific: line 57
Update CODE_MAP.md if any public symbol, signature, or key flow path changed during the refactor.
“Common” is measured: kept by at least 6 in 10 of the 57 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 Simplifier & AST-Aware Refactoring (code-simplifier)
This skill refines and simplifies newly written or modified code for clarity, consistency, and maintainability without changing external behavior. It synthesizes patterns from Anthropic's official code-simplifier (anthropics/claude-plugins-official), ast-grep structural refactoring (ast-grep/ast-grep), obra/superpowers v7.0.2 Red-Green-Refactor & verification-before-completion discipline, and DietrichGebert/ponytail (pre-implementation YAGNI subtraction & shortcut: debt ledger), complementing improve-codebase-architecture (macro module deepening).
Automatic Trigger Contract (Encounter -> Auto-Use)
Do NOT wait for the user to type /code-simplifier or name this skill. Activate this workflow automatically whenever:
- Post-Implementation Polish: You have just implemented a
feature,major_feature, orrefactorand the initial behavior/tests pass, before claiming final completion or enteringcode-review. - Refactoring / Cleanup Request: The user asks to improve, clean up, polish, deduplicate, simplify, or refactor existing code.
- Multi-Site Structural Change: A rename, API migration, or pattern rewrite spans
>= 3call sites or multiple files.
The 4-Phase Refinement Loop
Phase 1: Green Baseline Lock (Pre-Condition)
- Never simplify or refactor against a broken baseline.
- Verify that the relevant test, typecheck, or build command passes before structural refinement begins.
- Read
CONTEXT.md(if present),CODE_MAP.md, and local conventions so naming and module boundaries match the repository's established standards.
Phase 2: 80/20 Smell & AI-Slop Triage
Scan only the recently modified hunks or explicitly targeted files (never perform unrequested repo-wide formatting churn). Rank and target the highest-leverage improvements:
| Smell / Slop Category | What to Spot | Required Refinement |
| 1. Deep Nesting & Arrow Code | if/else/try blocks nested > 3 levels deep | Invert conditions and use early returns / guard clauses to flatten control flow. |
| 2. Dense / Nested Ternaries | Nested ternary expressions (a ? (b ? c : d) : e) or long inline boolean chains | Replace with clear if/else statements, switch/match blocks, or named lookup maps. |
| 3. Redundant AI Defensive Slop | Speculative try/catch that swallows errors, duplicate null checks already guaranteed by caller types, single-use wrapper functions, or pass-through middlemen | Delete redundant wrappers; keep validation strictly at real trust boundaries (per ponytail Rung 1 & 7). |
| 4. Duplicated Logic Shapes | Identical 5+ line transformation or validation blocks repeated across functions in the diff | Extract a single shared helper in the existing module (reuse before inventing new files). |
| 5. Mysterious or Drifting Names | Generic identifiers (data, res, temp, handleThing, processData2) or terms that drift from CONTEXT.md | Rename to explicit domain terms that state what the value holds or what the function returns. |
| 6. Data Clumps & Long Parameter Lists | The same 3+ parameters passed together across multiple functions | Group into an existing domain struct/type or options object when it clarifies the seam. |
Phase 3: AST-First Structural Execution
When applying the refinements identified in Phase 2:
- Prefer AST-Aware Rewrites for Multi-Site Patterns (
>= 3sites):- Check whether
ast-grep(sg) is available on the host (Get-Command sg -ErrorAction SilentlyContinueorast-grep). - When
sgis available and a structural pattern is being rewritten across multiple locations, usesg run --pattern '<pattern>' --rewrite '<rewrite>'(with metavariables like$FUNC,$$$ARGS) instead of fragile regex or repetitive manual edits.
- Check whether
- Atomic Bounded Edits:
- When
ast-grepis unavailable or the refinement is local to 1–2 hunks, apply bounded file edits one cohesive transformation at a time. - Preserve Documentation & Shortcut Ledger Integrity: Never delete unrelated comments, docstrings,
shortcut: <limit>, <when to upgrade>(or legacyponytail:) debt markers, or mandatory logic-gate headers. - Balance Clarity over Brevity: Do not compress readable 4-line logic into an unreadable 1-line clever expression; explicit and boring beats dense and clever.
- When
Phase 4: Zero-Behavior-Change Verification & Closure
- Re-run the exact test, build, or runtime verification command from Phase 1 immediately after refinement (
superpowersverification-before-completion: inspect fresh command output in the current turn before claiming success). - If any test or check breaks, revert the offending simplification hunk immediately rather than piling on workarounds.
- Update
CODE_MAP.mdif any public symbol, signature, or key flow path changed during the refactor. - Record closure evidence (
refinement_or_smell_checkandbehavior_preserved_verification).
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.

