rcode-trimlisted
Install: claude install-skill hanzlahabib/rcode
@.rcode/references/karpathy-guidelines.md
## Overview
Reduces a file's surface area without changing behaviour. The skill is conservative: every removed line must be either dead, redundant, or replaceable by a tighter form that reads the same to a downstream user. No "while I'm here" rewrites — that's `rcode-incremental`'s job paired with a real task.
## Workflow
1. **Read the file with tests as ground truth.** If there are no tests, run `rcode-prove-it` first to capture current behaviour. Trimming without a safety net is a refactor in disguise.
2. **Identify removable categories** in priority order:
1. **Dead code** — unreachable branches, unused exports, commented-out blocks. Verify with grep that no other file references them.
2. **Duplicate code** — same logic in two places. Extract carefully.
3. **Premature abstractions** — wrappers that add a layer for one caller. Inline.
4. **Dead arguments** — parameters that are always passed the default. Remove.
5. **Verbose conditionals** — collapse to early returns or guard clauses.
6. **Comments that restate the code** — delete.
3. **Apply one category per commit.** Run tests after each. If anything goes red, the change wasn't actually safe — revert.
4. **Stop trimming when** the file reads top-to-bottom with no "wait, why is that here?" moments. There's a floor of natural complexity; below it, you're losing intent.
## Don't touch
- Comments that explain WHY (constraints, invariants, surprising behaviour)