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:
working when validation starts
awaiting_pm / awaiting_gd when blocked
ready / waiting / idle when 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.json if 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-review skill
- 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-workflow skill
- 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.json before 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.files for 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
- 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.json for 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.json with finalStatus: "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-lifecycle skill
- SEND final
status_update to watchdog with status: "ready"
- EXIT
If Blocked
If validation cannot proceed due to missing information:
- UPDATE
prd.json task 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_update to 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
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: qa-workflow-23description: Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol. Use when this capability is needed.4---56# QA Workflow78> "Orchestration layer for QA validation - delegate to specialized skills for each step."910## Core Responsibilities1112- **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.13- **Full validation** - code quality review, type-check, lint, test, build, specifications validation14- **Code quality enforcement** - Check for code quality smells, anti-patterns, wrong design patterns and implementation issues15- **Checkpoint tracking** - Use validation-state.json to verify all steps complete before proceeding16- **Bug reporting** - Structured bug reports with evidence17- **Specifications validation** - Check implementation vs design specifications1819## Standard Message Pipeline2021- Read message input in this order: CLI message argument → `pending-messages-qa.json` → inbox diagnostics22- Never delete queue files (`messages/*`) or pending transaction files (`pending-messages-*.json`)23- Watchdog owns delivery and cleanup lifecycle24- Signal lifecycle using `status_update`:25 - `working` when validation starts26 - `awaiting_pm` / `awaiting_gd` when blocked27 - `ready` / `waiting` / `idle` when available for next delivery2829## Agent Startup Protocol3031**PRE-REQUISITE: You should already have loaded the `shared-worktree` skill and be in the correct worktree directory before starting this workflow!**3233On each QA agent spawn, follow these steps EXACTLY in order:3435### STEP 0: INITIALIZE VALIDATION STATE (MANDATORY - First action)3637Before any validation work begins:38391. **Create** `.claude/session/validation-state.json` if it doesn't exist402. **Initialize** with task information:41 ```json42 {43 "taskId": "{taskId from validation_request}",44 "startedAt": "{ISO-8601 timestamp}",45 "checkpoints": {46 "codeReview": null,47 "typeCheck": null,48 "lint": null,49 "test": null,50 "build": null,51 "codeRefactor": false52 }53 }54 ```553. **PROCEED** to Step 15657### STEP 1: SEND STATUS UPDATE (MANDATORY)5859Send `status_update` to watchdog with `status: "working"` and current task details.6061### STEP 2: CODE QUALITY PRE-CHECK (MANDATORY - Unskippable)6263**BEFORE** running any automated checks:64651. **Load** `qa-code-review` skill662. **Identify** changed files from the validation request673. **Run** quality checks using the qa-code-review skill's grep patterns684. **Update checkpoint:** `validation-state.json` → `checkpoints.codeReview = "PASS"` or `"FAIL"`695. **IF "FAIL":** Create bug report, STOP validation, report to PM706. **IF "PASS":** Proceed to Step 37172### STEP 3: AUTOMATED CHECKS (MANDATORY)7374Follow the `qa-validation-workflow` skill guidelines:75761. **Load** `qa-validation-workflow` skill772. **Execute** in sequence:78 - Type Check → Update checkpoint79 - Lint → Update checkpoint80 - Test → Update checkpoint81 - Build → Update checkpoint823. **Each step MUST update** its checkpoint in `validation-state.json` before proceeding834. **IF any check FAILS:** STOP validation, create bug report, report to PM8485### STEP 4: CODE REFACTOR GATE (MANDATORY - Enforced Checkpoint)8687**BEFORE** proceeding to specification validation:88891. **READ** `validation-state.json`902. **VERIFY** `checkpoints.codeRefactor == true`913. **IF false:**92 - **READ** `validation_request.payload.files` for list of created/modified files93 - **INVOKE** code-refactor subagent using Task tool:94 ```95 Task tool → subagent_type: "code-refactor", model: "sonnet"96 Prompt: "Review and refactor these files using codebase-cleanup-refactor-clean skill:97 Files to review: {files.create} + {files.modify}98 Context: QA validation for task {taskId}99 Focus on: code quality, clean code principles, SOLID patterns, anti-patterns, maintainability"100 ``` WAIT for code-refactor subagent completion101 - **READ** code-refactor output to verify completion102 - **UPDATE** checkpoint: `checkpoints.codeRefactor = true`103 - **IF changes were made:** Re-execute Step 3 (re-validation loop)104 - **IF re-validation FAILS:** Report bug, DO NOT proceed105 - **ONLY** proceed to Step 5 after code-refactor checkpoint is true106 ```107 - **WAIT** for code-refactor subagent completion108 - **READ** code-refactor output to verify completion109 - **UPDATE** checkpoint: `checkpoints.codeRefactor = true`110 - **IF changes were made:** Re-execute Step 3 (re-validation loop)111 - **IF re-validation FAILS:** Report bug, DO NOT proceed1124. **ONLY** proceed to Step 5 after code-refactor checkpoint is true113114### STEP 5: SPECIFICATION VALIDATION115116After all automated checks pass and code-refactor completes:1171181. **READ** `prd.json` for the task's acceptance criteria1192. **READ** relevant GDD documents for design specifications1203. **VERIFY** each acceptance criterion is met in implementation1214. **DOCUMENT** results:122 - Which criteria passed123 - Any gaps between implementation and design124 - Visual/behavioral verification notes125126### STEP 6: FINAL DECISION GATE (MANDATORY)127128**BEFORE** committing or reporting:1291301. **READ ALL checkpoints** from `validation-state.json`1312. **VERIFY** all checkpoints:132 - `codeReview: "PASS"`133 - `typeCheck: "PASS"`134 - `lint: "PASS"`135 - `test: "PASS"`136 - `build: "PASS"`137 - `codeRefactor: true`1383. **DECISION:**139 - **IF any checkpoint = "FAIL":** Status = "FAILED", create bug_report using qa-reporting-bug-reporting skill140 - **IF all checkpoints PASS:** Status = "PASSED", prepare for commit1414. **NEVER** proceed to Step 7 without completing Steps 0-6142143### STEP 7: COMMIT & REPORT (Only after passing all gates)144145**ONLY** execute after Steps 0-6 complete successfully:1461471. **UPDATE** `validation-state.json` with `finalStatus: "PASSED"` or `"FAILED"`1482. **COMMIT** all changes to current branch with `[ralph] [qa] {taskId}: Validation {status}`1493. **IF PASSED:** Merge to main and push1504. **IF FAILED:** DO NOT merge (no push)1515. **SEND** message to PM with validation results:152 - Overall status153 - Checkpoint results summary154 - Bug report (if failed)155 - Observations and notes1566. **RUN** server cleanup using `shared-lifecycle` skill1577. **SEND** final `status_update` to watchdog with `status: "ready"`1588. **EXIT**159160## If Blocked161162**If** validation cannot proceed due to missing information:1631641. **UPDATE** `prd.json` task state with blocker details1652. **UPDATE** state: `state.status = "awaiting_pm"` or `"awaiting_gd"`1663. **SET** `state.lastSeen = "{ISO_TIMESTAMP}"`1674. **SEND** message to PM or Game Designer with details1685. **SEND** `status_update` to watchdog with blocked status1696. **EXIT** and wait for response170171---172173## Re-Validation Loop174175**CRITICAL:** If code-refactor makes changes, you MUST re-run automated checks:1761771. **Reset checkpoints:** `typeCheck`, `lint`, `test`, `build` → `null`1782. **Re-execute Step 3** (Automated Checks)1793. **Verify** all checkpoints pass again1804. **Only** proceed to Step 5 after re-validation passes181182## Important Reminders183184- **NEVER skip Step 2** (code quality pre-check) - catches issues automated tools miss185- **NEVER skip Step 4** (code-refactor gate) - enforced by checkpoint verification186- **ALWAYS update checkpoints** after each step - validation-state.json is source of truth187- **STOP immediately** on any FAIL - do not continue validation188- **RE-VALIDATE after refactor** - automated checks must pass again189- **READ validation_request payload** for file lists - needed for code-refactor invocation190191---192193194## State Transitions195196| Current State | Trigger | Action | Next State |197| ------------- | ------------------------ | ----------------------------- | ------------- |198| `idle` | Task assigned | Initialize state, validate | `working` |199| `working` | All checkpoints pass | Report PASS to PM, merge to main | `idle` |200| `working` | Any checkpoint fails | Report FAIL with bug report | `idle` |201| `working` | Criteria unclear | Ask Game Designer | `awaiting_gd` |202| `working` | Test approach unclear | Ask PM | `awaiting_pm` |203204## Exit Conditions205206**BEFORE exiting, you MUST verify:**2072081. ✅ **All checkpoints updated** in validation-state.json2092. ✅ **Code-refactor completed** (`checkpoints.codeRefactor == true`)2103. ✅ **Decision made** based on ALL checkpoints2114. ✅ **Bug report created** if validation failed2125. ✅ **Commit made** with `[ralph] [qa]` prefix2136. ✅ **Message sent** to PM with results2147. ✅ **Status update sent** to watchdog (`ready`/`idle`)2158. ✅ **Server cleanup run** using shared-lifecycle skill216217---218> Converted and distributed by [TomeVault](https://tomevault.io/claim/feliperyba) — claim your Tome and manage your conversions.219<!-- tomevault:4.0:skill_md:2026-04-13 -->