code-refactor
Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls.
Skill by mhattingpete
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mhattingpete-code-refactor
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/code-refactor
What's inside
- Skill name
code-refactor- Description
- Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls. Use when users request renaming identifiers, replacing deprecated code patterns, updating method calls, or making consistent changes across multiple locations.
- License
- Apache-2.0
- Instructions
- 109 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# 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-execution` skill
**Execution example (50 files):**
```python
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
)
```
### 3. Verify Changes
```
Grep(pattern="getUserData", output_mode="files_with_matches") # Should return none
```
## Workflow Examples
### Rename Function
1. Find: `Grep(pattern="getUserData", output_mode="files_with_matches")`
2. Count: "Found 15 occurrences in 5 files"
3. Replace in each file with `replace_all=true`
4. Verify: Re-run Grep
5. Suggest: Run tests
### Replace Deprecated Pattern
1. Find: `Grep(pattern="\\bvar\\s+\\w+", output_mode="content", -n=true)`
2. Analyze: Check if reassigned (let) or constant (const)
3. Replace: `Edit(old_string="var count = 0", new_string="let count = 0")`
4. Verify: `npm run lint`
### Update API Calls
1. Find: `Grep(pattern="/api/auth/login", output_mode="content", -n=true)`
2. Replace: `Edit(old_string="'/api/auth/login'", new_string="'/api/v2/authentication/login'", replace_all=true)`
3. Test: Recommend integration tests
## Best Practices
**Planning:**
- Find all instances first
- Review context of each match
- Inform user of scope
- Consider edge cases (strings, comments)
**Safe Process:**
1. Search → Find all
2. Analyze → Verify appropriate
3. Inform → Tell user scope
4. Execute → Make changes
5. Verify → Confirm applied
6. Test → Suggest running tests
**Edge Cases:**
- Strings/comments: Ask if should update
- Exported APIs: Warn of breaking changes
- Case sensitivity: Be explicit
## Tool Reference
**Edit with replace_all:**
- `replace_all=true`: Replace all occurrences
- `replace_all=false`: Replace only first (or fail if multiple)
- Must match EXACTLY (whitespace, quotes)
**Grep patterns:**
- `-n=true`: Show line numbers
- `-B=N, -A=N`: Context lines
- `-i=true`: Case-insensitive
- `type="py"`: Filter by file type
## Integration
- **test-fixing**: Fix broken tests after refactoring
- **code-transfer**: Move refactored code
- **feature-planning**: Plan large refactoringsFrom mhattingpete/claude-skills-marketplace, Apache-2.0.
More from mhattingpete/claude-skills-marketplace
- 0.640score
dashboard-creator
mhattingpete
Create HTML dashboards with KPI metric cards, bar/pie/line charts, progress indicators, and data visualizations.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
technical-doc-creator
mhattingpete
Create HTML technical documentation with code blocks, API workflows, system architecture diagrams, and syntax highlighting.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
timeline-creator
mhattingpete
Create HTML timelines and project roadmaps with Gantt charts, milestones, phase groupings, and progress indicators.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
code-transfer
mhattingpete
Transfer code between files with line-based precision.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
flowchart-creator
mhattingpete
Create HTML flowcharts and process diagrams with decision trees, color-coded stages, arrows, and swimlanes.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
feature-planning
mhattingpete
Break down feature requests into detailed, implementable plans with clear tasks.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
git-pushing
mhattingpete
Stage, commit, and push git changes with conventional commit messages.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
conversation-analyzer
mhattingpete
Analyzes your Claude Code conversation history to identify patterns, common mistakes, and opportunities for workflow improvement.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
architecture-diagram-creator
mhattingpete
Create comprehensive HTML architecture diagrams showing data flows, business objectives, features, technical architecture, and deployment.
SkillDFreshness: D★ 688Claude Code +9 - 0.637score
ensemble-solving
mhattingpete
Generate multiple diverse solutions in parallel and select the best.
SkillDFreshness: D★ 688Claude Code +9 - 0.634score
project-bootstrapper
mhattingpete
Sets up new projects or improves existing projects with development best practices, tooling, documentation, and workflow automation.
SkillDFreshness: D★ 688Claude Code +9 - 0.634score
code-execution
mhattingpete
Execute Python code locally with marketplace API access for 90%+ token savings on bulk operations.
SkillDFreshness: D★ 688Claude Code +9
Signals
- Stars
- 688
- Forks
- 98
- Open issues
- 4
- Last commit (this folder)
- Nov 10, 2025 (11 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from mhattingpete
- 0.640score
architecture-diagram-creator
mhattingpete
Create comprehensive HTML architecture diagrams showing data flows, business objectives, features, technical architecture, and deployment.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
conversation-analyzer
mhattingpete
Analyzes your Claude Code conversation history to identify patterns, common mistakes, and opportunities for workflow improvement.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
code-transfer
mhattingpete
Transfer code between files with line-based precision.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
git-pushing
mhattingpete
Stage, commit, and push git changes with conventional commit messages.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
feature-planning
mhattingpete
Break down feature requests into detailed, implementable plans with clear tasks.
SkillDFreshness: D★ 688Claude Code +9 - 0.640score
dashboard-creator
mhattingpete
Create HTML dashboards with KPI metric cards, bar/pie/line charts, progress indicators, and data visualizations.
SkillDFreshness: D★ 688Claude Code +9
Cite this page
code-refactor skill. Agent Mart. https://agentmart.dev/skills/mhattingpete-code-refactor (last updated 2026-10-24)