refactor · vstorm-co — Claude Code skill: what it does, how to install
The refactor skill guides code changes that improve structure while preserving external behavior. Use it to break up long functions, remove duplication, or make naming consistent.
MIT ★ 1,125 updated 2026-10-27
npx skills add vstorm-co/pydantic-deepagents --skill refactor -a claude-codeWhat refactor does
The skill starts by examining related code and running the tests already in the project. It then lays out a plan and makes changes in small steps, checking tests along the way. That keeps each refactoring tied to a verification step.
Typical changes include splitting long functions, moving repeated code into a helper, replacing magic numbers with named constants, and simplifying nested conditions. It also covers grouping related functions into modules and addressing circular dependencies through dependency inversion.
External behavior must stay the same, with tests passing before and after the changes. When tests are missing, write them first. Keep feature work separate from refactoring, and limit each commit to one refactoring type.
What it helps with
- split a long function into focused pieces
- move repeated code into a shared helper
- replace magic numbers with named constants
- simplify nested conditionals
- group related functions into modules
Example prompts for the agent
- Refactor this long function into smaller parts while keeping its behavior unchanged and checking the tests.
- Find repeated code in the related files and move it into a shared helper.
- Make the function names consistent without adding features or changing behavior.
How to install refactor
1Skills CLI (Vercel)
npx skills add vstorm-co/pydantic-deepagents --skill refactor -a claude-code2Manually: put the files in place
~/.claude/skills/refactor/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/refactor/
1Skills CLI (Vercel)
npx skills add vstorm-co/pydantic-deepagents --skill refactor -a codex2Manually: put the files in place
.agents/skills/refactor/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add vstorm-co/pydantic-deepagents --skill refactor -a cursor2Manually: put the files in place
.cursor/skills/refactor/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install vstorm-co/pydantic-deepagents apps/cli/skills/refactor2Manually: put the files in place
.github/skills/refactor/SKILL.md1Skills CLI (Vercel)
npx skills add vstorm-co/pydantic-deepagents --skill refactor -a gemini-cli2Platform CLI
gemini skills install https://github.com/vstorm-co/pydantic-deepagents --path apps/cli/skills/refactorManually: put the files in place
.devin/skills/refactor/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about refactor
How do I install refactor in Claude Code?
Run npx skills add vstorm-co/pydantic-deepagents --skill refactor -a claude-code. The skill file is located at ~/.claude/skills/refactor/SKILL.md.
What does the refactor skill do?
It guides structural code changes while preserving external behavior, with a plan and test checks as changes are made.
What if the project has no tests yet?
Write tests before refactoring. Keep feature changes out of the same change.
Source text
SKILL.md · MIT
--- name: refactor description: "Refactor code to improve structure and maintainability" tags: [code-quality, refactoring] version: "1.0.0" --- # Refactor Improve code structure without changing external behavior. ## Process 1. **Understand** — Read all related code, run existing tests 2. **Plan** — Identify what to change and why 3. **Execute** — Make changes incrementally 4. **Verify** — Run tests after each change ## Common Refactoring Patterns ### Extract - Long function → smaller focused functions - Repeated code → shared helper - Magic numbers → named constants ### Simplify - Deep nesting → early returns / guard clauses - Complex conditionals → descriptive functions - Large classes → smaller focused classes ### Rename - Unclear names → descriptive names - Inconsistent naming → consistent conventions ### Reorganize - Related functions scattered → grouped in modules - Circular dependencies → dependency inversion ## Rules - Never change behavior — tests must pass before and after - One refactoring type per commit - If tests don't exist, write them first - Don't refactor and add features in the same change
© vstorm-co · MIT · vstorm-co/pydantic-deepagents
Similar skills
All skills for Code review and refactoring →refactor by other authors comes first.