autopilot
The whole coding loop on one deliberate yes: map, spec, critic-hardened plan, GitHub issues, parallel worktree implementers, fresh-context review loops, one PR…
Evidence-driven refactoring — where does structural improvement actually pay off, then make that change without changing behavior. Survey mode diagnoses by evidence, not aesthetics — git churn × complexity hotspots, the recurring-bug log, upcoming work — and verdicts each
$ npx -y skills add duthaho/skillhub --skill refactor --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/refactorContext preview
The summary Claude sees to decide when to auto-load this skill.
Evidence-driven refactoring — where does structural improvement actually pay off, then make that change without changing behavior. Survey mode diagnoses by evidence, not aesthetics — git churn × complexity hotspots, the recurring-bug log, upcoming work — and verdicts each
name: refactor description: >- Evidence-driven refactoring — where does structural improvement actually pay off, then make that change without changing behavior. Survey mode diagnoses by evidence, not aesthetics — git churn × complexity hotspots, the recurring-bug log, upcoming work — and verdicts each candidate REFACTOR/PREP/LEAVE/WATCH, where LEAVE is the default and "the textbook recommends it" is never a reason. Execute mode takes one approved candidate in small behavior-preserving moves, suite green after each. Keeps a debt register in out/refactor/tracker.md so repeat surveys open with what changed. Use for "clean up this module", "improve the architecture", "pay down tech debt" — e.g. "/refactor", "/refactor <target>". For new behavior use feature; for something broken use bugfix.
`/refactor` — survey the repo, emit a brief of where improvement pays off `/refactor <target or goal>` — execute one candidate, safely
Answer one question: **where does structural improvement actually pay for itself in this codebase — and how is that change made without changing behavior?** The skill exists to prevent the two documented failure modes of "improve the architecture": refactoring the wrong code (most ugly code is never touched again, so cleaning it returns nothing), and **pattern-itis** — applying design patterns because they're best practices rather than because a problem here demands them, turning straight-line code into abstraction lasagna.
Candidates come from signals, never from "this code looks bad":
`git log --format= --name-only --since="12 months ago" | sort | uniq -c | sort -rn | head -30`, crossed with a complexity proxy (file length, indentation depth). Code that is both complex *and* frequently edited is where interest compounds; complex-but-cold code is a LEAVE by default.
repeatedly is structural debt announcing itself.
`out/dev/`. These seed **PREP** candidates: make the change easy, then make the easy change — preparatory refactoring is the highest-payoff kind because the payoff is scheduled, not hoped for.
often a workaround for structure that could stop needing one.
made. A LEAVE with a reason isn't re-litigated unless its evidence changed; repeat surveys open with **"Since last survey"**.
For each candidate: **REFACTOR / PREP / LEAVE / WATCH**.
recurring bug, or scheduled work in the area. "This violates a principle" alone promotes nothing — cold code keeps its sins.
proposal that introduces one names the problem *in this codebase* (with a file:line locator and its evidence), why *this* pattern fits, and what simpler shape was considered first. "The textbook recommends it" is discarded, not weighed. Two quick tests: **the deletion test** — imagine deleting the module; if complexity vanishes it was a pass-through, if it reappears across N callers it was earning its keep — and **one adapter is a hypothetical seam, two are a real one**: don't introduce a seam until something actually varies across it.
interfaces get simpler and callers get dumber — abstractions that hide more than they add. A refactor that grows the number of things a reader must understand has failed even if every step was clean.
sketch of the move sequence, effort, and risk. Candidates too big to stay behavior-preserving (real redesigns) are phrased as ready `/feature` or `/autopilot` handoffs instead — offered, never performed.
Render the brief **in chat** per `references/brief-template.md` (read it when you reach this step), save to `out/refactor/<slug>-<YYYY-MM-DD>.md` (date via `date +%F`; create the folder if needed; committing is the user's call), and update `out/refactor/tracker.md` — one row per candidate: candidate · verdict · evidence · date · status. The user picks what to execute; the survey never starts cutting on its own.
suite for a **green baseline**. A pre-existing red is reported and stops the run — refactoring on red has no arbiter.
to be touched — pin current behavior *as it is, bugs included* — and commit them separately before any restructuring. Without them, "behavior preserved" is an opinion.
Plan the sequence as named moves — extract function, move module, rename, inline, introduce parameter object — then per move: apply it, run the suite, checkpoint commit titled with the move. The rhythm is the safety:
patched-forward red is a behavior change wearing a refactor's name. Rethink the move or split it smaller.
where everything is broken until the end.
call sites) sequence as **expand–contract**: add the new form beside the old so nothing break
Give Claude Code a memory and make it cite its sources — skills for research, daily work, and shipping code. They started as prompts I kept retyping, so I wrote each one down once. Keyless: no API keys, no signups.
The whole coding loop on one deliberate yes: map, spec, critic-hardened plan, GitHub issues, parallel worktree implementers, fresh-context review loops, one PR…
Human-facing documentation, architecture docs, and mermaid diagrams for a codebase, a module, or a feature — "draw me the architecture, with receipts." Fans…
Lightweight bug-fixing loop — reproduce → root-cause → fix test-first → verify — deliberately separate from the heavyweight feature workflow so small fixes…
Prompt-cache economics forensics — why your Claude Code tokens burn so fast, with the numbers to prove it. Parses local ~/.claude transcripts (0 tokens, a…
Morning work briefing — "what does my day look like, in one scan?" Gathers today's calendar and emails needing attention (via connected Google MCP tools when…