A prompt-only loop designed to iteratively improve code quality and maintainability until a specified quality gate passes. The agent analyzes the codebase, identifies quality issues, and applies targeted fixes to achieve an 'A' grade quality score.
Improve maintainability
Automate code quality improvements by iterating through analysis, fixing, and validation cycles using a quality gate check.
Step 1: Initiate Loop
Begin by providing the kickoff prompt in your preferred tool (Cursor, Claude Code, etc.) to start the agent's quality assessment process.
Step 2: Execute Check Command
After each improvement step, run the configured quality gate check command to evaluate current code quality status.
Step 3: Review Results & Iterate
If the quality gate fails, the agent will automatically identify areas needing improvement and apply necessary changes before re-checking.
Assess Current Code Quality
Run initial static analysis and quality gate check to establish baseline metrics and identify failing criteria.
Analyze Quality Gate Results
Examine detailed output from quality checks to determine specific modules/functions requiring attention.
Quality
Automatically identifies and removes unused code to improve codebase quality and maintainability. This loop performs iterative scans for dead code, removes it gradually, and ensures no regressions are introduced.
Quality
Automatically iterates through lint error detection and resolution until the codebase passes linting with zero issues. This loop ensures code quality and consistency by having the agent fix problems as they are identified.
Quality
This loop systematically refactors your codebase to improve structure while maintaining test coverage. The agent identifies opportunities for cleaner code without breaking existing functionality.
Apply Targeted Fixes
Modify identified problematic code with emphasis on improving structure, reducing complexity, and enhancing clarity.
Validate Improvements
Re-run quality gate check to verify that changes have positively impacted maintainability metrics.
Repeat Until Pass
Continue iteration cycle until quality gate passes or maximum iterations are reached, ensuring continuous refinement.
Start the "Code Quality Until A Grade" loop. Goal: Improve maintainability Max iterations: 10 Between iterations run: quality gate Exit when: Quality gate passes Analyze the entire codebase for maintainability issues. Run the quality gate check and review the results. Identify the lowest-scoring components based on code complexity, duplication, and style violations. For each identified issue, apply concrete improvements focusing on reducing cognitive complexity, eliminating code duplication, and aligning with project conventions. After every set of changes, re-run the quality gate check. Stop when the quality gate passes or after 10 iterations. Prioritize changes that have the highest impact on overall code health. Self-pace this loop. After each iteration, run `quality gate` and evaluate the output, and only continue if the exit condition is not met (Quality gate passes). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.