Skip to content
Code Review
Skill

/refactor-safely

Plan and execute safe refactoring using dependency analysis

From plugin
code-review-graph
33k7 skills2 hooks1 MCP

Claude Code

$ npx -y skills add tirth8205/code-review-graph --skill refactor-safely --agent claude-code

SKILL.md

refactor-safely.SKILL.md
name: refactor-safely
description: Plan and execute safe refactoring using dependency analysis

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"` unless it is not enough. Minimal drops source, so leave `semantic_search_nodes_tool(include_source=True)` and `get_review_context_tool` at standard.
  • Prefer a targeted `query_graph_tool` call over a broad listing call.
  • Budget: about five tool calls per task. Source snippets stand in for file reads.
  • Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
Read more
@tirth8205
Ships withcode-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

33k7 skills1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
32.7k
Star history of tirth8205/code-review-graph on GitHub, a chart by star-history.com

Other skills on code-review-graph.

review-pr

review-pr

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

More skills from other plugins.

open-code-review

open-code-review

Performs AI-powered code review on Git changes using the `ocr` CLI from alibaba/open-code-review. Use when the user asks to…

@alibaba@alibabaInstall Skill
hunk-extensions

hunk-extensions

Maps the `hunkdiff/extension` authoring surface for Hunk, the terminal diff viewer — hiding or reordering reviewed files, docked…

hunk4d9.8k
@modem-dev@modem-devInstall Skill
install-anti-slop

install-anti-slop

Install, configure, update, or upgrade vendored anti-slop Oxlint plugins. Use when adding anti-slop, picking up upstream rules or…

anti-slop4w5.8k
@dmmulroy@dmmulroyInstall Skill

Questions about refactor-safely.

Which coding agents can use refactor-safely?
refactor-safely installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.