refactor-workflow

Orchestrate symbol-aware refactors with linter and test verification.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/softmg/product-tracker --skill refactor-workflow-softmg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-workflow
Source: https://github.com/softmg/product-tracker/tree/main/.cursor/skills/refactor-workflow
Command: npx skills add https://github.com/softmg/product-tracker --skill refactor-workflow-softmg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a guarded, repeatable orchestration for performing structural code refactors without introducing regressions by enforcing analysis, test verification, and documentation as part of each session.

Core Features & Use Cases

  • Scoped analysis by a senior reviewer: identify code smells, priorities, and dependencies before any edits.
  • Symbol-aware refactors with Serena tools: prefer symbol-scoped renames, safe deletes, and referencing checks to avoid breakage.
  • Verification and retry logic: run linters and tests after each change, call debugger to fix import/symbol issues, and allow up to three retries per stage.
  • Documentation and reporting: generate a concise refactoring report summarizing changes, metrics, and remaining issues.
  • Use Case: Trigger a focused refactor for a single file or small module discovered during code review, ensuring tests exist, applying small incremental edits, and verifying all tests pass.

Quick Start

Perform a safe refactor on src/services/auth.ts: analyze scope, apply prioritized symbol-scoped refactors, run linters and the related tests after each change, and produce a summary report when complete.

Frequently Asked Questions about refactor-workflow

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

FAQPage Schema
How do I safely refactor code without breaking existing tests?

Safe refactoring requires a test-first workflow that analyzes code scope, applies symbol-aware edits using Serena tools, and verifies linters with test suites after each change. This orchestration enforces test presence preconditions and supports up to three retries per stage to prevent regressions.

What is symbol-aware refactoring and when do I need it?

Symbol-aware refactoring uses Serena tools to perform symbol-scoped renames, safe deletes, and referencing checks to avoid breakage. You need it during structural code changes in single files or small modules to ensure dependencies are safely updated without introducing import issues.

How to automate a test-first refactoring workflow for a single module?

Automate module refactoring by triggering a scoped analysis to identify code smells and priorities, applying incremental symbol-aware edits, and running linters with related tests after each change. The workflow calls a debugger to fix import issues and generates a concise summary report upon completion.

Can I use Serena tools for structural code edits in a multi-module project?

Yes, Serena tools support safe structural edits for small multi-module refactors. The workflow orchestrates symbol-aware refactors by checking references and applying scoped changes, verifying with linters and test suites before producing final documentation.

What happens if linters or tests fail during an automated refactor?

If linters or tests fail during a refactor, the workflow calls a debugger to fix import or symbol issues and allows up to three retries per stage. This retry logic ensures regressions are caught and resolved before proceeding to the next refactoring step.