refactor-safety

Analyze TypeScript call chains, import cycles, and module boundaries to verify refactoring safety.

12|1|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/guyowen/typegraph-mcp --skill refactor-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-safety
Source: https://github.com/guyowen/typegraph-mcp/tree/main/skills/refactor-safety
Command: npx skills add https://github.com/guyowen/typegraph-mcp --skill refactor-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill provides a safety net for code refactoring, ensuring that changes like renaming, moving, or restructuring modules do not introduce unintended consequences or break existing functionality.

Core Features & Use Cases

  • Call Chain Tracing: Understand the full definition chain of a symbol to preserve indirection during refactors.
  • Circular Dependency Detection: Identify and alert on circular imports that could be affected by changes.
  • Module Boundary Analysis: Assess incoming and outgoing dependencies of modules to ensure connectivity is maintained.
  • Reference Verification: List all call sites that need updating after a refactor.
  • Use Case: Before moving a core service class, use this Skill to confirm that all its consumers are accounted for and that no circular dependencies are created or exacerbated.

Quick Start

Use the refactor-safety skill to check if moving the AuthService from packages/core to apps/gateway is safe.

Frequently Asked Questions about refactor-safety

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

FAQPage Schema
How do I check if refactoring TypeScript code is safe before moving modules?

To ensure refactoring safety in TypeScript, analyze call chains, import cycles, and module boundaries. This verifies that moving or renaming modules maintains connectivity and preserves existing functionality without unintended consequences.

What's the best way to trace call chains when restructuring TypeScript interfaces?

Tracing call chains during TypeScript refactoring involves mapping the full definition chain of a symbol. This preserves indirection and verifies that all reference call sites are identified for updating before changes are applied.

How do I detect circular dependencies that could break a TypeScript refactor?

Detecting circular dependencies during a TypeScript refactor requires analyzing import cycles. This identifies and alerts on circular imports that could be created or exacerbated by moving modules or changing interfaces.

Can I assess module boundaries to verify connectivity when moving a service class?

Yes, you can assess module boundaries by analyzing incoming and outgoing dependencies. This confirms all consumers are accounted for and connectivity is maintained when moving a core service class across packages.

Why do I need reference verification after renaming symbols in a TypeScript project?

Reference verification is needed after renaming symbols to list all call sites that require updating. This prevents broken imports and ensures the refactoring operation does not introduce unintended consequences across the codebase.