code-refactor

Solid

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.

Code & Development 593 stars 80 forks Updated 2 months ago Apache-2.0

Install

View on GitHub

Quality Score: 86/100

Stars 20%
92
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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. Su...

Details

Author
mhattingpete
Repository
mhattingpete/claude-skills-marketplace
Created
7 months ago
Last Updated
2 months ago
Language
HTML
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Listed

refactor

Safe, verified refactoring with regression testing at each step. Identify targets, plan transformation, execute incrementally. Triggers: "refactor", "restructure", "extract", "rename", "move", "simplify", "reduce complexity", "clean up", "decompose".

375 Updated today
boshu2
Code & Development Listed

refactor

Safe multi-file refactoring with automatic rollback. Establishes a type/test baseline, plans all changes, executes file-by-file, and verifies zero regressions. Reverts if verification fails after two fix attempts. Handles renames, extracts, moves, splits, merges, and inlines.

1 Updated today
allysgrandiose674
Code & Development Listed

refactor

Code refactoring workflow - analyze → plan → implement → review → validate

3,795 Updated 4 months ago
parcadei
AI & Automation Listed

refactor-master

Restructure messy code into smaller, more focused pieces — without changing observable behavior. Knows when to extract a function, split a module, replace a conditional with a strategy, pull pure logic out of side-effect-heavy code, and when to do nothing. Use when the user says "refactor this", "clean this up", "this file is too big", "split this module", "make this readable", or hands over a god-class and asks for a rescue plan.

0 Updated 3 days ago
ashishkumar14
AI & Automation Listed

refactor-master

Restructure messy code into smaller, more focused pieces — without changing observable behavior. Knows when to extract a function, split a module, replace a conditional with a strategy, pull pure logic out of side-effect-heavy code, and when to do nothing. Use when the user says "refactor this", "clean this up", "this file is too big", "split this module", "make this readable", or hands over a god-class and asks for a rescue plan.

0 Updated 3 days ago
ak-ship