refactor-solid
Refactor an oversized or mixed-concern file toward the rules (400/200/50-line limits, SOLID, query-vs-zustand split) without changing behaviour. Use for components over 200 lines, zustand slices over
Files1
View on GitHubSKILL.md.claude/skills/refactor-solid/SKILL.md
GitHubRefactor toward SOLID
- Name the target's responsibilities (one line each). Pick one seam. Answer the four questions at the bottom of
.claude/rules/04-solid.md. - Pin behaviour first: existing tests, or characterization tests (
/write-tests). - Extract in small green steps, in the order of
.claude/rules/03-file-size.md§ What to do: pure logic → sub-components → hooks → one query per file → split the module. - Server data found in a zustand store → move it behind a repository + react-query hook (
.claude/rules/05-state-management.md); the store keeps only UI state. - Keep the feature barrel (
index.ts) stable until callers move. No deep cross-feature imports. pnpm checkafter each step; onerefactor(scope): …commit per step. Never mix in behaviour changes — a bug found on the way gets its own failing test andfix:commit.
Done when: every new unit has one reason to change, all limits hold, no new any, no strings outside TEXT.