hatch3r-refactor

Refactor code while preserving externally observable behavior and passing tests.

26|4|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/hatch3r/hatch3r --skill hatch3r-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hatch3r-refactor
Source: https://github.com/hatch3r/hatch3r/tree/main/skills/hatch3r-refactor
Command: npx skills add https://github.com/hatch3r/hatch3r --skill hatch3r-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps teams improve internal code structure while guaranteeing the externally observable behavior stays the same, even across multiple modules and risk areas.

Core Features & Use Cases

  • Behavioral-preserving refactor workflow: defines invariants, plan, implementation steps, and verification gates to prevent accidental changes.
  • Test-first verification: requires existing tests to pass and adds targeted regression tests for at-risk behavior.
  • Guardrails for refactor risk: detects ambiguity up front, preserves error handling and error propagation paths, and prevents new dependencies or silent scope creep.
  • Orchestrated delegation: uses required researcher and reviewer agent roles to gather strategy and validate behavioral preservation.

Quick Start

Use the hatch3r-refactor skill to refactor the target codebase area while preserving public APIs and making sure all tests pass.

Frequently Asked Questions about hatch3r-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code without changing its behavior?

Refactoring code without changing behavior requires defining behavioral invariants, planning implementation steps, preserving error handling, and running mandatory test verification to ensure externally observable outcomes remain identical across affected modules.

When do I need behavior-preserving refactoring?

You need behavior-preserving refactoring during module restructuring or dependency-free cleanup when internal code quality must improve while guaranteeing public APIs and error propagation paths remain unchanged across multiple files.

How do I ensure tests pass after restructuring a module?

Ensure tests pass after restructuring by running existing tests, adding targeted regression tests for at-risk behavior, and verifying that error handling and propagation paths are preserved during the code implementation phase.

Can I use automated agent orchestration for code review during refactoring?

Yes, automated agent orchestration supports refactoring by delegating required researcher and reviewer agent roles to gather strategy and validate behavioral preservation throughout the code review and implementation workflow.

What's the best way to handle ambiguity when refactoring across multiple files?

The best way to handle ambiguity when refactoring across multiple files is to detect it up front and use required user questioning to clarify scope, preventing silent scope creep and accidental behavioral changes.

What are the limitations of dependency-free cleanup during refactoring?

Dependency-free cleanup limitations include restrictions against introducing new dependencies, requirements to preserve error handling, and mandatory regression tests for at-risk behavior to prevent accidental changes to external APIs.