Code simplification
Skill charlieviettq/awesome-agent-skill/.cursor/skills/core-workflow/code-simplification
Simplify working code while preserving behavior—remove dead paths, flatten nesting, clarify names, reduce duplication. Use after features work but code feels over-engineered. Triggers: "simplify", "clean up", "too complex", "YAGNI", "reduce complexity".From its SKILL.md
npx -y skills add charlieviettq/awesome-agent-skill --skill code-simplificationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 24 stars24 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.0 KB, 381 tokens by cl100k_base, as published. Nobody here has run it
Code Simplification
Behavior-preserving simplification pass on code that already works. Distinct from design-smell-review (structural critique before change) and refactor-legacy-python-pr (scoped legacy cleanup PRs).
When to use
- Feature is done and tested; complexity exceeds need
- Review feedback says "over-engineered"
- Preparing a focused hygiene PR
When not to use
- Bug is still open (fix behavior first)
- Large architectural rewrite (use
incremental-implementation) - No tests and behavior is unclear (add tests or spike first)
Workflow
- Baseline — confirm tests pass or define minimal manual checks
- Inventory — list simplification targets (unused code, deep nesting, duplicate logic, premature abstraction)
- One change at a time — small commits; run tests after each
- Stop — when readability improves without expanding scope
Safe simplifications
- Remove dead code and unused imports
- Inline one-use helpers when they obscure flow
- Replace cleverness with explicit steps
- Consolidate duplicate validation or mapping
- Narrow public API surface if callers allow
Avoid
- Drive-by renames across unrelated files
- Changing behavior "while you're here"
- Removing abstractions that enable testing or extension without evidence
Verification
- Same inputs → same outputs
- No new linter/type errors
- Diff stays reviewable (< ~300 lines unless agreed)
Related skills
design-smell-review— before deciding what to simplifytest-first-development— lock behavior before deleting codeverify-before-done— evidence before claiming complete
Adapted from addyosmani/agent-skills (MIT).
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.