skills/refactoring/strategy/SKILL.md
Manage refactoring as a strategic process — when to refactor, how to prioritize debt, and how to do it safely. Trigger: When planning a refactoring initiative, communicating technical debt, or deciding what to clean up first.
npx skillsauth add johnnystefan/test-saas-business refactoring/strategyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables the agent to move beyond simple code fixes and manage refactoring as a strategic process. It provides instructions on identifying technical debt, defining "clean code," and determining the optimal moments to refactor without disrupting production.
// CONTEXT: We need to add "Export to CSV".
// STRATEGY: First, refactor the existing "Print" logic to use an interface.
// BEFORE: Hard to extend — print logic is locked inside Report
class Report {
print() {
/* printing logic */
}
}
// DURING REFACTOR: Preparing for the new feature
interface ReportOutput {
execute(data: string): void;
}
class PrinterOutput implements ReportOutput {
execute(data: string) {
/* printing logic */
}
}
class Report {
constructor(private output: ReportOutput) {}
export() {
this.output.execute('data');
}
}
// PAYOFF: Adding CSVOutput requires zero changes to the Report class (OCP)
class CSVOutput implements ReportOutput {
execute(data: string) {
/* csv logic */
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.