refactor

refactor is a skill for Claude Code from Pharaoh-so/pharaoh-mcp. It costs 68 tokens per session (431 once invoked), scanned A, original, MIT.

A safe refactoring workflow that maps a function or module's callers, affected code, naming conflicts, unreachable paths, and related tests before changes are proposed.

In plain words
What is it for?
It helps plan changes to functions, modules, shared utilities, and exported code when the list of affected callers is unclear.
Why use it?
It makes the wider impact of changing shared code visible before edits begin.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the pharaoh plugin — 8 skills, 2 commands, 1 hook, 1 MCP server shipped together

Good fit It helps plan changes to functions, modules, shared utilities, and exported code when the list of affected callers is unclear.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pharaoh-so/pharaoh-mcp/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 Pharaoh-so/pharaoh-mcp --skill refactor
Clone the repo
git clone --depth 1 https://github.com/Pharaoh-so/pharaoh-mcp

Made for: Claude Code.

Or install pharaoh, the plugin that ships this one along with the rest of its 8 skills, 2 commands, 1 hook, 1 MCP server.

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 refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/pharaoh-so/pharaoh-mcp/refactor/github.svg)](https://agentmods.dev/skills/pharaoh-so/pharaoh-mcp/refactor)
Your own site
<a href="https://agentmods.dev/skills/pharaoh-so/pharaoh-mcp/refactor"><img src="https://agentmods.dev/badge/skills/pharaoh-so/pharaoh-mcp/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 refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/pharaoh-so/pharaoh-mcp/refactor"><img src="https://agentmods.dev/badge/skills/pharaoh-so/pharaoh-mcp/refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 431 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.
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.00068 $0.00431
Opus 5.5 $0.00027 $0.00172
Sonnet 5.5 $0.00014 $0.00086
Haiku 4.5 $0.00007 $0.00043

Measured 9d ago against content hash 091ccfbf43cc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 9d 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.

skills/refactor/SKILL.md · 35 lines

What it actually says

Safe Refactor

Step-by-step workflow to safely refactor a function or module with full blast radius awareness. Uses safe-refactor — a 6-step process that maps every caller, identifies affected tests, flags unreachable code, and warns about high-risk downstream paths before a single line changes.

When to Use

Invoke before refactoring any function, module, or file — especially shared utilities, exports used across multiple modules, or anything with an unclear caller graph. Use it whenever the blast radius of a change is unknown.

Workflow

  1. Call get_module_context for the module containing the target to understand its current structure.
  2. Call get_blast_radius for the target to identify all downstream callers and affected modules.
  3. Call search_functions to check if the refactored version's name already exists elsewhere.

Do not propose a refactoring plan until all 3 steps are complete.

Output

A refactoring plan containing:

  • Callers to update: every function and file that calls the target, with update requirements
  • Tests to change: test files covering the refactored code, with required modifications
  • Dead code: unreachable code paths that can be deleted during the refactor
  • High-risk paths: downstream modules with wide blast radius or high complexity scores
  • Naming conflicts: existing functions whose names would conflict with the refactored version
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. 9d ago First seen · 35 lines · 68 tokens per session scan A 091ccfbf43cc

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository Pharaoh-so/pharaoh-mcp (2 stars, last pushed today), licensed MIT. It adds 68 tokens to every session and 431 once invoked, about $0.0003 per session on Opus 5.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-10-21.

Related

Other skills, from other repositories

codespaces

Build and query architecture-aware code search, dependency graphs, call flows, impact analysis, and belief maps for Python, TypeScript, TSX, Rust, C#, Java, Go, Ruby, and Ruby on Rails repositories. Use before non-trivial code changes to find module boundaries, blast radius, architecture violations, and the minimal…

diskd-ai/codespaces · 74 tokens

codebase-intelligence

Query the codebase-intelligence CLI to understand TypeScript architecture, dependencies, blast radius, and risk before reading files. Use for any "how is this structured", "what breaks if I change X", "where is the complexity" question.

bntvllnt/codebase-intelligence · 54 tokens

dotnet-analyzer-code-quality

Detect code quality issues, architecture rule violations, code smells, technical debt, dead code, and performance problems in .NET projects using Roslyn-powered MCP tools. Use when the user asks to check code quality, detect code smells, measure technical debt, generate quality reports, check architecture rules, find…

CartapenaBark/DotNetAnalyzer · 242 tokens

code-quality-principles

Applies KISS, YAGNI, and SOLID principles for clean code with reduced complexity. Use when refactoring or reviewing code for over-engineering.

athola/claude-night-market · 38 tokens

plugin-review

Review plugin quality with tiered checks and dependency scoping. Use for PR and pre-release audits.

athola/claude-night-market · 23 tokens

improve-codebase-architecture

Review module boundaries, interface depth and high-leverage refactors with evidence.

seaworld008/Commonly-used-high-value-skills · 22 tokens