refactor

Coordinate high-risk refactors through investigation, planning, and atomic execution phases.

19|31|Updated May 29, 2025
One-click install
npx skills add https://github.com/grafana/grafana-pathfinder-app --skill refactor-grafana
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/grafana/grafana-pathfinder-app/tree/main/.cursor/skills/refactor
Command: npx skills add https://github.com/grafana/grafana-pathfinder-app --skill refactor-grafana

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Execute high-risk refactors orchestrated through three independently-callable commands. All guideline content lives in the High-Risk Refactor Guidelines wiki — this skill references it live; no content is duplicated here.

Core Features & Use Cases

  • Independent commands: /refactor-investigate, /refactor-plan, /refactor-execute, each capable of running in isolation.
  • Wiki-guided guidelines and SUBAGENTS prompts to drive discovery, risk assessment, and extraction planning.
  • Worktree-based isolation, staged instrumentation, and per-phase artifacts (INVESTIGATION.md, PLAN.md, LOG.md) to manage complex refactors safely.

Quick Start

Start with /refactor-investigate <target> to surface INVESTIGATION.md, then proceed with /refactor-plan and /refactor-execute to complete the refactor in controlled phases.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I safely refactor large, intertwined code components?

To decompose singletons safely, use a structured workflow with investigation, planning, and atomic execution phases. This isolates changes in a worktree and generates artifacts to manage the extraction safely.

What is the best way to extract code from a monolith without breaking existing functionality?

The best way to extract code from a monolith is through a guided workflow using subagents and worktree isolation. It relies on wiki-guided guidelines, staged instrumentation, and rigorous testing to ensure safe extraction and traceable changes.

How do I split complex hooks in my codebase?

To split complex hooks, start with an investigation command to surface dependencies and risks into an INVESTIGATION.md file. Then proceed with dedicated planning and execution commands to complete the refactor in controlled phases.

Can I run individual phases of a code migration independently?

Yes, you can run individual phases of a code migration independently. The workflow provides three distinct commands for investigation, planning, and execution, each capable of running in isolation to support flexible risk management.

When should I use a worktree-based isolation workflow for restructuring code?

Use worktree-based isolation when restructuring intertwined code or decomposing singletons where the risk of breaking functionality is high. It provides staged instrumentation and rigorous testing to ensure safe extraction and traceable changes.