tmcfarlane/oh-my-cursor/refactoring
Claude Code and agent skill by tmcfarlane/oh-my-cursor
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks to "refactor code", "rename function", "extract method", "reduce complexity", "migrate code", "code migration", "modernize code", "split class", "move code", or mentions code restructuring and refactoring operations.
Install
npx vskill@latest install tmcfarlane/oh-my-cursor/refactoringSKILL.md
Refactoring
Comprehensive refactoring skill for safe code restructuring, migrations, and modernization.
Core Capabilities
Safe Renaming
Rename identifiers across the codebase:
Rename workflow:
- Find all references: Search for all usages
- Identify scope: Module-local, package-wide, or public API
- Check dependencies: External code that might break
- Perform rename: Update all occurrences
- Verify: Run tests, check imports
Search patterns:
Renaming considerations:
- Update docstrings mentioning the old name
- Update comments referencing the name
- Update configuration files
- Update tests
- Consider deprecation period for public APIs
Method Extraction
Extract code into separate functions:
When to extract:
- Code block is too long (> 20 lines)
- Code is duplicated elsewhere
- Code has a clear single purpose
- Code can be tested independently
Extraction process:
- Identify the code block to extract
- Determine inputs (parameters)
- Determine outputs (return values)
- Create new function with clear name
- Replace original code with function call
- Add tests for new function
Before:
After:
Class Splitting
Split large classes into focused components:
When to split:
- Class has multiple responsibilities
- Class has > 500 lines
- Groups of methods work on different data
- Testing requires excessive mocking
Splitting strategies:
Extract class:
Complexity Reduction
Reduce cyclomatic complexity:
Replace conditionals with polymorphism:
Extract guard clauses:
Code Migration
Migrate code between patterns or versions:
Migration types:
- Python 2 to 3
- Sync to async
- ORM migrations
- API version upgrades
- Framework migrations
Migration workflow:
- Assess scope: What needs to change
- Create compatibility layer: If gradual migration
- Migrate in phases: Start with low-risk areas
- Maintain tests: Ensure behavior preserved
- Remove old code: Clean up after migration
Example: Sync to Async
Refactoring Workflow
Safe Refactoring Process
- Ensure test coverage: Add tests if missing
- Run tests: Verify green baseline
- Make small change: One refactoring at a time
- Run tests again: Verify still green
- Commit: Save progress
- Repeat: Continue with next change
Pre-Refactoring Checklist
Post-Refactoring Verification
Common Refactorings
Remove Dead Code
Simplify Expressions
Introduce Explaining Variables
Safety Guidelines
Breaking Changes
When refactoring public APIs:
- Add deprecation warnings first
- Maintain backwards compatibility
- Document migration path
- Remove after deprecation period
Database Migrations
When refactoring data models:
- Create migration scripts
- Test migrations on copy of data
- Plan for rollback
- Consider zero-downtime migrations
Performance Impact
After refactoring:
- Run performance benchmarks
- Compare with baseline
- Profile if regression found
- Optimize if necessary
Integration
Coordinate with other skills:
- code-quality skill: Measure improvement
- test-coverage skill: Ensure test coverage
- architecture-review skill: Validate structural changes
- git-workflows skill: Proper commit messages for refactors
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/refactoring/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 19 Mar 2026, 7 months ago.
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
[](https://verified-skill.com/skills/tmcfarlane/oh-my-cursor/refactoring)