Qualityprompt onlyIntermediate

Code Quality Until A Grade

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.

← all loops
code-qualitymaintainabilitystatic-analysisci-cdrefactoringtechnical-debtautomated-improvement

Goal

Improve maintainability

How to Run

Automate code quality improvements by iterating through analysis, fixing, and validation cycles using a quality gate check.

  1. 01

    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.

  2. 02

    Step 2: Execute Check Command

    After each improvement step, run the configured quality gate check command to evaluate current code quality status.

  3. 03

    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.

Workflow Steps

  1. 01

    Assess Current Code Quality

    Run initial static analysis and quality gate check to establish baseline metrics and identify failing criteria.

  2. 02

    Analyze Quality Gate Results

    Examine detailed output from quality checks to determine specific modules/functions requiring attention.

  3. 03

    Apply Targeted Fixes

    Modify identified problematic code with emphasis on improving structure, reducing complexity, and enhancing clarity.

  4. 04

    Validate Improvements

    Re-run quality gate check to verify that changes have positively impacted maintainability metrics.

  5. 05

    Repeat Until Pass

    Continue iteration cycle until quality gate passes or maximum iterations are reached, ensuring continuous refinement.

Kickoff Prompt

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.

Guardrails

hardcoded
  • ·Ensure all changes maintain backward compatibility with existing APIs and interfaces.
  • ·Preserve or improve existing test coverage with each modification.
  • ·Adhere to established coding standards and style guides for the project.
  • ·Avoid introducing new technical debt or circumventing quality checks.
  • ·Focus improvements on maintainability, readability, and performance bottlenecks.

Flow Diagram

rendering…

Related loops — Quality