/refactor-plan
Creates detailed refactor plan with tiny commits via interview, files as GitHub RFC. Triggers: refactor plan, refactoring RFC, incremental refactor, safe steps.
$ npx -y skills add softspark/ai-toolkit --skill refactor-plan --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/refactor-plan
Context preview
The summary Claude sees to decide when to auto-load this skill.
Creates detailed refactor plan with tiny commits via interview, files as GitHub RFC. Triggers: refactor plan, refactoring RFC, incremental refactor, safe steps.
SKILL.md
refactor-plan.SKILL.mdname: refactor-plan
description: "Creates detailed refactor plan with tiny commits via interview, files as GitHub RFC. Triggers: refactor plan, refactoring RFC, incremental refactor, safe steps."
user-invocable: true
effort: high
argument-hint: "[area or module to refactor]"
allowed-tools: Read, Grep, Glob, Bash, Agent
Refactor Plan
$ARGUMENTS
Create a detailed refactor plan with tiny commits via user interview, filed as a GitHub issue.
Usage
/refactor-plan [area or module to refactor]
What This Command Does
1. **Gathers** detailed problem description from user 2. **Explores** the codebase to verify assertions 3. **Presents** alternative approaches (>=3 options) 4. **Interviews** about implementation details 5. **Checks** test coverage of affected area 6. **Breaks** into tiny commits (Martin Fowler: each step keeps codebase working) 7. **Files** as GitHub issue via `gh issue create`
Process
1. Gather Problem
Ask for detailed description of:
- The problem they want to solve
- Potential ideas for solutions
2. Explore Codebase
Use Agent (subagent_type=Explore) to verify assertions and understand current state.
3. Present Alternatives
Present >=3 alternative approaches. Discuss trade-offs.
4. Interview
Detailed interview about chosen approach. Hammer out exact scope — what changes, what doesn't.
5. Check Test Coverage
Explore existing test coverage for the affected area. If insufficient, ask about testing plans.
6. Break into Tiny Commits
Each commit:
- Leaves the codebase in a working state
- Is the smallest possible step
- Can be reviewed independently
7. File GitHub Issue
Use `gh issue create` with template below. Share URL immediately.
Issue Template
<refactor-plan-template>
Problem Statement
The problem from the developer's perspective.
Solution
The solution from the developer's perspective.
Commits
Detailed plan in plain English, broken into the tiniest commits possible. Each commit leaves the codebase working.
Decision Document
Implementation decisions made:
- Modules to build/modify
- Interface changes
- Architectural decisions
- Schema changes
- API contracts
Do NOT include file paths or code snippets — they go stale.
Testing Decisions
- What makes a good test (external behavior, not implementation details)
- Which modules to test
- Prior art for tests in the codebase
Out of Scope
What is explicitly NOT part of this refactor.
</refactor-plan-template>
Rules
- **MUST** present >=3 alternative approaches with trade-offs before committing to one
- **MUST** break the refactor into commits small enough to roll back individually — a commit that cannot be reverted is not tiny
- **MUST** verify test coverage of the affected area before planning; insufficient coverage is a blocker, not a warning
- **NEVER** embed file paths, code snippets, or function names in the issue body — the plan outlives the code
- **NEVER** ask for review after creating the issue — file it immediately, share the URL, iterate in comments
- **CRITICAL**: dead-code cleanup is **per step**, not deferred (Constitution Art. VI.1). "We'll delete the old code later" is only acceptable during explicit expand-contract phases, and the cleanup step must be in the plan.
- **MANDATORY**: the Out of Scope section names what is NOT part of this refactor — scope clarity prevents reviewer confusion
Gotchas
- "Tiny" is relative to the reviewer's context. A 20-line commit that touches the hot path is not tiny in practice — tiny means **tractable**, not short.
- Tests for refactors are often omitted with "the existing tests cover it". Verify by running the suite with coverage in the affected area, not by asking.
- Rebasing a long chain of tiny commits is painful when the target branch moves. Recommend landing the chain weekly and rebasing on `main` before each review round.
- GitHub issue RFCs tend to get stale if the refactor drags. Add a "Status" line that updates with each landed commit so readers see progress without scrolling through comments.
- Expand-contract refactors with double-writes silently leak cost — both paths are live, both pay resources. Set a hard deadline in the plan for when the old path is removed.
When NOT to Use
- For **executing** a refactor directly — use `/refactor`
- For architecture-level audit without a specific refactor in mind — use `/architecture-audit`
- For creating a PRD (product requirements) — use `/write-a-prd`
- For a plan without the GitHub RFC step — use `/plan`
- For interface design of a single module — use `/design-an-interface`
Read more
name: refactor-plan description: "Creates detailed refactor plan with tiny commits via interview, files as GitHub RFC. Triggers: refactor plan, refactoring RFC, incremental refactor, safe steps." user-invocable: true effort: high argument-hint: "[area or module to refactor]" allowed-tools: Read, Grep, Glob, Bash, Agent
Refactor Plan
$ARGUMENTS
Create a detailed refactor plan with tiny commits via user interview, filed as a GitHub issue.
Usage
/refactor-plan [area or module to refactor]
What This Command Does
1. **Gathers** detailed problem description from user 2. **Explores** the codebase to verify assertions 3. **Presents** alternative approaches (>=3 options) 4. **Interviews** about implementation details 5. **Checks** test coverage of affected area 6. **Breaks** into tiny commits (Martin Fowler: each step keeps codebase working) 7. **Files** as GitHub issue via `gh issue create`
Process
1. Gather Problem
Ask for detailed description of:
- The problem they want to solve
- Potential ideas for solutions
2. Explore Codebase
Use Agent (subagent_type=Explore) to verify assertions and understand current state.
3. Present Alternatives
Present >=3 alternative approaches. Discuss trade-offs.
4. Interview
Detailed interview about chosen approach. Hammer out exact scope — what changes, what doesn't.
5. Check Test Coverage
Explore existing test coverage for the affected area. If insufficient, ask about testing plans.
6. Break into Tiny Commits
Each commit:
- Leaves the codebase in a working state
- Is the smallest possible step
- Can be reviewed independently
7. File GitHub Issue
Use `gh issue create` with template below. Share URL immediately.
Issue Template
<refactor-plan-template>
Problem Statement
The problem from the developer's perspective.
Solution
The solution from the developer's perspective.
Commits
Detailed plan in plain English, broken into the tiniest commits possible. Each commit leaves the codebase working.
Decision Document
Implementation decisions made:
- Modules to build/modify
- Interface changes
- Architectural decisions
- Schema changes
- API contracts
Do NOT include file paths or code snippets — they go stale.
Testing Decisions
- What makes a good test (external behavior, not implementation details)
- Which modules to test
- Prior art for tests in the codebase
Out of Scope
What is explicitly NOT part of this refactor.
</refactor-plan-template>
Rules
- **MUST** present >=3 alternative approaches with trade-offs before committing to one
- **MUST** break the refactor into commits small enough to roll back individually — a commit that cannot be reverted is not tiny
- **MUST** verify test coverage of the affected area before planning; insufficient coverage is a blocker, not a warning
- **NEVER** embed file paths, code snippets, or function names in the issue body — the plan outlives the code
- **NEVER** ask for review after creating the issue — file it immediately, share the URL, iterate in comments
- **CRITICAL**: dead-code cleanup is **per step**, not deferred (Constitution Art. VI.1). "We'll delete the old code later" is only acceptable during explicit expand-contract phases, and the cleanup step must be in the plan.
- **MANDATORY**: the Out of Scope section names what is NOT part of this refactor — scope clarity prevents reviewer confusion
Gotchas
- "Tiny" is relative to the reviewer's context. A 20-line commit that touches the hot path is not tiny in practice — tiny means **tractable**, not short.
- Tests for refactors are often omitted with "the existing tests cover it". Verify by running the suite with coverage in the affected area, not by asking.
- Rebasing a long chain of tiny commits is painful when the target branch moves. Recommend landing the chain weekly and rebasing on `main` before each review round.
- GitHub issue RFCs tend to get stale if the refactor drags. Add a "Status" line that updates with each landed commit so readers see progress without scrolling through comments.
- Expand-contract refactors with double-writes silently leak cost — both paths are live, both pay resources. Set a hard deadline in the plan for when the old path is removed.
When NOT to Use
- For **executing** a refactor directly — use `/refactor`
- For architecture-level audit without a specific refactor in mind — use `/architecture-audit`
- For creating a PRD (product requirements) — use `/write-a-prd`
- For a plan without the GitHub RFC step — use `/plan`
- For interface design of a single module — use `/design-an-interface`
Professional-grade AI coding toolkit with multi-platform support. Machine-enforced safety, 109 skills, 44 agents, expanded lifecycle hooks, persona presets, experimental opt-in plugin packs, and benchmark tooling — works with Claude Code, Claude Chat/Cowork,
Repo: softspark/ai-toolkit
Other skills on ai-toolkit.
- /ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules. Claude MUST load this skill for every technical, coding, debugging, review, architecture, DevOps, data, or file-editing task in Chat or Cowork.
Open skill - /mem-search
Search past coding sessions using natural language. Finds relevant observations, decisions, and context from previous work.
Open skill - /a11y-validate
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG, EAA, ARIA, contrast, keyboard, screen reader.
Open skill - /agent-creator
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent, create agent, agent scaffold, specialized agent.
Open skill - /analyze
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report, hotspot scan, code analysis, architecture signal.
Open skill - /api-patterns
REST/GraphQL API design: naming, versioning, pagination, idempotency, OpenAPI. Triggers: API design, REST, GraphQL, OpenAPI, Swagger, idempotency, rate limit.
Open skill

