code-simplificationlisted
Install: claude install-skill JBSommeling/claude-config
# Code Simplification
Reduce complexity while preserving exact behavior. The goal is not fewer lines — it's code that is easier to read, understand, modify, and debug.
## Five Principles
1. **Preserve behavior exactly** — same outputs, same errors, same side effects. If unsure, don't change it.
2. **Follow project conventions** — match the codebase style, not your preferences. Inconsistency is not simplification.
3. **Prefer clarity over cleverness** — explicit > compact when compact requires mental parsing.
4. **Maintain balance** — don't over-simplify. Removing a well-named helper makes call sites harder to read.
5. **Scope to what changed** — simplify recently modified code. Avoid drive-by refactors of unrelated code.
## Simplification Patterns
**Structural:**
| Pattern | Simplification |
|---------|----------------|
| Deep nesting (3+ levels) | Guard clauses or extract helper functions |
| Long functions (50+ lines) | Split into focused functions |
| Nested ternaries | Replace with if/else or lookup objects |
| Boolean parameter flags | Options objects or separate functions |
| Repeated conditionals | Extract to named predicate function |
**Naming:**
| Pattern | Simplification |
|---------|----------------|
| Generic names (`data`, `result`, `temp`) | Rename to describe content |
| Comments explaining "what" | Delete — code is clear enough |
| Comments explaining "why" | Keep — they carry intent code can't express |
| Misleading names | Rename to reflect actual be