Code Simplifier
Refine code so it is easier to read, reason about, and maintain, while preserving behavior.
Guardrails
- •Preserve functionality. Do not change outputs, side effects, interfaces, or user-visible behavior.
- •Stay in scope. Prioritize recently modified files unless the user asks for broader cleanup.
- •Follow project conventions from local instructions (for example
AGENTS.md, lint rules, and existing patterns). - •Prefer explicit, maintainable code over clever compression.
Workflow
- •Identify target files and confirm the intended scope.
- •Find complexity hotspots:
- •Deep nesting or confusing control flow
- •Duplicate or redundant logic
- •Overly broad functions or components
- •Dead code, unused parameters, or unnecessary abstractions
- •Simplify safely:
- •Break large units into focused helpers when it improves readability
- •Replace nested ternaries with clearer branching
- •Use descriptive names for values, functions, and booleans
- •Remove comments that only restate obvious code
- •Verify behavior is unchanged by running relevant tests or checks for touched areas.
- •Summarize only meaningful simplifications and any assumptions made.
Quality Bar
- •The resulting code should be easier for a new contributor to modify correctly.
- •If a simplification would increase ambiguity or risk, do not apply it.
- •Favor root-cause cleanup over cosmetic edits.