quality-refactor

Analyze code issues, plan ordered refactor tasks, and apply test-verified changes.

511|63|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/catlog22/Maestro-Flow --skill quality-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: quality-refactor
Source: https://github.com/catlog22/Maestro-Flow/tree/main/.codex/skills/quality-refactor
Command: npx skills add https://github.com/catlog22/Maestro-Flow --skill quality-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reduces technical debt by systematically discovering, planning, and applying safe refactors while ensuring zero-regression through automated test verification and controlled retries.

Core Features & Use Cases

  • Scope analysis: Scan a module path, feature area, or entire codebase to identify duplication, complexity, naming, dependency, dead code, and pattern violations.
  • Plan-driven tasks: Generate a structured plan and per-task JSON artifacts with read-first files, convergence criteria, verification commands, and risk ordering.
  • Safe execution loop: Execute refactors via synchronous agent runs, run the test suite after each change, revert on failures, retry with adjusted strategy, and record reflections and summaries.
  • Use Case: Incrementally reduce tech debt in a legacy authentication module by producing discrete, test-verified tasks that can be audited, reverted, and improved across multiple iterations.

Quick Start

Run the quality-refactor skill with a scope (for example src/auth or all) and optional flags such as --max-iterations N to start an iterative, test-verified refactor.

Frequently Asked Questions about quality-refactor

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

FAQPage Schema
How do I refactor a legacy codebase safely without breaking existing tests?

To reduce technical debt safely, this skill iteratively identifies and applies refactors while running the test suite after each change to verify zero-regression. It reverts failing changes automatically, retries with adjusted strategies, and records reflections to ensure the codebase remains stable throughout the process.

What's the best way to plan and execute incremental refactoring tasks for technical debt?

The best way to reduce technical debt is generating a structured plan with ordered, risk-prioritized refactor tasks. This skill scans the codebase to create JSON artifacts containing read-first files, convergence criteria, and verification commands, then executes changes incrementally via synchronous agent-driven edits with test verification.

Can I run automated refactoring on a specific module or feature area instead of the whole project?

Yes, you can apply this refactoring skill to a specific module path, feature area, or the entire codebase. By providing a scope parameter, the skill analyzes the targeted boundary for duplication, complexity, and dead code, generating discrete, test-verified tasks that can be audited and reverted incrementally.

How does automated test verification work when applying code refactors?

Automated test verification runs the project's test suite immediately after each synchronous agent-driven edit. If tests fail, the change is automatically reverted to maintain zero-regression, and the system retries the refactor with an adjusted strategy while recording a reflection log and summary.

What types of code issues can an automated refactor agent detect and fix?

An automated refactor agent can detect and fix duplication, complexity, naming violations, dependency issues, dead code, and pattern violations. It scans the specified scope, creates ordered tasks to address these technical debt areas, and applies changes incrementally with test verification and controlled reverts.

What happens if an automated refactor causes a test failure?

If an automated refactor causes a test failure, the change is automatically reverted to ensure zero-regression. The system then retries the refactor with an adjusted strategy and records a reflection log and summary documenting the failure and the new approach for future iterations.