MCPInstall

refactor safely

Plan and execute safe refactoring using dependency analysis

Installs
1.1K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/tirth8205/code-review-graph --skill refactor-safely
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads refactor safely automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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.

FAQ

What does the refactor safely skill do?

Plan and execute safe refactoring using dependency analysis

How do I install refactor safely?

Run npx skills add https://github.com/tirth8205/code-review-graph --skill refactor-safely in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/refactor-safely/ (personal) or .claude/skills/refactor-safely/ (project).

Which AI agents can use refactor safely?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is refactor safely safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains refactor safely?

It is published by tirth8205 in tirth8205/code-review-graph. It has 1,100 recorded installs.

More from tirth8205/code-review-graph

View all →

build-graph

tirth8205/code-review-graph

Build or update the code review knowledge graph. Run this first to initialize, or let hooks keep it updated automatically.

review-delta

tirth8205/code-review-graph

Review only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.

review-pr

tirth8205/code-review-graph

Review a PR or branch diff using the knowledge graph for full structural context. Outputs a structured review with blast-radius analysis.

explore codebase

tirth8205/code-review-graph

Navigate and understand codebase structure using the knowledge graph

review changes

tirth8205/code-review-graph

Perform a structured code review using change detection and impact

debug issue

tirth8205/code-review-graph

Systematically debug issues using graph-powered code navigation

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.