qa-workflow
Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol.
SKILL.md
| Name | qa-workflow |
| Description | Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol. |
name: qa-workflow description: Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol.
QA Workflow
"Orchestration layer for QA validation - delegate to specialized skills for each step."
Core Responsibilities
- Load proper skills and tools - Always ensure you have the right skills loaded for each task. Run tasks and subagents in parallel when possible to optimize time.
- Full validation - code quality review, type-check, lint, test, build, specifications validation
- Code quality enforcement - Check for code quality smells, anti-patterns, wrong design patterns and implementation issues
- Checkpoint tracking - Use validation-state.json to verify all steps complete before proceeding
- Bug reporting - Structured bug reports with evidence
- Specifications validation - Check implementation vs design specifications
Standard Message Pipeline
- Read message input in this order: CLI message argument →
pending-messages-qa.json→ inbox diagnostics - Never delete queue files (
messages/*) or pending transaction files (pending-messages-*.json) - Watchdog owns delivery and cleanup lifecycle
- Signal lifecycle using
status_update:workingwhen validation startsawaiting_pm/awaiting_gdwhen blockedready/waiting/idlewhen available for next delivery
Agent Startup Protocol
PRE-REQUISITE: You should already have loaded the shared-worktree skill and be in the correct worktree directory before starting this workflow!
On each QA agent spawn, follow these steps EXACTLY in order:
STEP 0: INITIALIZE VALIDATION STATE (MANDATORY - First action)
Before any validation work begins:
- Create
.claude/session/validation-state.jsonif it doesn't exist - Initialize with task information:
{ "taskId": "{taskId from validation_request}", "startedAt": "{ISO-8601 timestamp}", "checkpoints": { "codeReview": null, "typeCheck": null, "lint": null, "test": null, "build": null, "codeRefactor": false } } - PROCEED to Step 1
STEP 1: SEND STATUS UPDATE (MANDATORY)
Send status_update to watchdog with status: "working" and current task details.
STEP 2: CODE QUALITY PRE-CHECK (MANDATORY - Unskippable)
BEFORE running any automated checks:
- Load
qa-code-reviewskill - Identify changed files from the validation request
- Run quality checks using the qa-code-review skill's grep patterns
- Update checkpoint:
validation-state.json→checkpoints.codeReview = "PASS"or"FAIL" - IF "FAIL": Create bug report, STOP validation, report to PM
- IF "PASS": Proceed to Step 3
STEP 3: AUTOMATED CHECKS (MANDATORY)
Follow the qa-validation-workflow skill guidelines:
- Load
qa-validation-workflowskill - Execute in sequence:
- Type Check → Update checkpoint
- Lint → Update checkpoint
- Test → Update checkpoint
- Build → Update checkpoint
- Each step MUST update its checkpoint in
validation-state.jsonbefore proceeding - IF any check FAILS: STOP validation, create bug report, report to PM
STEP 4: CODE REFACTOR GATE (MANDATORY - Enforced Checkpoint)
BEFORE proceeding to specification validation:
- READ
validation-state.json - VERIFY
checkpoints.codeRefactor == true - IF false:
- READ
validation_request.payload.filesfor list of created/modified files - INVOKE code-refactor subagent using Task tool:
Task tool → subagent_type: "code-refactor", model: "sonnet" Prompt: "Review and refactor these files using codebase-cleanup-refactor-clean skill: Files to review: {files.create} + {files.modify} Context: QA validation for task {taskId} Focus on: code quality, clean code principles, SOLID patterns, anti-patterns, maintainability" ``` WAIT for code-refactor subagent completion - **READ** code-refactor output to verify completion - **UPDATE** checkpoint: `checkpoints.codeRefactor = true` - **IF changes were made:** Re-execute Step 3 (re-validation loop) - **IF re-validation FAILS:** Report bug, DO NOT proceed - **ONLY** proceed to Step 5 after code-refactor checkpoint is true- WAIT for code-refactor subagent completion
- READ code-refactor output to verify completion
- UPDATE checkpoint:
checkpoints.codeRefactor = true - IF changes were made: Re-execute Step 3 (re-validation loop)
- IF re-validation FAILS: Report bug, DO NOT proceed
- READ
- ONLY proceed to Step 5 after code-refactor checkpoint is true
STEP 5: SPECIFICATION VALIDATION
After all automated checks pass and code-refactor completes:
- READ
prd.jsonfor the task's acceptance criteria - READ relevant GDD documents for design specifications
- VERIFY each acceptance criterion is met in implementation
- DOCUMENT results:
- Which criteria passed
- Any gaps between implementation and design
- Visual/behavioral verification notes
STEP 6: FINAL DECISION GATE (MANDATORY)
BEFORE committing or reporting:
- READ ALL checkpoints from
validation-state.json - VERIFY all checkpoints:
codeReview: "PASS"typeCheck: "PASS"lint: "PASS"test: "PASS"build: "PASS"codeRefactor: true
- DECISION:
- IF any checkpoint = "FAIL": Status = "FAILED", create bug_report using qa-reporting-bug-reporting skill
- IF all checkpoints PASS: Status = "PASSED", prepare for commit
- NEVER proceed to Step 7 without completing Steps 0-6
STEP 7: COMMIT & REPORT (Only after passing all gates)
ONLY execute after Steps 0-6 complete successfully:
- UPDATE
validation-state.jsonwithfinalStatus: "PASSED"or"FAILED" - COMMIT all changes to current branch with
[ralph] [qa] {taskId}: Validation {status} - IF PASSED: Merge to main and push
- IF FAILED: DO NOT merge (no push)
- SEND message to PM with validation results:
- Overall status
- Checkpoint results summary
- Bug report (if failed)
- Observations and notes
- RUN server cleanup using
shared-lifecycleskill - SEND final
status_updateto watchdog withstatus: "ready" - EXIT
If Blocked
If validation cannot proceed due to missing information:
- UPDATE
prd.jsontask state with blocker details - UPDATE state:
state.status = "awaiting_pm"or"awaiting_gd" - SET
state.lastSeen = "{ISO_TIMESTAMP}" - SEND message to PM or Game Designer with details
- SEND
status_updateto watchdog with blocked status - EXIT and wait for response
Re-Validation Loop
CRITICAL: If code-refactor makes changes, you MUST re-run automated checks:
- Reset checkpoints:
typeCheck,lint,test,build→null - Re-execute Step 3 (Automated Checks)
- Verify all checkpoints pass again
- Only proceed to Step 5 after re-validation passes
Important Reminders
- NEVER skip Step 2 (code quality pre-check) - catches issues automated tools miss
- NEVER skip Step 4 (code-refactor gate) - enforced by checkpoint verification
- ALWAYS update checkpoints after each step - validation-state.json is source of truth
- STOP immediately on any FAIL - do not continue validation
- RE-VALIDATE after refactor - automated checks must pass again
- READ validation_request payload for file lists - needed for code-refactor invocation
State Transitions
| Current State | Trigger | Action | Next State |
|---|---|---|---|
idle | Task assigned | Initialize state, validate | working |
working | All checkpoints pass | Report PASS to PM, merge to main | idle |
working | Any checkpoint fails | Report FAIL with bug report | idle |
working | Criteria unclear | Ask Game Designer | awaiting_gd |
working | Test approach unclear | Ask PM | awaiting_pm |
Exit Conditions
BEFORE exiting, you MUST verify:
- ✅ All checkpoints updated in validation-state.json
- ✅ Code-refactor completed (
checkpoints.codeRefactor == true) - ✅ Decision made based on ALL checkpoints
- ✅ Bug report created if validation failed
- ✅ Commit made with
[ralph] [qa]prefix - ✅ Message sent to PM with results
- ✅ Status update sent to watchdog (
ready/idle) - ✅ Server cleanup run using shared-lifecycle skill