developersglobal/ai-agent-skills/refactoring

Claude Code and agent skill by developersglobal/ai-agent-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Safe, behavior-preserving code transformation backed by tests. Refactor with evidence, not instinct.

Install

npx vskill@latest install developersglobal/ai-agent-skills/refactoring

SKILL.md

Overview

Refactoring changes the internal structure of code without changing its external behavior. The keyword is "without" — if behavior changes, it's not refactoring, it's modification. This skill enforces safe refactoring with tests as the safety net.

When to Use

  • When code is hard to understand or extend
  • When duplication makes maintenance risky
  • Before adding a feature to a messy area of code
  • Never: "while also adding feature X" — refactor separately

Process

Step 1: Establish a Safety Net
  1. Before touching a single line: ensure there are tests covering the code to be refactored.
  2. If tests are missing: add characterization tests first. These capture current behavior, not desired behavior.
  3. Run the tests. They should all pass. This is your baseline.

Verify: Tests pass. They cover the code being refactored.

Step 2: Refactor in Micro-Steps
  1. Make the smallest meaningful change.
  2. Run tests after EVERY change — not after 10 changes.
  3. If tests break: revert immediately and take a smaller step.
  4. Never batch multiple refactoring changes together.

Verify: Tests pass after every individual change.

Step 3: One Thing at a Time
  1. Refactoring types cannot be mixed in one step:
  • Extract method → separate commit
  • Rename → separate commit
  • Move → separate commit
  1. "Refactor and also fix this" is not refactoring — it's two PRs.

Verify: This commit does exactly one type of refactoring.

Step 4: Verify No Behavior Change
  1. Run the full test suite.
  2. If integration/E2E tests exist: run them too.
  3. Compare external API responses before and after (if applicable).

Verify: All tests pass. No observable behavior change.

Common Rationalizations (and Rebuttals)

ExcuseRebuttal
"I'll add tests after refactoring"You can't verify a behavior-preserving refactor without tests before the refactor.
"This change is obviously safe"Obvious safety is how production incidents happen. Run the tests.
"I'll just do a quick cleanup""Quick cleanup" that changes behavior is a bug, not a refactor.

Verification

  • [ ] Tests existed before any code was changed
  • [ ] Tests run after every individual change
  • [ ] Only one type of refactoring per commit
  • [ ] Full test suite passes at the end
  • [ ] No behavior change observable externally

References

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
64
Repository forks
10
7-day trend score
21

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/developersglobal/ai-agent-skills/refactoring/badge)](https://verified-skill.com/skills/developersglobal/ai-agent-skills/refactoring)

Something wrong with this skill or its page? Tell us.