Agent skill
simplify
Refactor code to be simpler while maintaining identical functionality
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/simplify
SKILL.md
Simplify
Refactor the given code to make it simpler, clearer, and more maintainable without changing what it does.
Objective
Simplify and clean the code. Implementation should be straightforward and pragmatic. The goal is to get the most minimal code possible.
Principles
- Behavior parity: Keep interfaces and semantics identical. No new features. Preserve flags, return codes, and observable side effects.
- KISS: Prefer boring, obvious solutions over cleverness. Fewer moving parts > fewer lines.
- Small pieces: Favor small, composable functions. Design for easy deletion and iteration.
- Prune aggressively: Remove dead code, unused vars, redundant branches, defensive over-engineering, and needless indirection.
- Flatten flow: Simplify complex conditionals and deep nesting; use clear guards and early returns.
- Standard library first: Replace custom utilities with modern built-ins/framework primitives.
- Fail early and often: Don't use blanket try/catch. Skip validations.
- Communicate with types: Use types to express contracts and invariants. Avoid type acrobatics and generic abstractions.
- Abstractions when earned: Introduce/keep them only if they reduce duplication or isolate likely change.
- Minimal deps: Don't add dependencies unless they materially simplify and are commonly available for the target runtime.
- No micro-optimizations unless they remove complexity or are explicitly required.
- Make rules explicit: Turn hidden assumptions into defaults, parameters, or assertions.
- Naming for intent: Prefer clear, intention‑revealing names; one responsibility per function/module.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?