Quickstart: Refactor Plan
Scan a codebase for tech debt and produce a prioritized refactoring roadmap in seconds.
from workflows.refactor_plan import RefactorPlanWorkflow
workflow = RefactorPlanWorkflow()
result = workflow.execute(path="src/")
Result: A WorkflowResult containing a tech debt score, ranked refactoring opportunities with effort and risk estimates, and actionable next steps.
Steps
1. Run the workflow
Pass the path you want to analyze to execute():
from workflows.refactor_plan import RefactorPlanWorkflow
workflow = RefactorPlanWorkflow()
result = workflow.execute(path="src/")
Three subagents (debt-scanner, impact-analyzer, and plan-generator) run in sequence and synthesize their findings into a single report.
2. Format the output
Pass the result to format_refactor_plan_report() to render it as a human-readable report:
from workflows.refactor_plan_report import format_refactor_plan_report
report = format_refactor_plan_report(result=result.output, input_data={"path": "src/"})
print(report)
3. Read the report
The printed report contains three sections:
| Section | What it tells you |
|---|---|
| Summary | Overall tech debt score (0–100) and a 2–3 sentence executive summary |
| Refactoring | Prioritized opportunities, each with an effort estimate (small/medium/large) and risk level (low/medium/high) |
| Suggestions | Actionable next steps ordered by priority, from quick wins to longer-term improvements |
4. Run from the CLI
To analyze a path without writing any code, use the CLI entry point:
python -m workflows.refactor_plan_report
Next: Read the full concept — attune help-docs tool-refactor-plan — to understand how severity, effort, impact, and risk are weighted when the roadmap is prioritized.
Unresolved references
Auto-generated by attune-author fact-check. Review and either fix the source code, fix this doc, or add an override.
| Location | Severity | Issue |
|---|---|---|
| Line 15 (code fence) | error | from workflows.refactor_plan import … — module not importable |
| Line 45 (code fence) | error | from workflows.refactor_plan_report import … — module not importable |