Skills
mk:simplify
Phase 3.5 step that removes dead code and reduces complexity in the current diff without changing behaviour.
| Source | .claude/skills/simplify/SKILL.md |
| Owner | docs |
| Runtime | claude-code |
| Risk | medium |
What it does
mk:simplify runs after the build is green and before verification and review. It shrinks the code in the current diff and must not change behaviour: every simplification has to pass the same tests as before, and one that fails is reverted.
When not to use it
For ad-hoc quality review outside the current diff, use mk:clean-code. Simplify only touches code in the diff.
Usage
/mk:simplify [file_or_directory]What it looks for
| Action | Targets |
|---|---|
| Remove | Dead code, commented-out code, wrappers that add nothing, interfaces with one implementation, null checks a guard already covers |
| Simplify | Nesting three or more levels deep (use guard clauses), functions over 50 lines, logic duplicated in three or more places, complex conditions (name them) |
| Leave alone | Working code that is only written differently from how you would write it, performance-tuned code, anything outside the diff |
Steps
- Scan the changed files for complexity.
- List each change with a before and after.
- Apply them one at a time.
- Run the full test suite after each change, not in a batch.
- Report what was simplified and why.
Gotchas
- Check string references before deleting code that looks dead. It may be used through reflection or a dynamic import.
- Two copies do not justify a shared utility. Wait for three.
- Changing an exported signature is a breaking change, not a simplification.
- Leave test helpers and fixtures alone. They favour readability over DRY.