Plan and execute a behavior-preserving structural change, then hold the refactoring contract for the whole run. Use this skill when the user says "refactor this", "clean up this code", "restructure", "extract this", "split this up", "pay down tech debt", or "the tests are fighting me"; when the work is a `type:tech-debt` issue; or at the REFACTOR step of a TDD cycle. It produces a written plan for the owner to approve before anything is deleted or moved, and it governs every failing test after…
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Refactor
Structure changes; behavior does not. This skill has two parts, because a plan alone enforces nothing.
**Part 1 is the plan.** You write it before you delete or move anything, and the owner approves it.
**Part 2 is the standing contract.** Rules R1, R2, and R3 bind you for the whole run.
## Do not use this skill for a behavior change
A behavior change is supposed to break tests. This skill treats a broken test as evidence of a mistake, so it gives the wrong answer for feature work. Use ordinary TDD instead.
If the work mixes both, split it. Land the structural half first, under this skill. Then make the behavior change as its own commit. That split is R4, and Part 1 sequences it for you.
## The contract is live, not advisory
This text is in your context right now, and it stays there. So the triage gate below applies at the moment a test actually goes red, not only while you plan. Read R2 again at that moment. Do not act from memory of it.
…
The line at the top of this page pins the label git:20260826.33297a2, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_laygz7rfxe7lbiqm
GET https://markdownregistry.com/api/v1/resolve?ref=rustyrazorblade/skills/refactor
GET https://markdownregistry.com/api/v1/blob/61a8f5dd6d4844531c25a59d0fff42def38301f0d910af11e1e60b96a95addb7
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
rustyrazorblade/skills · .claude/skills/openspec-apply-change/SKILL.md · Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or…
rustyrazorblade/skills · .claude/skills/openspec-archive-change/SKILL.md · Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after…
rustyrazorblade/skills · .claude/skills/openspec-bulk-archive-change/SKILL.md · Archive multiple completed changes at once. Use when archiving several parallel changes.
rustyrazorblade/skills · .claude/skills/openspec-explore/SKILL.md · Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use…
rustyrazorblade/skills · .claude/skills/openspec-onboard/SKILL.md · Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
rustyrazorblade/skills · .claude/skills/openspec-propose/SKILL.md · Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they…
rustyrazorblade/skills · .claude/skills/openspec-sync-specs/SKILL.md · Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta…
rustyrazorblade/skills · .claude/skills/openspec-verify-change/SKILL.md · Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete…
rustyrazorblade/skills · plugins/cassandra-expert/skills/data-model/SKILL.md · Data modeling and schema design for Apache Cassandra. Use when designing tables, choosing partition keys, modeling…
code-yeongyu/oh-my-openagent · packages/shared-skills/skills/refactor/SKILL.md · Guides a refactor, cleanup, or restructure with the right decomposition. Use when the user asks to refactor, simplify…
greenfield-inc/pane · main/src/services/paneChatBundle/skills/refactor/SKILL.md · Quality pass on a branch against its remote default branch. Runs a simple analysis (conventions and smells) and, on…
dcouple/pane · main/src/services/paneChatBundle/skills/refactor/SKILL.md · Quality pass on a branch against its remote default branch. Runs a simple analysis (conventions and smells) and, on…
rsmdt/the-startup · plugins/start/skills/refactor/SKILL.md · Refactor, simplify, or clean up code for improved maintainability without changing business logic
boshu2/agentops · skills/refactor/SKILL.md · Restructure or clean up code with no behavior change, proved by before-and-after checks. Use when: asked to clean up…
boshu2/agentops · plugin/skills/refactor/SKILL.md · Restructure or clean up code with no behavior change, proved by before-and-after checks. Use when: asked to clean up…