Code Refactor
Bulk, consistent code refactoring across files that renames identifiers, replaces patterns, and updates API calls safely.
- CCM score
- 55 of 100
- skills.sh installs
- 306
- GitHub stars
- 697
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers renaming identifiers, replacing deprecated code patterns, and updating method or API calls across multiple locations
- Uses Grep to find every occurrence and Edit with
replace_allto apply changes, then verifies none remain - Switches to the
code-executionskill automatically for 10 or more files to reduce token usage - Follows a safe process of search, analyze, inform, execute, verify, and test, with edge cases like strings and exported APIs flagged
- Integrates with
test-fixing,code-transfer, andfeature-planningfor follow-up test repair and larger refactors
Install
$ npx -y skills add mhattingpete/claude-skills-marketplace --skill code-refactor -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
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
)
Details
- Repository
- github.com/mhattingpete/claude-skills-marketplace
- Category
- Code Review & Quality
- License
- Apache-2.0
- First seen
- Jun 3, 2026
Questions
What does the code-refactor skill do?
code-refactor performs bulk refactoring across many files, such as renaming variables or functions, replacing deprecated code patterns, and updating API calls. It finds every occurrence first, then applies consistent edits in each location. For runs of 10 or more files, code-refactor switches to the code-execution skill to save tokens.
How do I install the code-refactor skill?
Run npx -y skills add mhattingpete/claude-skills-marketplace --skill code-refactor -y in your project. Once installed, code-refactor lets your agent rename identifiers across a codebase and replace patterns in every matching file.
Which category does code-refactor belong to, and what sets it apart?
code-refactor is in the Code Review & Quality category on Claude Marketplaces, led by improve-codebase-architecture, codebase-design and code-review. Unlike those skills, code-refactor focuses on mechanical multi-file edits such as renames and API call updates. It recommends running tests afterward to confirm the changes.
More from mhattingpete/claude-skills-marketplace
All 18- Feature Planning298
- Code Execution295
- Review Implementing257
- Conversation Analyzer251
- Technical Doc Creator222
- Ensemble Solving219
- Project Bootstrapper213
- Code Transfer174
- Flowchart Creator767
- Codebase Documenter597
- Architecture Diagram Creator547
- File Operations419
- Git Pushing413
- Test Fixing389
- Code Auditor345
- Dashboard Creator339
- Timeline Creator339
Similar to Code Refactor
More Code Review & Qualityrefactorgithub/awesome-copilot22.8K installsSurgical refactoring that improves maintainability in small steps while preserving existing behavior.
Refactor Safelytirth8205/code-review-graph1.2K installsPlans refactors from the dependency graph and applies renames only after previewing the edit list.
review-and-refactorgithub/awesome-copilot11.1K installsReviews code against project instructions in .github/ and refactors it while keeping existing files intact.
ast-grep-findparcadei/continuous-claude-v3524 installsAST-based code search and refactoring that matches syntax rather than raw text, with dry-run previews.