Hatch3r Refactor logo

Hatch3r Refactor

Organization
hatch3r
hatch3r-refactor

Internal code quality improvement workflow without changing external behavior. Use when refactoring code structure, simplifying modules, or improving maintainability.

Overview

Publisherhatch3r
Repositoryhatch3r
Skill namehatch3r-refactor
Stars
26
Forks
7
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by hatch3r on GitHub. Read the source before you install it.

Installation

Install the Hatch3r Refactor AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/hatch3r/hatch3r/tree/main/skills/hatch3r-refactor
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hatch3r/hatch3r.git /tmp/hatch3r
mkdir -p .claude/skills
cp -r /tmp/hatch3r/skills/hatch3r-refactor .claude/skills/hatch3r-refactor
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hatch3r Refactor in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hatch3r Refactor on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hatch3r Refactor is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Code Refactor Workflow

Quick Start

Task Progress:
- [ ] Step 0: Detect ambiguity (P8 B1)
- [ ] 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

Step 0 — Detect Ambiguity (P8 B1)

Before any work, scan the invocation for unresolved questions in scope, intent, acceptance criteria, target environment, or irreversibility. If any are found, ask the user via the platform-native question tool per agents/shared/user-question-protocol.md. Do not proceed under silent assumption. Default path, not an exception. Triggers for THIS skill: refactor scope (one module vs cross-cutting), behavioral invariants to preserve, public API surface (preserved vs changed), test rewrite policy (preserve vs replace), and acceptable performance delta.

Fan-out Discipline (P8 B2)

Fan-out scales with task size; token cost never justifies serializing independent work (rules/hatch3r-fan-out-discipline.md P8 B2; agents/shared/efficiency-patterns.md). Emit sub_agents_spawned: { count, rationale, task_structure } in your output.

Step 1: Read Inputs

  • Parse the issue body: motivation, proposed change, affected files, safety plan, risk analysis, acceptance criteria.
  • Read project quality standards documentation.
  • Read specs for the area being refactored.
  • Review all existing tests — every one must still pass after refactoring.
  • Review reference implementations: If the orchestrator provided similar-implementation researcher output, read the reference implementations and their extracted conventions. The refactored code should align with these established codebase patterns.
  • Review resolved requirements: If the orchestrator provided requirements-elicitation answers, use them to understand explicit user decisions on behavioral invariants and scope.
  • For external library docs and current best practices, follow the project's tooling hierarchy.

Step 2: Refactor Plan

Before changing code, output:

  • Goal: what improves (readability, performance, maintainability)
  • Strategy: how the refactor works
  • Convention alignment: which reference implementation's patterns the refactored code will follow (from similar-implementation output), with divergences noted. If no reference was provided, note "using existing codebase conventions."
  • Files to modify: list with what changes
  • Behavioral invariant: what must NOT change
  • Risk assessment: what could go wrong, how to detect
  • Rollback: how to revert if needed

Step 3: Implement

  • Refactor with minimum changes needed.
  • Preserve all public interfaces and external behavior.
  • Remove dead code created by the refactor.
  • Do not introduce new dependencies.
  • If a bug is found, document it -- fix in a separate PR.
  • Error handling preservation. When moving or restructuring error handling code, verify that the error behavior is preserved. A common refactoring mistake is accidentally changing error types, removing error context, or altering error propagation paths. Run error-path tests after each structural change.

Step 4: Verify

  • All existing tests must pass without modification.
  • Add regression tests for previously untested at-risk behavior.
  • Performance verification if refactored code is on a hot path.
bash
${HATCH3R:VERIFY_GATE_ALL}

Resolved to the project's language-aware gate at sync time (fallback when detection is unknown: npm run lint && npm run typecheck && npm run test).

Step 5: Open PR

Use the project's PR template. Include:

  • Motivation (why this refactor now)
  • Before/after structure (high-level description)
  • Proof of behavioral preservation (test results)
  • Performance impact (if applicable)

Required Agent Delegation

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: "general-purpose") 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.

Related Skills

  • Skill: hatch3r-logical-refactor — use when the refactor changes internal logic flow while preserving external behavior
  • Skill: hatch3r-visual-refactor — use when the refactor targets UI/styling changes without altering functionality

Error Handling

  • Existing tests fail after refactor: Do not modify tests to make them pass unless the test was verifying an implementation detail (not behavior). If a behavioral test fails, the refactor changed external behavior and must be revised.
  • Refactor scope expands beyond the original module: If additional modules need changes due to coupling, stop and assess whether the refactor should be split into phases. Get confirmation before expanding scope.
  • Type errors after restructuring: Resolve all type errors before running tests. If the type system reveals unexpected dependencies, document them as findings for the codebase health record.

Definition of Done

  • All existing tests pass without modification
  • Regression tests added for at-risk behavior
  • No new linter warnings
  • Performance budgets maintained
  • Dead code removed
  • No external behavior changed
  • No new dependencies introduced

Frequently asked questions

What does the Hatch3r Refactor AI skill do?

Internal code quality improvement workflow without changing external behavior. Use when refactoring code structure, simplifying modules, or improving maintainability.

Why use Hatch3r Refactor on TypingMind?

Because you install it once and use it with any model. Hatch3r Refactor is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hatch3r Refactor in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/hatch3r/hatch3r/tree/main/skills/hatch3r-refactor. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Hatch3r Refactor?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hatch3r Refactor?

As many as you like. As long as a model supports skills, you can use Hatch3r Refactor with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hatch3r Refactor AI skill free?

Yes. It is published on GitHub by hatch3r under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇