
Code Refactor
This handles bulk refactoring operations like renaming variables or functions across your codebase. You grep for all occurrences, use the Edit tool with replace_all set to true, then verify nothing got missed. The smart part is that it automatically switches to execution mode when you're touching 10+ files, which saves about 90% of tokens compared to editing each file individually. Good for the obvious stuff like renaming identifiers or swapping deprecated API calls, though you still need to think about edge cases like whether to update strings and comments. It's basically a workflow wrapper around grep and replace that knows when to bail to Python for the heavy lifting.
- skills.sh installs
- 301
- GitHub stars
- 693
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mhattingpete/claude-skills-marketplace --skill code-refactor --agent claude-codeInstalls into .claude/skills of the current project.
Files
Code Refactor
Systematic code refactoring across files. Auto-switches to execution mode for 10+ files (90% token savings).
Mode Selection
- 1-9 files: Use native tools (Grep + Edit with replace_all)
- 10+ files: Automatically use
code-executionskill
Execution example (50 files):
from api.code_transform import rename_identifier
result = rename_identifier('.', 'oldName', 'newName', '**/*.py')
# Returns: {'files_modified': 50, 'total_replacements': 247}
# ~500 tokens vs ~25,000 tokens traditional
When to Use
- "rename [identifier] to [new_name]"
- "replace all [pattern] with [replacement]"
- "refactor to use [new_pattern]"
- "update all calls to [function/API]"
- "convert [old_pattern] to [new_pattern]"
Core Workflow (Native Mode)
1. Find All Occurrences
Grep(pattern="getUserData", output_mode="files_with_matches") # Find files
Grep(pattern="getUserData", output_mode="content", -n=true, -B=2, -A=2) # Verify with context
2. Replace All Instances
Edit(
file_path="src/api.js",
old_string="getUserData",
new_string="fetchUserData",
replace_all=true
)
Sponsors
Details
- Repository
- github.com/mhattingpete/claude-skills-marketplace
- Categories
- Backend & APIs, Code Review & Quality
- License
- Apache-2.0
- First seen
- Jun 3, 2026
More from mhattingpete/claude-skills-marketplace
All 18- Feature Planning295
- Code Execution293
- Review Implementing256
- Conversation Analyzer248
- Technical Doc Creator221
- Ensemble Solving218
- Project Bootstrapper211
- Code Transfer173
- Flowchart Creator749
- Codebase Documenter594
- Architecture Diagram Creator500
- File Operations417
- Git Pushing411
- Test Fixing386
- Code Auditor341
- Timeline Creator335
- Dashboard Creator332