Agent skill

Trace-MCP Refactoring

by nikolai-vysotskyi in nikolai-vysotskyi/trace-mcp

Refactors code safely in projects indexed by trace-mcp: assess risk, find candidates, check impact and rename symbols across every file without missing a reference.

MITAuto-check passedDevelopment

Install Trace-MCP Refactoring

skills CLI
$ npx skills add nikolai-vysotskyi/trace-mcp --skill trace-mcp-refactoring -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nikolai-vysotskyi/trace-mcp trace-mcp-refactoring --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nikolai-vysotskyi/trace-mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/trace-mcp-refactoring .claude/skills/trace-mcp-refactoring && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
trace-mcp-refactoring
GitHub stars
189
Token cost
~672 tokens
SKILL.md length
263 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Refactors code safely in projects indexed by trace-mcp: assess risk, find candidates, check impact and rename symbols across every file without missing a reference.

  • Works in 4 steps: Assess before touching anything → Find what actually needs refactoring → Know what will break → …
  • Renaming a class, function, method, variable or file across a codebase
  • SKILL.md covers When to Use, Refactoring Workflow, Renaming a Symbol — MANDATORY… and Extracting a Function, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The skill sets an order of work for renaming, extracting, restructuring or changing signatures in a project indexed by trace-mcp. It starts with assess_change_risk, which rates a file or symbol by churn, complexity, fan-in and fan-out, and test coverage. Then get_refactor_candidates finds real targets instead of guesses, get_change_impact returns the reverse-dependency graph of files, symbols and tests, and get_complexity_report records a baseline.

Renames follow a mandatory flow: check_rename detects collisions first, and apply_rename updates the definition, imports, re-exports, call sites, JSX usages and tests in one atomic operation. Editing with replace_all is ruled out because it misses import sites and cross-file usages. Function extraction goes through extract_function so closure variables are handled. Afterward the agent reindexes with register_edit, re-checks complexity, finds and runs the affected tests with get_tests_for, and runs check_quality_gates scoped to the changed files.

When your agent uses it

  • Renaming a class, function, method, variable or file across a codebase
  • Extracting a function or splitting a module
  • Changing a signature that has more than one call site
  • Judging how risky a change is before touching it

Example prompts

  • “Rename the UserRecord class to Account everywhere and check for collisions first.”
  • “Which files will break if I change the signature of parseConfig?”
  • “Find the best refactoring candidates in src/ and extract the biggest function.”

Requirements

  • A project indexed by the trace-mcp MCP server

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Assess before touching anything
  2. Find what actually needs refactoring
  3. Know what will break
  4. Quantify complexity

What it can do on your machine

Read from SKILL.md and the folder at commit a577015. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Trace-MCP Refactoring loads about 672 tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 263 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~672

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nikolai-vysotskyi/trace-mcp at commit a577015, republished under its MIT licence (© nikolai-vysotskyi). 263 words, ~672 tokens.

Download SKILL.mdSave it as .claude/skills/trace-mcp-refactoring/SKILL.md (or your agent's skills folder).
name
trace-mcp-refactoring
description
Safe refactoring workflow using trace-mcp — assess risk, find candidates, check impact, and rename symbols across all files without missing import sites or cross-file references.

trace-mcp — Refactoring Workflow

Use this skill whenever you are about to rename, restructure, extract, or otherwise refactor code in a project indexed by trace-mcp. The goal is to never break cross-file references and never guess at what is affected.

When to Use

  • Renaming a class, function, method, variable, or file
  • Extracting a function or method
  • Restructuring a module or splitting a file
  • Changing a function signature
  • Any change that touches more than one call site

Refactoring Workflow

1. Assess before touching anything
assess_change_risk({ file_path: "src/foo.ts" })
# or
assess_change_risk({ symbol_id: "<id>" })

This returns the risk level of the target change based on churn, complexity, fan-in/fan-out, and test coverage. Use it to decide whether to proceed, add tests first, or split the change.

2. Find what actually needs refactoring
get_refactor_candidates()

Do not guess. This surfaces high-complexity, high-churn, and anti-pattern-laden symbols that are the real refactor targets.

3. Know what will break
get_change_impact({ symbol_id: "<id>" })

Returns the reverse-dependency graph: every file, symbol, and test that depends on the target. Review this list before editing.

4. Quantify complexity
get_complexity_report({ file_path: "src/foo.ts" })

Gives you a baseline so you can verify the refactor actually reduced complexity.

Renaming a Symbol — MANDATORY Flow

Never rename with Edit and replace_all. It silently misses import sites, re-exports, type references, and cross-file usages.

# 1. Collision detection first
check_rename({ symbol_id: "<id>", target_name: "newName" })

# 2. Apply rename across ALL files (definition + every reference)
apply_rename({ symbol_id: "<id>", new_name: "newName" })

apply_rename updates the definition, imports, re-exports, call sites, JSX usages, and tests in one atomic operation.

Extracting a Function

extract_function({
  file_path: "src/foo.ts",
  start_line: 42,
  end_line: 67,
  new_name: "computeTotals"
})

Let trace-mcp handle the variable capture analysis — manual extraction routinely misses closure variables.

After the Refactor

  1. register_edit on each edited file to reindex
  2. get_complexity_report again to confirm the reduction
  3. get_tests_for the changed symbols — run them
  4. check_quality_gates with scope: "changed" to verify no regressions

© nikolai-vysotskyi, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/trace-mcp-refactoring of nikolai-vysotskyi/trace-mcp.

Open the folder on GitHubat commit a577015

Compare with similar skills

Trace-MCP Refactoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Trace-MCP Refactoring compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Trace-MCP Refactoring this skillnikolai-vysotskyi/trace-mcp189—~672Automated safety check: PassMIT
Codehealth MCPaffaan-m/ECC277k1 repos~1.8kAutomated safety check: PassMIT
Graph-Guided Safe Refactoringtirth8205/code-review-graph32k1 repos~332Automated safety check: PassMIT
Roslynkmrpmorris/Roslynk1361 repos~3.8kAutomated safety check: PassMIT
Refactortermide/termide171—~2.8kAutomated safety check: PassMIT
Idea MCPdtprj/dongting208—~698Automated safety check: PassApache-2.0

Similar skills

  • Codehealth MCP

    affaan-m/ECC

    Real-time structural Code Health via CodeScene MCP — review before edits, verify score deltas after changes, gate commits and PRs.

    277k GitHub starsUsed in 1 repo~1.8k tokens
    DevelopmentAuto-check passed
  • Graph-Guided Safe Refactoring

    tirth8205/code-review-graph

    Plans a refactor from a code dependency graph, previews renames before applying them and checks that the final impact matches the plan.

    32k GitHub starsUsed in 1 repo~332 tokens
    DevelopmentAuto-check passed
  • Roslynk

    mrpmorris/Roslynk

    How to use the Roslynk MCP tools (mcproslynk) effectively for .NET work.

    136 GitHub starsUsed in 1 repo~3.8k tokens
    DevelopmentAuto-check passed
  • Refactor

    termide/termide

    Full-workspace code quality analysis and refactoring with validation

    171 GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Idea MCP

    dtprj/dongting

    IntelliJ IDEA MCP for Java code analysis, testing, refactoring, and project navigation.

    208 GitHub stars~698 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • MCP Refactoring

    adeze/raindrop-mcp

    Refactoring MCP Tools for Better LLM Integration and Usability

    188 GitHub stars~972 tokensUpdated 2 mo ago
    DevelopmentAuto-check passed

More from nikolai-vysotskyi/trace-mcp

  • Trace MCP

    nikolai-vysotskyi/trace-mcp

    Use trace-mcp tools for code navigation, impact analysis, and framework-aware queries instead of Read/Grep/Glob/Bash.

    189 GitHub stars~1.6k tokensUpdated today
    Auto-check: notes
  • trace-mcp Codemods

    nikolai-vysotskyi/trace-mcp

    Replaces repeated hand edits with the trace-mcp apply_codemod tool, previewing matches in a dry run before bulk mechanical changes across one file or many.

    189 GitHub stars~729 tokensUpdated today
    Auto-check passed
  • trace-mcp Pre-Commit Checks

    nikolai-vysotskyi/trace-mcp

    Runs trace-mcp security, quality-gate and antipattern checks before a commit or pull request, and builds a symbol-level diff for the PR description.

    189 GitHub stars~565 tokensUpdated today
    Auto-check passed
  • trace-mcp Code Navigation

    nikolai-vysotskyi/trace-mcp

    Routes code exploration through trace-mcp's indexed dependency graph, using symbol search, outlines, call graphs and change-impact tools instead of Read, Grep and Glob.

    189 GitHub stars~354 tokensUpdated today
    Auto-check passed

Categories

Questions about Trace-MCP Refactoring

What does Trace-MCP Refactoring do?

Refactors code safely in projects indexed by trace-mcp: assess risk, find candidates, check impact and rename symbols across every file without missing a reference. The skill sets an order of work for renaming, extracting, restructuring or changing signatures in a project indexed by trace-mcp. It starts with assess_change_risk, which rates a file or symbol by churn, complexity, fan-in and fan-out, and test coverage.

When should I use Trace-MCP Refactoring?

Trace-MCP Refactoring fits situations like: renaming a class, function, method, variable or file across a codebase; extracting a function or splitting a module; changing a signature that has more than one call site; judging how risky a change is before touching it.

How do I install Trace-MCP Refactoring in Claude Code?

Run `npx skills add nikolai-vysotskyi/trace-mcp --skill trace-mcp-refactoring -a claude-code`. Or copy the skill folder (skills/trace-mcp-refactoring in nikolai-vysotskyi/trace-mcp) into .claude/skills/trace-mcp-refactoring in your project. Claude Code loads it when a task matches its description.

How do I install Trace-MCP Refactoring in Codex?

Run `npx skills add nikolai-vysotskyi/trace-mcp --skill trace-mcp-refactoring -a codex`. Or copy the skill folder (skills/trace-mcp-refactoring in nikolai-vysotskyi/trace-mcp) into .agents/skills/trace-mcp-refactoring in your project. Codex loads it when a task matches its description.

Can I use Trace-MCP Refactoring in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nikolai-vysotskyi/trace-mcp --skill trace-mcp-refactoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/trace-mcp-refactoring, .gemini/skills/trace-mcp-refactoring, .github/skills/trace-mcp-refactoring and .opencode/skills/trace-mcp-refactoring in your project.

What does Trace-MCP Refactoring need to run?

SKILL.md names no scripts, command-line tools or credentials: Trace-MCP Refactoring is instructions for the agent only. Our summary lists: A project indexed by the trace-mcp MCP server.

Does Trace-MCP Refactoring access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Trace-MCP Refactoring safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Trace-MCP Refactoring use?

Trace-MCP Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Trace-MCP Refactoring use?

About 672 tokens (SKILL.md is roughly 2.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Trace-MCP Refactoring?

Skills that share tags, products or a category with Trace-MCP Refactoring: Codehealth MCP (affaan-m/ECC, 277k stars), Graph-Guided Safe Refactoring (tirth8205/code-review-graph, 32k stars), Roslynk (mrpmorris/Roslynk, 136 stars) and Refactor (termide/termide, 171 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Trace-MCP Refactoring?

nikolai-vysotskyi (a GitHub user) maintains it in nikolai-vysotskyi/trace-mcp, which has 189 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 11, 2026.

Source: nikolai-vysotskyi/trace-mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.