simplify
Installation
SKILL.md
simplify — Code Clarity & Refactoring Engine
Refactor complex, bloated, or deeply nested code into clean, readable, and idiomatic implementations while preserving exact functional behavior.
Operating Invariants
- Behavioral Invariance: Preserve 100% of existing functionality, test outcomes, error handling, and public API signatures; forbid altering program semantics or breaking contracts.
- Scope Discipline: Confine refactoring strictly to targeted files or functions; forbid unsolicited churn in untouched surrounding code.
- Pre-Mutation Gate: Stage changes exclusively via Changeset summary and halt turn immediately; forbid writing mutations to disk without affirmative human authorization.
- Verification Circuit Breaker: Stop execution immediately upon verification failure, report stderr with file citations, and prompt user whether to revert or keep debugging; forbid silent lossy reversions or unguided retry loops.
Refactoring Rubric
Evaluate target code against 8 mutually exclusive structural dimensions:
- Control Flow (Block Hierarchy)
- Smell: Nesting ≥ 3 levels deep, arrow anti-pattern, trailing else blocks.
- Remedy: Invert conditions into guard clauses and early returns.
- Guardrail: Preserve simple 1-level conditionals and natural linear flow.