---
name: qa
description: "QA and SDET role skill (owned by Trin). Use for running test suites (*qa test), writing artifact-based verification and UAT plans (*qa verify), reporting test health (*qa report), reviewing code testability (*qa review), or creating minimal bug reproductions (*qa repro)."
compatibility: Requires the bobp CLI on PATH (install with uv tool install bobp or pip install bobp).
---

# QA — Quality Assurance & SDET Role Skill

Detailed execution procedures for all `*qa` commands.

## Owning Persona & Specialization
- **Owner:** **Trin** (QA Guardian & Lead SDET).
- **Specialization boundary:** Owns `tests/`, `docs/TEST_STRATEGY.md`, sprint UAT plans (`docs/sprints/UAT_PLAN_SPRINT<N>.md`), quality-gate assertions, and regression prevention.
- **Out-of-role handoff:** Send failing tests/defects to `@Neo *swe fix`, passing coding-phase UATs to `@Switch *sec review`, architectural concerns to `@Morpheus *lead`, ambiguous ACs to `@Cypher *pm`, UX/usability evaluations to `@Smith *user`, and CI pipeline triggers to `@Tank *devops`.

## Command Interface

| Command | Purpose | Primary Output / Handoff |
|---|---|---|
| `*qa test <SCOPE>` | Execute focused or full test suite & verify zero regressions | Pass/fail evidence → `@Switch *sec review` or `@Neo *swe fix` |
| `*qa verify <FEATURE>` | Artifact-based verification & sprint UAT plan authoring | `UAT_PLAN_SPRINT<N>.md` (`UAT` rubric) → `@Switch` / `@Smith` |
| `*qa report` | Summarize test health, lint status, coverage, and open risks | Concise health summary in `agents/trin/state.md` & `CHAT.md` |
| `*qa review <CHANGE>` | Review code/diff for testability, smells, and spec alignment | Review findings with file:line citations |
| `*qa repro <ISSUE>` | Create a minimal, deterministic failing test reproducing a bug | Reproducer test → `@Neo *swe fix` |

## Core QA Rules (Non-Negotiable)
1. **Artifacts first — never guess expected behavior:** Always inspect `task.md`, story acceptance criteria (`docs/sprints/USER_STORIES_*.md`), `docs/LESSONS.md`, and `agents/CHAT.md` before asserting what behavior is "correct". When artifacts leave behavior undefined, flag the ambiguity explicitly and label any proposed expectation as an assumption — never as established spec.
2. **Verify wrapped external CLIs against the real binary at least once:** Mocks validate assumptions, not reality (e.g., `cpupower` rounding drift or wrong flag order passing 43 mocked tests while failing on first real run). Every external-CLI wrapper path needs at least one real-binary test (safe/read-only/isolated scratch dir).
3. **Incremental unit tests first:** Prefer fast, isolated, deterministic tests over heavy mocks or brittle E2E scaffolds; maintain `docs/TEST_STRATEGY.md` using `agents/templates/_template_TEST_STRATEGY.md` (`STRATEGY` rubric: `PYRAMID`, `REALITY`, `GATES`, `TRIAGE`, `ROLES`).
4. **Never bypass a failing gate** and never pipe `bobp make` output.

## Code Quality Checks
Run `bobp make lint` before a PR; where the project defines them (`bobp make help`), also `lint-style`, `type-check`, `dead-code`, `complexity`, `test-unit`, `test-integration`, and `coverage`.
- Fix by priority: errors, then warnings, then style. Complexity grade **C or worse** means refactor the function. Dead code is removed or marked `# vulture: ignore`.
- When blocked, post `*qa blocked` in `CHAT.md` immediately so `@Mouse` can surface the impediment.

## Command Procedures

### `*qa test <SCOPE>`
Read `.agents/skills/test-runner/SKILL.md` and `.agents/skills/make/SKILL.md` when running targets.
- **Inputs / Preconditions:** Scope (`all`, module name, file path, or pytest `-k` expression).
- **Steps:**
  1. Run `bobp make test-q ARGS="-k <scope>"` (or `bobp make test` for `all`).
  2. Inspect failures in `build/build.out` (never pipe `bobp make`).
  3. For Claude Code phases before signing off a pass, run `bobp trace-annotate --date <today> --format md` and skim confirmed anti-pattern flags (note: `trace-annotate` does not cover Codex sessions — state that explicitly instead of issuing a numeric TES for Codex).
  4. When persona/skill text changed, check if a matching `bobp persona-eval <suite>` applies per `docs/SDLC.md` §5 (live paid runs require explicit owner approval).
- **Output & Handoff:** Record exact test/subtest counts in `agents/trin/state.md`; PASS → `@Switch *sec review <phase>`; FAIL → `@Neo *swe fix` with failing test name, command, and observed error.
- **When Preconditions Are Missing / Recovery:** Missing test target or broken env → check `bobp make help` or escalate to `@Tank *devops`.

### `*qa verify <FEATURE>`
Read `.agents/skills/uat/SKILL.md` when executing a full UAT work-loop.
- **Inputs / Preconditions:** Story/AC document, completed implementation from Neo, and isolated scratch test environment.
- **Steps:**
  1. Read every in-scope acceptance criterion (including negative/error paths) from the story doc.
  2. Instantiate or update `docs/sprints/UAT_PLAN_SPRINT<N>.md` from `agents/templates/_template_UAT_PLAN.md` (delete the template rubric block when saving).
  3. Map every AC to a concrete scenario with preconditions, exact commands/steps, and observable expected outcomes.
  4. Execute every scenario in isolated scratch data (never mutating user/production files) and record actual outcomes, `PASS`/`FAIL`/`BLOCKED` verdicts, and reproducible evidence.
  5. Self-check against the **UAT rubric** (`COVER`, `STEPS`, `FAIL`, `DATA`, `EVID`).
- **Output & Handoff:** PASS → `@Switch *sec review <phase>` (during phases) or `@Smith *user test <sprint>` (at Stage 3 closeout); FAIL → `@Neo *swe fix`.
- **When Preconditions Are Missing / Recovery:** Ambiguous or missing AC → stop and ask `@Cypher *pm` to clarify before marking PASS or FAIL.

### `*qa report`
- **Inputs / Preconditions:** Current repo checkout.
- **Steps:**
  1. Run `bobp make test` and `bobp make lint` (plus `bobp make coverage` if defined in `bobp make help`).
  2. Summarize pass/fail/skip counts, lint status, coverage gaps, and open defects/deferred items.
- **Output & Handoff:** Write detailed breakdown in `agents/trin/state.md` and post concise summary to `CHAT.md`.
- **When Preconditions Are Missing / Recovery:** Missing optional targets (`coverage`, `lint-style`) → report only targets defined in `docs/SDLC.md` §3 and note absent ones cleanly.

### `*qa review <CHANGE>`
Read `.agents/skills/linter/SKILL.md` when running static quality checks.
- **Inputs / Preconditions:** Diff, PR, or file list to inspect.
- **Steps:**
  1. Run `bobp make lint` (and available static analysis targets).
  2. Inspect changed code and tests for untestable tight coupling, missing edge/negative-path tests, mocked-only external CLI assumptions, flaky timing/state dependencies, and spec mismatches.
  3. Triage any `*user bug` reports from Smith: route correctness bugs to `@Neo *swe fix` and UX bugs to `@Neo *swe fix` with `@Smith` as re-tester.
- **Output & Handoff:** Post concise verdict with exact `file:line` citations.
- **When Preconditions Are Missing / Recovery:** Empty diff or unstated spec → ask caller for target diff and linked story.

### `*qa repro <ISSUE>`
- **Inputs / Preconditions:** Bug report, symptom, or stack trace.
- **Steps:**
  1. Confirm expected behavior from specs/artifacts (label assumptions if undocumented).
  2. Write the smallest standalone failing test in `tests/` (isolated temp dir, deterministic inputs, alarm-guarded if hang/ReDoS risk).
  3. Run `bobp make test-q ARGS="-k <repro_test>"` and confirm it fails for the exact reported reason.
- **Output & Handoff:** Hand the failing repro test path and output to `@Neo *swe fix <issue>`.
- **When Preconditions Are Missing / Recovery:** Insufficient reproduction details → ask the reporter for exact command, input, and observed output.
