Skip to content
Agentmart
Submit a tool

refactor

Restructure code under a plan, test-first when behavior changes, against a green baseline when it must stay the same.

Skill by GUOJIE-HONG

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/guojie-hong-refactor

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Restructure code under a plan, test-first when behavior changes, against a green baseline when it must stay the same.

Use cases: testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/refactor

What's inside

Skill name
refactor
Description
Restructure code under a plan, test-first when behavior changes, against a green baseline when it must stay the same.
License
MIT
Instructions
20 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • openai.yaml · agents/
  • change.md · references/
  • preserve.md · references/

SKILL.md (first lines)

# Refactor

1. **Classify** the request against the current code. Read the code in scope and its callers, then decide:

   - **Behavior-preserving**: every observable result stays the same (return values, errors, side effects, public interfaces, stored data). Only the structure changes. Follow [`references/preserve.md`](references/preserve.md).
   - **Behavior-changing**: any observable result differs. Follow [`references/change.md`](references/change.md). It is **breaking** when an existing caller, stored data, or public contract stops working as it did.

   When the request mixes both, split it into two passes: the behavior-preserving pass first, then the behavior change on top of it. When the code cannot settle the classification, ask the user. Tell the user the classification and the evidence for it before planning.
2. **Plan.** Write `.refactor/<refactor-slug>/plan.md`:

   - Goal: the observable result. For a behavior-preserving pass, "behavior unchanged" plus the target structure.
   - Scope: what changes, and what stays untouched.
   - Test coverage: the tests that exercise this area today, and the gaps.
   - Steps: the smallest steps you can make, each leaving the code working.

   For a breaking change, also list every affected caller and contract, and wait for the user's approval of the plan before editing.
3. **Execute** the plan along the path file. When the code contradicts the plan, stop and update the plan with the user before continuing.
4. **Review.** Run `$code-review` with the plan as the spec, pointing it at the review focus in the path file. Fix what it finds.
5. **Report**: the classification, the steps done, the exact test commands and their results, the review findings and how each was resolved, and every deviation from the plan.

From GUOJIE-HONG/skills, MIT.

More from GUOJIE-HONG/skills

Signals

Stars
1
Forks
1
Open issues
1
Last commit (this folder)
Oct 7, 2026 (23 days ago)
Last release
Oct 23, 2026 (7 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from GUOJIE-HONG

Cite this page

refactor skill. Agent Mart. https://agentmart.dev/skills/guojie-hong-refactor (last updated 2026-10-24)