repo-hygienelisted
Install: claude install-skill arndvs/ctrlshft
# Repo Hygiene
Turn a spaghetti codebase into a component-based, well-structured one, one mergeable issue at a time. This is the generalized successor to the Astro-only refactor pilot — it detects the stack and applies the matching audit and phase model.
This skill runs in two modes:
- **Audit mode** — measure the repo, report where it stands, propose the next task. Human reads it.
- **Issue mode** — same analysis, but the output is exactly one GitHub issue, written for a *different* agent to execute later with no access to your reasoning. This is the mode the nightly cron uses.
The output is always **one** task. Not a roadmap, not a batch. The whole design assumes a nightly cadence, so shipping one small correct thing beats proposing five.
## Core principle: the code is the state, the ledger is the memory
Never trust `.refactor/state.json` about what the codebase looks like. It drifts the moment someone merges a hand-written PR. Instead:
- **Ground truth about the code** comes from running `scripts/audit.mjs`, every single run, before deciding anything.
- **The ledger** (`.refactor/state.json`) is only for things the code can't tell you: which tasks were rejected and why, which approaches were tried and reverted, which files are off-limits, the current phase.
When the audit and the ledger disagree about progress, the audit wins and you update the ledger to match. Say so in your output — silent reconciliation hides the fact that someone did work outside the loop.
##