code-refactor

code-refactor is a skill for Claude Code from mhattingpete/claude-skills-marketplace. It costs 51 tokens per session (879 once invoked), scanned A, original, Apache-2.0.

A tool for making the same code change across many files, such as renaming a function or replacing an old programming pattern.

In plain words
What is it for?
It helps rename variables and functions, replace patterns, update API calls, and check that old code no longer remains.
Why use it?
It reduces the risk and effort of repeating edits by hand in every affected file.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the code-operations-plugin plugin — 4 skills shipped together

Good fit It helps rename variables and functions, replace patterns, update API calls, and check that old code no longer remains.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mhattingpete/claude-skills-marketplace/code-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mhattingpete/claude-skills-marketplace --skill code-refactor
Clone the repo
git clone --depth 1 https://github.com/mhattingpete/claude-skills-marketplace

Made for: Claude Code.

Or install code-operations-plugin, the plugin that ships this one along with the rest of its 4 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for code-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/mhattingpete/claude-skills-marketplace/code-refactor/github.svg)](https://agentmods.dev/skills/mhattingpete/claude-skills-marketplace/code-refactor)
Your own site
<a href="https://agentmods.dev/skills/mhattingpete/claude-skills-marketplace/code-refactor"><img src="https://agentmods.dev/badge/skills/mhattingpete/claude-skills-marketplace/code-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/mhattingpete/claude-skills-marketplace/code-refactor"><img src="https://agentmods.dev/badge/skills/mhattingpete/claude-skills-marketplace/code-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 879 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.00879
Opus 5 $0.00026 $0.00439
Sonnet 5 $0.00010 $0.00176
Haiku 4.5 $0.00005 $0.00088

Measured 10d ago against content hash 14bce597a26c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

code-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

code-operations-plugin/skills/code-refactor/SKILL.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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
)

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

Read the full file on GitHub · 113 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 113 lines · 51 tokens per session scan A 14bce597a26c

Subscribe to this mod's changes

code-refactor is a skill published in the GitHub repository mhattingpete/claude-skills-marketplace (671 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 51 tokens to every session and 879 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

security-compliance

Guides security professionals in implementing defense-in-depth security architectures, achieving compliance with industry frameworks (SOC2, ISO27001, GDPR, HIPAA), conducting threat modeling and risk assessments, managing security operations and incident response, and embedding security throughout the SDLC.

sangrokjung/claude-forge · 56 tokens

stride-analysis-patterns

Apply STRIDE methodology to systematically identify threats. Use when analyzing system security, conducting threat modeling sessions, or creating security documentation.

sangrokjung/claude-forge · 30 tokens

review-loop

Run the adversarial verification loop — implement, then hand the change to a fresh checker that did not write it, fix what it finds, and re-dispatch until APPROVE. Use before claiming any behavioural change is done, and on requests like "review loop", "adversarial review", "independent review", "get this verified"…

sangrokjung/claude-forge · 100 tokens

prompts-chat

Use when searching, installing, or improving AI skills and prompts via prompts.chat or skills.sh. Triggers on skill search, prompt lookup, install skill, improve prompt, prompts.chat.

sangrokjung/claude-forge · 41 tokens

humanize-korean

A Korean editing tool that removes translation-like phrasing and common AI writing habits while preserving facts, numbers, names, and quotations. It is intended for existing Korean prose, not for writing new marketing copy.

sangrokjung/claude-forge · 145 tokens

continuous-learning-v2

Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

sangrokjung/claude-forge · 33 tokens