Refactors code across files: renames variables/functions, replaces patterns, updates API calls. Uses Grep+Edit for 1-9 files; code-execution for 10+. Ideal for bulk consistent changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-operations-skills:code-refactorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic code refactoring across files. **Auto-switches to execution mode** for 10+ files (90% token savings).
Systematic code refactoring across files. Auto-switches to execution mode for 10+ files (90% token savings).
code-execution skillExecution 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
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
Edit(
file_path="src/api.js",
old_string="getUserData",
new_string="fetchUserData",
replace_all=true
)
Grep(pattern="getUserData", output_mode="files_with_matches") # Should return none
Grep(pattern="getUserData", output_mode="files_with_matches")replace_all=trueGrep(pattern="\\bvar\\s+\\w+", output_mode="content", -n=true)Edit(old_string="var count = 0", new_string="let count = 0")npm run lintGrep(pattern="/api/auth/login", output_mode="content", -n=true)Edit(old_string="'/api/auth/login'", new_string="'/api/v2/authentication/login'", replace_all=true)Planning:
Safe Process:
Edge Cases:
Edit with replace_all:
replace_all=true: Replace all occurrencesreplace_all=false: Replace only first (or fail if multiple)Grep patterns:
-n=true: Show line numbers-B=N, -A=N: Context lines-i=true: Case-insensitivetype="py": Filter by file typenpx claudepluginhub praneybehl/claude-skills-marketplace --plugin code-operations-skills4plugins reuse this skill
First indexed Jun 6, 2026
Performs batch find-and-replace using sd CLI (sed alternative) for variable renames, import updates, regex patterns, and string replacements across files with safe preview workflows.
Activates trace-mcp apply_codemod for any bulk mechanical change (regex replace, signature updates, import fixes) applied 2+ times across one or many files, instead of repeated Edit calls.
Automates refactoring of files, directories, semantic queries, or recent git changes using code-simplifier agent. Applies best practices and removes dead code in limited scopes.