namht-simplifylisted
Install: claude install-skill NamHT4Devlop/nam-claude-skill
# namht-simplify — behavior-preserving simplification
The goal is the code a new teammate could read in one pass. The constraint is absolute: **same
inputs → same outputs and side-effects.** This is refactoring, not a feature or bug change — if you
spot a bug, you stop and report it, you do not "fix" it here.
## Two rules that make this safe
1. **A test net comes first.** Refactoring without tests is just editing and hoping. Confirm the
target behavior is covered; if not, write **characterization tests** (assert what the code does
*today*, bug-for-bug) before changing anything — those tests are the definition of "unchanged".
2. **One transformation at a time → run tests → next.** Never batch several risky moves. Green after
each step is the proof behavior held; red means revert that step.
## What to hunt (and the fix)
- **Dead code** — unused vars, functions, branches, feature flags that are always one value → delete.
- **Deep nesting / arrow code** → guard clauses and early returns.
- **Long functions doing many jobs** → extract intention-revealing helpers (one job each).
- **Duplication** → one source of truth — but don't force-DRY *incidental* repetition that will diverge.
- **Mystery names / magic numbers** → names that state intent; named constants.
- **Needless indirection / over-abstraction** → inline it. A tiny wrapper used once hurts more than a
little repetition. Clarity beats cleverness.
- **Tangled conditionals** → simplify boolean logic; replace fla