Agent skill · Backend & API

code-refactor

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.

mhattingpetegithub.com/mhattingpeteGitHub ↗
claude-codeApache-2.0
Install
npx skills add mhattingpete/claude-skills-marketplace --skill code-refactor --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 3 KB
Bundled scripts: none
Path: code-operations-plugin/skills/code-refactor/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 656
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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_

What's inside
Steps it walks through
  1. Mode Selection
  2. When to Use
  3. Core Workflow (Native Mode)
  4. 1. Find All Occurrences
  5. 2. Replace All Instances
  6. 3. Verify Changes
  7. Workflow Examples
  8. Rename Function
  9. Replace Deprecated Pattern
  10. Update API Calls
  11. Best Practices
  12. Tool Reference
  13. Integration
More from claude-skills-marketplace
All skills →
About this skill
What does the code-refactor skill do?

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.

How do I install it?

Run `npx skills add mhattingpete/claude-skills-marketplace --skill code-refactor --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From mhattingpete/claude-skills-marketplace, a repository with 656 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going