refactor-safely

refactor-safely is a skill for Claude Code, Codex from tirth8205/code-review-graph. It costs 15 tokens per session (315 once invoked), scanned A, original, MIT.

A refactoring guide that uses relationships between code elements to suggest, preview, and apply changes safely.

In plain words
What is it for?
It is for finding unused code, suggesting refactors, previewing renames, checking affected code paths, and identifying large functions that may need to be split.
Why use it?
It helps show what a rename or other restructuring could affect before edits are made, reducing the chance of breaking dependent code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for finding unused code, suggesting refactors, previewing renames, checking affected code paths, and identifying large functions that may need to be split.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tirth8205/code-review-graph/refactor-safely
About the project

code-review-graph is a local-first code intelligence graph that builds a persistent structural map of a codebase and supplies relevant context to AI coding tools through MCP and a CLI. It is used for code review and large-repository workflows, with catalogue add-ons providing integrations and instructions for operating it.

tirth8205/code-review-graph · 32,175 stars · on GitHub · code-review-graph.com

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 tirth8205/code-review-graph --skill refactor-safely
Clone the repo
git clone --depth 1 https://github.com/tirth8205/code-review-graph

Made for: Claude Code, Codex.

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-safely

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/tirth8205/code-review-graph/refactor-safely"><img src="https://agentmods.dev/badge/skills/tirth8205/code-review-graph/refactor-safely.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 315 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
  • Socket pass 16 Sept 2026
  • Snyk pass 16 Sept 2026
  • 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.00015 $0.00315
Opus 5.5 $0.00006 $0.00126
Sonnet 5.5 $0.00003 $0.00063
Haiku 4.5 $0.00002 $0.00032

Measured 1mo ago against content hash 4b8aeb462113, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-safely 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 1mo 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-safely/SKILL.md · 25 lines

What it actually says

Refactor Safely

Plan a refactor from the dependency graph and apply renames from a preview.

Steps

  1. Call refactor_tool with mode="suggest" for refactoring candidates, or mode="dead_code" for unreferenced code.
  2. For a rename, call refactor_tool with mode="rename", old_name and new_name. Check the returned edit list before applying.
  3. Call apply_refactor_tool with the returned refactor_id to apply the rename.
  4. Before a large refactor, call get_impact_radius_tool and get_affected_flows_tool to see the dependents and critical paths involved.
  5. Call find_large_functions_tool to find functions worth splitting.
  6. After the change, call detect_changes_tool to confirm the impact matches the plan.

Token Efficiency Rules

  • Call get_minimal_context_tool(task="<your task>") before any other graph tool.
  • Pass detail_level="minimal" wherever a tool accepts it. Use "standard" only when minimal is not enough.
  • Prefer a targeted query_graph_tool call over a broad listing call.
  • Budget: about five tool calls and 800 tokens of graph output per task.
  • Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
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. 1mo ago Changed · -5 lines 4b8aeb462113
  2. 1mo ago First seen · 30 lines · 15 tokens per session scan A 95e60c797d62

Subscribe to this mod's changes

refactor-safely is a skill published in the GitHub repository tirth8205/code-review-graph (32,175 stars, last pushed today), licensed MIT. It adds 15 tokens to every session and 315 once invoked, about $0.0001 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-08-30.

Related

Other skills, from other repositories

go-testing

Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.

Gentleman-Programming/gentle-ai · 26 tokens

find-simplifications

Use for a periodic repo-wide sweep of qwen-code for accumulated excess surface — dead components and files, orphaned locale keys, exports nothing consumes, added-then-removed scaffolding — filing candidates on a tracking issue and landing only what a maintainer has said yes to. Repo-wide and evidence-first; every…

QwenLM/qwen-code · 103 tokens

cross-model-review

A second-opinion code review that asks a different AI model to independently inspect a change, then compares both reviews. It focuses on logic, security, consistency, and omissions.

hashgraph-online/awesome-codex-plugins · 56 tokens

gitnexus

A code-graph analysis add-on for examining an existing codebase, including symbols, call paths, execution flows, and effects across repositories. It can query GitNexus through its command-line or MCP interfaces.

hashgraph-online/awesome-codex-plugins · 58 tokens

swarm-pr-review

Run a graph-guided, tool-augmented PR review using context packing, parallel exploration, mandatory repository-agnostic risk-family coverage with dispatch scaled to diff size and risk, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive…

ZaxbyHub/opencode-swarm · 91 tokens

pre-landing-review

Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by OpenBitFun's unified Review mechanism instead.…

GCWing/BitFun · 75 tokens