PR Polish Loop
An automated workflow loop that iteratively reviews and improves pull request code quality to achieve merge readiness. This loop focuses on code standards, testing, documentation, and best practices through self-paced agent iterations.
Goal
Improve merge readiness
How to Run
Run this loop in your preferred AI coding environment to automatically polish pull requests until they meet merge readiness criteria
- 01
Initialize the Loop
Copy the kickoff prompt and paste it into your AI coding agent interface (Cursor, Claude Code, Codex, OpenCode, or Gemini CLI)
- 02
Monitor Iterations
The agent will automatically run merge readiness checks after each improvement cycle and continue iterating until merge ready or max iterations reached
- 03
Review Changes
Inspect changes made by each iteration and provide feedback or let the agent continue polishing automatically
Workflow Steps
- 01
Code Quality Assessment
Run static analysis tools (linters, formatters) to identify code style violations and technical debt
- 02
Test Coverage Enhancement
Analyze test coverage and add missing tests for edge cases, error conditions, and public APIs
- 03
Documentation Improvement
Enhance inline documentation, API docs, and README files to ensure clarity and completeness
- 04
Security & Performance Audit
Conduct security scanning and performance optimization to meet production standards
- 05
Merge Readiness Verification
Execute comprehensive merge readiness check including all quality gates and criteria
Kickoff Prompt
Start the "PR Polish Loop" loop. Goal: Improve merge readiness Max iterations: 10 Between iterations run: merge readiness review Exit when: Merge ready You are a PR Polish Loop agent. Your goal is to improve this pull request's merge readiness through iterative improvements. Begin by understanding the current state of the codebase and PR changes. Execute the merge readiness check to assess current status, then systematically address any issues found. Focus on code quality, testing, documentation, and best practices. After each improvement cycle, run the merge readiness check again. Continue iterating until all merge readiness criteria are met or you reach maximum iterations. Document your changes clearly and avoid modifying core business logic unless explicitly requested. Output the final assessment when complete. Self-pace this loop. After each iteration, run `merge readiness review` and evaluate the output, and only continue if the exit condition is not met (Merge ready). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Never modify core business logic without explicit approval in kickoff prompt
- ·Preserve existing test behavior and coverage
- ·Maintain backward compatibility for all API changes
- ·Only add dependencies if specifically requested
- ·Focus on code quality improvements, not feature additions
- ·Respect existing code style and conventions
- ·Document all significant changes made during polishing
Flow Diagram
Related loops — Review
Review
Address Review Feedback
This loop systematically identifies, analyzes, and resolves unresolved code review comments to improve code quality and ensure all feedback is addressed before merging.
Review
Self-Review Loop
A self-paced loop for coding agents to iteratively review and improve their pull request quality before submission. The agent acts on the codebase, runs automated checks, inspects results, and refines changes until all quality criteria are met.
Review
Security Review Resolver
An automated iterative loop that analyzes code for security vulnerabilities, runs security checks, identifies issues, implements fixes, and continues until security approval is achieved. The agent self-paces through act → check → inspect cycles to ensure code meets security standards.