refactor-safely

Plan and execute code refactoring using dependency graph analysis and impact previews.

25|4|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/thangchung/agent-engineering-experiment --skill refactor-safely-thangchung
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: refactor-safely
Source: https://github.com/thangchung/agent-engineering-experiment/tree/main/agentgateway-entraid-obo/.claude/skills/refactor-safely
Command: npx skills add https://github.com/thangchung/agent-engineering-experiment --skill refactor-safely-thangchung

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Refactoring code without understanding dependencies risks breaking critical paths and leaving dead code behind. This Skill uses a knowledge graph to analyze impact before changes are applied, so renames and restructuring happen with full visibility into affected locations. ## Core Features & Use Cases - Refactoring Suggestions: Use community-driven analysis to identify refactoring opportunities and dead code. - Safe Renames: Preview every affected location before applying a rename, then apply it via a refactor ID. - Impact Verification: Check impact radius and affected flows after changes to confirm no critical paths broke. - Use Case: Before renaming a core service class, preview all call sites, apply the rename, then run change detection to verify nothing downstream was missed. ## Quick Start Ask the assistant to safely rename a function across the codebase and verify the impact of the change.

Frequently Asked Questions about refactor-safely

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely rename a function across a codebase?▼

Use the rename mode to preview every affected location as an edit list before applying anything. Once reviewed, apply the rename with the returned refactor ID, then run change detection to verify the impact.

How to find dead code in a project?▼

Run the refactor tool in dead_code mode to locate unreferenced code using the dependency graph. This identifies functions and modules nothing calls, making them safe removal candidates.

How do I check what breaks before a major refactor?▼

Check the impact radius and affected flows before making changes. These graph queries show which critical paths depend on the code you plan to modify, so you can assess risk upfront.

Why should refactoring start with minimal context retrieval?▼

Starting with minimal context keeps token usage low and tool calls focused. The workflow targets completing review or refactor tasks in five or fewer tool calls, escalating detail only when the minimal level is insufficient.

When should large functions be decomposed during refactoring?▼

Decompose when a function grows too large to reason about safely. Use the large-function finder to identify decomposition targets, then preview and apply changes with impact verification after each step.