From hatch3r
Guides refactoring code structure and modules to improve maintainability, readability, and performance while preserving external behavior and ensuring all tests pass.
npx claudepluginhub hatch3r/hatch3rThis skill uses the workspace's default tool permissions.
> **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
Orchestrates multi-agent refactoring workflow: explore code, plan changes, implement, test for unchanged behavior, review quality. Improves readability and performance.
Safely refactors code using tests to improve readability, cohesion, and maintainability without changing behavior. Triggers on 'refactor', 'clean up code', 'simplify', 'reduce complexity', 'technical debt'.
Safely refactors code structure—reducing duplication, simplifying complexity, improving naming—while preserving behavior via test verification and git diffs.
Share bugs, ideas, or general feedback.
Note: Commands below use
npmas an example. Substitute with your project's package manager (yarn,pnpm,bun) or build tool when your project uses a different package manager.
Task Progress:
- [ ] Step 1: Read the issue, specs, and existing tests
- [ ] Step 2: Produce a refactor plan
- [ ] Step 3: Implement with behavioral preservation
- [ ] Step 4: Verify all tests pass, add regression tests
- [ ] Step 5: Open PR
similar-implementation researcher output, read the reference implementations and their extracted conventions. The refactored code should align with these established codebase patterns.requirements-elicitation answers, use them to understand explicit user decisions on behavioral invariants and scope.Before changing code, output:
similar-implementation output), with divergences noted. If no reference was provided, note "using existing codebase conventions."npm run lint && npm run typecheck && npm run test
Use the project's PR template. Include:
Note: When this skill is invoked via the orchestration pipeline (board-pickup or workflow commands), skip this section — the orchestrator handles agent delegation in Phases 3 and 4.
You MUST spawn these agents via the Task tool (subagent_type: "generalPurpose") at the appropriate points:
hatch3r-researcher — MUST spawn before implementation with modes current-state, refactoring-strategy, migration-path. For Tier 2+ tasks (per hatch3r-deep-context), also include similar-implementation (refactors benefit most from convention alignment — ensures the refactored code follows established patterns) and requirements-elicitation. Skip only for trivially simple refactors (risk:low AND priority:p3).hatch3r-reviewer — MUST spawn after implementation for code review, verifying behavioral preservation.hatch3r-logical-refactor — use when the refactor changes internal logic flow while preserving external behaviorhatch3r-visual-refactor — use when the refactor targets UI/styling changes without altering functionality