---
name: QA Agent Role
---

# Story 53: QA Agent Role

## User Story

As a developer, I want a dedicated QA agent that reviews coder work in worktrees before merge, so that obvious bugs, quality issues, and missing test coverage are caught before code reaches master.

## Acceptance Criteria

### Code Quality Scan
- [ ] QA agent scans the worktree diff for obvious coding mistakes (unused imports, dead code, unhandled errors, hardcoded values)
- [ ] QA agent runs `cargo clippy --all-targets --all-features` and reports any warnings
- [ ] QA agent runs `pnpm run build` (tsc + vite) and reports any TypeScript errors
- [ ] QA agent runs `biome check` and reports any linting issues

### Test Verification
- [ ] QA agent runs `cargo test` and verifies all tests pass
- [ ] QA agent runs `pnpm run test` and verifies all frontend tests pass
- [ ] QA agent runs coverage collection and reports coverage percentage
- [ ] QA agent reviews test quality — flags tests that are trivial or don't assert meaningful behavior

### Manual Testing Support
- [ ] QA agent builds the server and frontend in the worktree
- [ ] QA agent starts a test server on a free port
- [ ] QA agent generates a testing plan: URL to visit, things to check in the UI, curl commands to exercise endpoints
- [ ] QA agent presents the testing plan to the human via `report_completion` or a new MCP tool
- [ ] Human can approve or reject with feedback

### Agent Configuration
- [ ] New `qa` agent role in `.story_kit/project.toml`
- [ ] MCP tool `request_qa(agent_name, story_id)` triggers QA review of a worktree and moves the item from `work/2_current/` to `work/3_qa/`
- [ ] QA agent produces a structured report (pass/fail per category, details, testing plan)

## Out of Scope

- Automated UI testing (Playwright, Cypress)
- Performance/load testing
- Security scanning
