QA code review with AI agents
PR review is the phase where QA teams most often collapse — either it does not run properly (deadline pressure), or it steals so much senior time that they do not get to writing tests themselves. An AI review agent is a compromise: it does not replace human review but catches 50–70% of issues before they reach a person.
How to set up a QA review agent in Claude Code
Create the file .claude/agents/qa-reviewer.md:
--- name: qa-reviewer description: PR review pre QA testy. Kontroluje Page Object patterns, anti-flaky best practices, pokrytie negative scenárov a duplicity. Spúšťaj pri každom PR s test súbormi. --- Si QA reviewer senior level. Prechádzaš diff pridaných/ zmenených test súborov a kontroluješ: ## Kritické (blokuj merge) - Hardcoded timeouts (cy.wait(number)) - Missing data-qa selektory — nikdy CSS class alebo ID - Cez-test dependencies (state leak z predchádzajúceho testu) - Missing beforeEach/afterEach cleanup - Tested len happy path, bez negative scenárov tam, kde dáva zmysel ## Warning (nezjednostavuje) - Duplikát existujúceho test case-u (prezrel si cypress/e2e/) - Inline test data namiesto factory - Nesprávny súborový zaraďovací (feature patrí do cypress/e2e/X, nie do Y) ## Nitpick (len mention, nezjednostavuje) - Neosadené aria-labely v page objecte - Chýbajúci JSDoc pri exportovaných helperoch Výstup formátuj ako GitHub review: - **file.ts:23** [CRITICAL] hardcoded timeout, použij cy.intercept() - **file.ts:45** [WARN] duplikát cypress/e2e/checkout/payment.spec.ts:12
Running the agent
On a PR run in the terminal:
git checkout feature/new-checkout-tests claude /agents qa-reviewer > Reviewuj diff oproti main pre všetky .spec.ts súbory.
Claude reads the diff, applies the rules from the file and prints a review. Paste it into the GitHub PR.
CI integration (advanced)
Automatic comment on a PR via GitHub Action:
name: QA Review
on:
pull_request:
paths: ['cypress/**/*.spec.ts']
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Run Claude review
uses: anthropics/claude-code-action@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}
agent: qa-reviewer
diff: ${{ github.event.pull_request.base.sha }}..HEAD
- name: Post comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: .claude/review-output.md
Measurable delivery
- Human reviewer bandwidth — senior QA doesn't need to look at every trivial PR. They only look at PRs where the AI agent said 'LGTM but check one thing'.
- Framework stability — anti-flaky patterns are followed consistently, not only when a reviewer happens to notice.
- Junior onboarding — a junior tester gets immediate feedback on every PR. They learn patterns faster than from manuals.
What the AI reviewer won't solve
- Business logic — 'are we testing the right scenario?' is a human job.
- Architectural decisions — 'does this belong in a page object or is it a shared helper?' AI recommends but not authoritatively.
- Trade-offs — test speed vs. thoroughness is a business decision.
Best practice: 2-step review
- AI review agent — automatically on the PR. Catches technical details.
- Human review — a senior QA or dev lead takes at most 5 min. Focuses only on business and architectural correctness.
Real time needed to review a PR drops from 25–45 min to 5–10 min, with higher quality.
Want the same approach at your company? Get in touch — dohodneme 30-minute discovery call.