/tslateman-skills:refactorfrom tslateman-skills
Execute a named restructure with observable behavior held constant, applying Fowler's Refactoring. Use when you name a target ("extract this", "consolidate these three", "split this phase"), when `maintainability` hands off a cure, or when a change needs preparatory restructuring before the feature lands. Works in small verified steps against a green test suite and commits each step. Do NOT use to find problems (that is `maintainability` or `code-review`), to judge a design (that is `ousterhout-software-design`), or to change what the code does.
Ships in tslateman-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Change the structure, never the behavior. Fowler's discipline: a series of small transformations, each one verified, each one revertible, none of them altering what a caller observes.
maintainability.code-review.ousterhout-software-design.domain-model.legacy.tidy.simplify.Kent Beck's two hats: adding function and refactoring are separate hats. Wear one at a time and know which one is on. Adding function never changes existing structure; refactoring never changes behavior. A step that does both is neither, and it is unreviewable.
The test of a refactoring is not the diff size. It is whether any caller can tell. If a public contract, a stored format, an emitted event, or an error type changed, the hat came off.
Refuse to start without all three. Say which one is missing and stop.
legacy, get green, then come back. Never restructure code whose behavior nothing pins down.maintainability hands one over, or you name it explicitly and confirm before touching code.billing.py:140-172."references/catalog.md. The mechanics exist so that every intermediate state compiles and passes. Do not improvise a shortcut through the middle.| Smell | Move |
|---|---|
| Duplicated logic (three or more) | Extract Function, then Pull Up / Move Function to a shared owner |
| Long parameter list | Introduce Parameter Object, Preserve Whole Object |
| Primitive obsession | Replace Primitive with Object, Replace Type Code with Subclasses |
| Shotgun surgery | Move Function / Move Field until the change has one home |
| Divergent change | Split Phase, or extract the axis that varies independently |
| Nested conditionals | Replace Nested Conditional with Guard Clauses, Decompose Conditional |
| Type-switch repeated across sites | Replace Conditional with Polymorphism |
| Flag argument | Remove Flag Argument (split into two intention-revealing functions) |
| Pass-through / delegation layer | Inline Function, Remove Middle Man |
| Data clump | Extract Class, Introduce Parameter Object |
| Mixed computation and I/O | Split Phase, Separate Query from Modifier |
| Speculative generality | Inline Function, Collapse Hierarchy, Remove Dead Code |
Full mechanics: references/catalog.md. Detection is maintainability's job, not this skill's — arrive here with the smell already named.
Where Fowler and Ousterhout disagree, Ousterhout wins — same tiebreak as maintainability.
code-comments rule overrides Fowler. Never add a comment as part of a refactor — not to explain the new shape, not to justify the move. Refactoring deletes comments more often than it touches them: a comment explaining an unclear fragment is a signal to extract and name it, and the name retires the comment. If an extracted name needs a comment to be understood, the name is wrong. Comments already in the code travel with the lines they explain; never strand one by moving its subject out from under it.no-dead-defensiveness rule holds. Do not add null checks, try/except, or fallback defaults while restructuring; let exceptions raise to a caller that can handle them. A guard is a behavior change wearing a structural disguise, and a swallowed exception makes the refactor unverifiable — the suite goes green on a silent default instead of the real path.legacy first or leave it.sed. Text substitution catches strings, comments, and unrelated identifiers.What SKILL.md sets; muted values are Claude Code's defaults
tslateman-skills@tslateman is listed by tslateman/claude-plugins — review the source before installing
npx claudepluginhub tslateman/claude-plugins --plugin tslateman-skills61 skills in this plugin
/adrGenerate Architecture Decision Records that capture the reasoning behind technical decisions. Use when the user asks to "create an ADR", "document a decision", "record why we chose X", or discusses architectural trade-offs worth preserving./arenaSpawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it. Use for /arena, 'arena this', 'throw it in the arena', or when one attempt at a non-trivial artifact would lock in the wrong shape./automagic-problem-discoveryAudit a workspace for recurring friction, pick the highest-leverage one, and build the automation that removes it. Use when the user asks "what should I automate", "what's wasting my time", "find the friction in my workflow", wants a self-improvement pass over their own tooling, or runs this on a recurring loop./blast-radiusFind what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe because of by running real code instead of writing it up. Use for 'blast radius of X', 'what could this break', or reviewing a small diff you don't trust./brainstormThis skill should be used when the user asks to "brainstorm", "generate ideas", "ideate", "what are my options", "think of ways to", "explore possibilities", or wants divergent thinking on any topic. Also triggers on "what could we do about", "help me think through", or "creative options for"./broRe-explain the previous assistant message in a much simpler way — for when the reply made you go 'bro what'. Use /bro to get a plain-language version of the last answer.