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

SKILL.md

GitHub

Refactor toward SOLID

  1. Name the target's responsibilities (one line each). Pick one seam. Answer the four questions at the bottom of .claude/rules/04-solid.md.
  2. Pin behaviour first: existing tests, or characterization tests (/write-tests).
  3. 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.
  4. 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.
  5. Keep the feature barrel (index.ts) stable until callers move. No deep cross-feature imports.
  6. pnpm check after each step; one refactor(scope): … commit per step. Never mix in behaviour changes — a bug found on the way gets its own failing test and fix: commit.

Done when: every new unit has one reason to change, all limits hold, no new any, no strings outside TEXT.