refactor-check

refactor-check is a skill for Claude Code, Codex from n24q02m/better-code-review-graph. It costs 24 tokens per session (977 once invoked), scanned A, original, Apache-2.0.

A pre-change safety check for refactoring, meaning restructuring code without intentionally changing its behavior. It examines dependencies, tests, public interfaces, and the likely blast radius—the parts of the system a change could affect.

In plain words
What is it for?
Use it before renaming symbols, changing interfaces, or reorganizing code to see what depends on the target and whether tests cover it.
Why use it?
It helps identify breakage risks before code is changed. The result includes a safety verdict and ways to reduce the risks found.

Skill for Claude CodeCodex

Part of the better-code-review-graph plugin — 7 skills, 3 hooks, 1 MCP server shipped together

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.

agentmods
npx agentmods add skills/n24q02m/better-code-review-graph/refactor-check
Any agent
npx skills add n24q02m/better-code-review-graph --skill refactor-check
Clone the repo
git clone --depth 1 https://github.com/n24q02m/better-code-review-graph

Made for: Claude Code, Codex.

Or install better-code-review-graph, the plugin that ships this one along with the rest of its 7 skills, 3 hooks, 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-check

README.md
[![agentmods](https://agentmods.dev/badge/skills/n24q02m/better-code-review-graph/refactor-check.svg)](https://agentmods.dev/skills/n24q02m/better-code-review-graph/refactor-check)
Your own site
<a href="https://agentmods.dev/skills/n24q02m/better-code-review-graph/refactor-check"><img src="https://agentmods.dev/badge/skills/n24q02m/better-code-review-graph/refactor-check.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 977 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00024 $0.00977
Opus 5 $0.00012 $0.00489
Sonnet 5 $0.00005 $0.00195
Haiku 4.5 $0.00002 $0.00098

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

Security

Grade A, and why

refactor-check 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 6d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/refactor-check/SKILL.md · 100 lines

How it starts

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

Refactor Check

Analyze whether a refactoring is safe BEFORE making changes. Produces a verdict with specific risks and mitigation steps.

Command surface: run the local CLI through the coding harness shell. Examples use the installed better-code-review-graph command; from a source checkout, prefix it with uv run. No MCP mapping is required.

Steps

  1. Get the full dependency graph for the target:

    • better-code-review-graph graph build --base HEAD --repo-root "<path>" to index current working changes
    • better-code-review-graph query query --pattern callers_of --target "<name>" --repo-root "<path>" -- who calls this
    • use --pattern callees_of to see what this calls
    • use --pattern imports_of to see what this imports
    • If it is a class, also query --pattern inheritors_of and --pattern children_of
  2. Identify test coverage:

    • better-code-review-graph query query --pattern tests_for --target "<name>" --repo-root "<path>" -- direct tests
    • For each caller, also query tests_for to see if callers have integration tests covering this function indirectly
    • Record: number of direct tests, number of callers with tests, number of callers without tests
  3. Flag public API exposure:

    • Check if the target is exported from a package __init__.py, index.ts, or similar
    • Check if the target is referenced from outside its own module/package
    • Check if the target appears in documentation or type stubs
    • Public API = any function/class importable by external consumers
  4. Estimate blast radius:

    • better-code-review-graph query impact --changed-files "<target-file>" --repo-root "<path>" -- file-level impact analysis around the target
    • Count: total impacted files, total impacted functions, depth of dependency chain
    • Identify any impacted files outside the immediate package/module
  5. Produce verdict:

    ## Refactor Safety: <name>
    
    ### Target
    - **Location**: <file_path>:<line>
    - **Type**: function / class / method
    - **Public API**: Yes / No
    
    ### Dependency Summary
    - **Callers**: N functions depend on this
    - **Callees**: Calls M other functions
    - **Inheritance**: N subclasses (if class)
    
    ### Test Coverage
    - **Direct tests**: N tests
    - **Caller tests**: M/K callers have tests covering this path
    - **Coverage gaps**: <list uncovered callers>
    
    ### Blast Radius
    - **Impacted files**: N
    - **Impacted functions**: M
    - **Max depth**: K hops
    
    ### Verdict: SAFE / NEEDS MIGRATION / DANGEROUS
    
    **SAFE** -- Low blast radius (<5 files), good test coverage, no public API exposure.
    Make the change, run tests, done.
    
    **NEEDS MIGRATION** -- Public API or moderate blast radius (5-15 files).
    Recommended approach:
    1. Create new version alongside old
    2. Migrate callers incrementally
    3. Deprecate old version
    4. Remove after all callers migrated
    
    **DANGEROUS** -- High blast radius (>15 files), poor test coverage, or public API with external consumers.
    Specific risks:
    - <risk 1 with affected files>
    - <risk 2 with affected files>
    Mitigation: <steps to reduce risk before proceeding>
    

Read the full file on GitHub · 100 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. 6d ago First seen · 100 lines · 24 tokens per session scan A d12ca0aef337

Subscribe to this mod's changes

refactor-check is a skill published in the GitHub repository n24q02m/better-code-review-graph (67 stars, last pushed today), licensed Apache-2.0. It adds 24 tokens to every session and 977 once invoked, about $0.0001 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

ui-styling

Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns…

nextlevelbuilder/ui-ux-pro-max-skill · 90 tokens

brand

Brand voice, visual identity, messaging frameworks, asset management, brand consistency. Activate for branded content, tone of voice, marketing assets, brand compliance, style guides.

nextlevelbuilder/ui-ux-pro-max-skill · 35 tokens

slides

Create strategic HTML presentations with Chart.js, design tokens, responsive layouts, copywriting formulas, and contextual slide strategies.

nextlevelbuilder/ui-ux-pro-max-skill · 25 tokens

frontend-blueprint

AI frontend specialist and design consultant that guides users through a structured discovery process before generating any code. Collects visual references, design tokens, typography, icons, layout preferences, and brand guidelines to ensure the final output matches the user's vision with high fidelity. Use when the…

tech-leads-club/agent-skills · 170 tokens

ai-cold-outreach

When the user wants to build an AI-powered outreach system, write cold emails, improve deliverability, or scale personalized outreach. Also use when the user mentions 'cold email,' 'cold outreach,' 'outreach automation,' 'Instantly,' 'Smartlead,' 'Clay,' 'email sequences,' 'deliverability,' 'personalization at scale,'…

tech-leads-club/agent-skills · 114 tokens

expansion-retention

When the user wants to reduce churn, build expansion revenue, automate customer success, or optimize net revenue retention. Also use when the user mentions 'churn,' 'retention,' 'expansion revenue,' 'upsell,' 'NRR,' 'net revenue retention,' 'customer success,' 'land and expand,' 'closed-lost,' or 'renewal.' This skill…

tech-leads-club/agent-skills · 107 tokens