refactor-agent

Detect architectural drift and complexity spikes from quality reports.

Updated Nov 25, 2025
One-click install
npx skills add https://github.com/NikhilVijayakumar/Yantra --skill refactor-agent-nikhilvijayakumar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor-agent
Source: https://github.com/NikhilVijayakumar/Yantra/tree/main/.agent/skills/refactor-agent
Command: npx skills add https://github.com/NikhilVijayakumar/Yantra --skill refactor-agent-nikhilvijayakumar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Identify and remediate architectural drift, complexity spikes, and dependency cycles using quality reports to guide safe refactors.

Core Features & Use Cases

  • Input Analysis: evaluates complexity (C901), circular dependencies, and type-safety issues from reports and recommends concrete file or class-level refactors.
  • Refactoring Rules: enforces SOLID, one file, one class, and avoids regressions by verifying behavior after changes.
  • Implementation & Verification: reads reports from .agent/reports, proposes clean architecture solutions, and applies changes only after user confirmation; includes a verification loop to ensure atomic structure, successful tests, and preserved traceability.

Quick Start

Review the latest quality reports in .agent/reports, outline a refactor plan that addresses complexity, dependencies, and type safety, and implement approved changes.

Frequently Asked Questions about refactor-agent

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

FAQPage Schema
How do I fix circular dependencies and SOLID violations in my codebase?

To fix circular dependencies and SOLID violations, you can use an agent that reads local quality reports to detect architectural drift, propose concrete refactors, and apply approved changes. This enforces clean architecture rules like one file per class while preserving behavior.

What is architectural drift and how do I detect it from quality reports?

Architectural drift is gradual structural degradation causing complexity spikes and dependency cycles. You detect it by evaluating local quality reports in .agent/reports to extract findings on complexity (C901) and type-safety issues, which then guide targeted refactoring proposals.

How do I refactor code with high complexity warnings like C901?

Refactor high C901 complexity warnings by feeding local quality reports into an analysis tool that proposes file or class-level refactors. The agent outlines a clean architecture solution, verifies atomic structure, and runs tests to prevent regressions after applying changes.

Do I need local quality reports to start fixing type-safety issues?

Yes, you need local quality reports. The agent requires reports stored in the .agent/reports directory to extract findings on type-safety issues, circular dependencies, and complexity before it can propose and apply safe refactoring changes to your codebase.

Can I review a refactoring plan before changes are applied to my code?

Yes, the agent proposes concrete file or class-level refactors and applies changes only after user confirmation. It includes a verification loop to ensure atomic structure, successful tests, and preserved traceability, preventing unreviewed modifications to your codebase.

What's the best way to resolve type-safety issues without causing regressions?

The best way to resolve type-safety issues without regressions is using a guided agent that verifies behavior after changes. It enforces SOLID principles, checks for atomic structure, and runs tests to ensure successful implementation while preserving traceability.