refactor
Apply the refactoring catalog (Fowler, Beck Tidy First, Feathers legacy techniques) to existing code.
Skill by timander
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/timander-refactor
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/refactor
Tools it pre-approves 1
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
shell
What's inside
- Skill name
refactor- Description
- Apply the refactoring catalog (Fowler, Beck Tidy First, Feathers legacy techniques) to existing code. Use when the user wants to improve a specific piece of code without changing its behavior.
- License
- MIT
- Allowed tools
- shell
- Instructions
- 68 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Refactor ## Before Touching Anything - **Tests exist?** If yes, run them green first. If no, write characterization tests *before* changing structure. - **One change at a time.** Never combine behavior change with structural change in the same step. - **Commit between moves.** Small, reversible steps; each commit compiles and passes tests. ## The Move Catalog > Reach for the smallest move that fits. **Tidy First** moves (Beck) are smaller and often applied during the green-refactor step. **Refactoring Catalog** moves (Fowler) are larger and applied to address named smells. If a Tidy First move would do, take that instead. ### Tidy First (Beck) — small, frequent | Move | When | |---|---| | **Guard clauses** | Nested conditionals hide the happy path | | **Slide statements** | Related code is scattered | | **Split phase** | One function does two distinct things in sequence | | **Extract helper** | Block deserves a name | | **Rename** | Name lies, hedges, or is generic | ### Refactoring Catalog (Fowler) — larger, smell-driven Pick the move that matches the smell. Always name it and say *why* it improves the design. | Move | When to apply | |---|---| | **Extract Method** | Long method or block that does one nameable thing | | **Extract Class** | One class has multiple reasons to change | | **Extract Interface** | Concrete dependency blocks testability or substitution | | **Replace Conditional with Polymorphism** | `switch` / chain of `if` over a type code | | **Introduce Parameter Object** | The same parameter cluster recurs | | **Replace Constructor with Factory Method** | Construction needs a name or selection logic | | **Move Method / Move Field** | Feature envy: method touches another class's data more than its own | | **Replace Inheritance with Delegation** | Fragile hierarchy; "is-a" was wishful | | **Inline Method / Inline Class** | Indirection adds nothing | | **Rename** | Name doesn't reveal intent | Reference: Beck, *Tidy First?*; Fowler, *Refactoring* (Ch. 6–12); Kerievsky, *Refactoring to Patterns*. ## Working with Legacy Code (Feathers) Legacy = code without tests. Goal: make it safe to change. ### Get it under test first - **Characterization tests**: document current behavior, even if wrong. "What does it do?" not "What should it do?" - **Find seams**: places behavior can change without editing the existing code — object seams, preprocessing seams, link seams. - **Break dependencies safely**: Extract Interface, Parameterize Constructor, Adapt Parameter. ### Add behavior safely - **Sprout Method / Sprout Class**: new logic in a new, tested unit; call it from the legacy caller. - **Wrap Method / Wrap Class**: preserve existing behavior, add new behavior alongside. - **Strangler pattern**: route new paths through clean code; let the old code shrink. ### Principles - Never rewrite from scratch. Incrementally expand the tested surface. - Legacy code is code we don't understand yet. Add understanding through tests *before* changing it. - Each step leaves the code in a working state. Reference: Feathers, *Working Effectively with Legacy Code* (Ch. 4 seams, Ch. 8 sprout/wrap, Ch. 25 dependency-breaking). ## Output Discipline - For each move: **name it**, show the before/after diff, state the smell it addresses, and confirm tests still pass. - Stop when the next change is easy.
From timander/copilot-instructions-starter-kit, MIT.
More from timander/copilot-instructions-starter-kit
- 0.474score
audience
timander
Switch the explanation level (learning / working / expert) for a stack mid-session.
SkillCFreshness: CClaude Code +9 - 0.474score
challenge
timander
Socratic questioning — challenge the user's assumptions and thinking before they commit.
SkillCFreshness: CClaude Code +9 - 0.474score
code-quality
timander
Offer to add opt-in lint, static-analysis, and coverage tooling for the project's language.
SkillCFreshness: CClaude Code +9 - 0.474score
diagnose
timander
One-shot systematic diagnosis script — understand the problem before suggesting fixes.
SkillCFreshness: CClaude Code +9 - 0.474score
expert-panel
timander
Simulate a panel of named experts (Fowler, Beck, Bloch, Metz, Feathers, etc.) discussing the code or design decision.
SkillCFreshness: CClaude Code +9 - 0.474score
kit-doctor
timander
Self-audit this Copilot kit for token cost, bloat, schema drift, and coverage gaps.
SkillCFreshness: CClaude Code +9 - 0.474score
options
timander
Present a decision as a set of options with trade-offs spelled out, so the user can pick well.
SkillCFreshness: CClaude Code +9 - 0.474score
review
timander
Review code or a PR diff for correctness, design, smells, and missing tests.
SkillCFreshness: CClaude Code +9 - 0.474score
tdd
timander
Walk through Red-Green-Refactor explicitly for implementing a feature.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 12, 2026 (4 months ago)
- Last release
- Jun 12, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from timander
- 0.474score
audience
timander
Switch the explanation level (learning / working / expert) for a stack mid-session.
SkillCFreshness: CClaude Code +9 - 0.474score
challenge
timander
Socratic questioning — challenge the user's assumptions and thinking before they commit.
SkillCFreshness: CClaude Code +9 - 0.474score
code-quality
timander
Offer to add opt-in lint, static-analysis, and coverage tooling for the project's language.
SkillCFreshness: CClaude Code +9 - 0.474score
diagnose
timander
One-shot systematic diagnosis script — understand the problem before suggesting fixes.
SkillCFreshness: CClaude Code +9 - 0.474score
expert-panel
timander
Simulate a panel of named experts (Fowler, Beck, Bloch, Metz, Feathers, etc.) discussing the code or design decision.
SkillCFreshness: CClaude Code +9 - 0.474score
kit-doctor
timander
Self-audit this Copilot kit for token cost, bloat, schema drift, and coverage gaps.
SkillCFreshness: CClaude Code +9
Cite this page
refactor skill. Agent Mart. https://agentmart.dev/skills/timander-refactor (last updated 2026-10-24)