This handles bulk refactoring operations like renaming variables or functions across your codebase. You grep for all occurrences, use the Edit tool with replace_all set to true, then verify nothing got missed. The smart part is that it automatically switches to execution mode when you're touching 10+ files, which saves about 90% of tokens compared to editing each file individually. Good for the obvious stuff like renaming identifiers or swapping deprecated API calls, though you still need to think about edge cases like whether to update strings and comments. It's basically a workflow wrapper around grep and replace that knows when to bail to Python for the heavy lifting.

skills.sh installs
301
GitHub stars
693
last updated
Aug 21, 2026

Install

$ npx -y skills add mhattingpete/claude-skills-marketplace --skill code-refactor --agent claude-code

Installs into .claude/skills of the current project.

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-execution skill

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
)

Sponsors

Details

Repository
github.com/mhattingpete/claude-skills-marketplace
Categories
Backend & APIs, Code Review & Quality
License
Apache-2.0
First seen
Jun 3, 2026

More from mhattingpete/claude-skills-marketplace

All 18
1pedronauck avatarhonopedronauck/skillsEfficiently develop Hono applications using Hono CLI. Supports documentation search, API reference lookup, request testing, and bundle optimization.297skills.sh installs
2cinience avataralicloud-compute-ecs-testcinience/alicloud-skillsMinimal smoke test for ECS skill. Validate auth, region reachability, and DescribeInstances query path.296skills.sh installs
3krutikjain avatarandroid-networking-retrofit-okhttpkrutikjain/android-agent-skillsBuild Android networking stacks with Retrofit, OkHttp, interceptors, API contracts, and resilient error handling.296skills.sh installs
4cinience avataralicloud-security-kms-testcinience/alicloud-skillsMinimal smoke test for KMS skill. Validate auth and read-only key listing path.295skills.sh installs
5cinience avataralicloud-observability-sls-log-query-testcinience/alicloud-skillsMinimal smoke test for SLS log query skill. Validate SDK auth and one bounded query.294skills.sh installs
6mvanhorn avatarpp-docker-hubmvanhorn/printing-press-libraryPrinting Press CLI for Docker Hub. Docker Hub public API. Search container images, browse tags, check sizes, inspect Dockerfiles, and explore the...292skills.sh installs