---
name: tc-quality-gate
description: >
  Pre-generation gate for any new test case work. Use this skill BEFORE drafting
  any TC, generating an XLSX test workbook, or starting Phase B of a ticket task.
  Use when the user asks to "create test cases", "design test cases", "generate
  test docs", "write TCs for ticket X", "add test cases for module Y", or any
  task whose output is one or more TC entries. Also use proactively when invoked
  by `test-design-techniques` or `async-event-testing` — those skills require
  this gate to have run first. The gate's job is twofold: (a) refuse to proceed
  if input premises are incomplete or contradictory, (b) require every TC to
  declare an explicit design technique.
---

# TC Quality Gate

**Scope:** Universal — runs before every test-case generation task across TTT, CS, PMT.

This is a **meta-skill**. It produces no test cases itself. It either lets
generation proceed or stops it with a structured "missing information" report.

## Why this exists

The digest Phase-C retrospective (see `docs/tasks/digest/phase-c-problem-report.md`)
showed 11 of 14 generated TCs had wrong premises that were not caught until late
review. Every one of those 11 was traceable to one of two root causes:

1. The generator received incomplete or contradictory input but proceeded anyway.
2. The generator did not name *which* test design technique each TC was applying,
   so boundary / equivalence / decision-table mistakes were invisible until QA.

This skill closes both holes before any TC is written.

## Two stop conditions

### Stop condition 1 — incomplete input

Before proceeding, verify that every item in the **premise contract** is present
or marked as N/A with justification. If anything is missing, output a structured
"MISSING INFO" report and **stop** — do not synthesize, do not guess.

(Outline — full checklist in `references/premise-validation-checklist.md`)

- Module name + scope (which TTT / CS / PMT module(s))
- Trigger surface (UI / API / cron / event / mixed)
- Source-of-truth references (vault notes, GitLab tickets, ticket comments)
- Authentication / role context (which user, which permission, which token)
- Test data mode (static / dynamic / saved) — delegated to `test-data-preparation` skill
- Environment scope (`<ENV>` placeholder usage confirmed)
- Expected side-effect channels (DB tables, log streams, email recipients, queues)
- Async timing semantics (sync / settle-loop / cron-trigger / webhook)
- Known traps from prior tickets (Phase-C report referenced if applicable)

### Stop condition 2 — missing technique attribution

Every TC must declare its design technique in a dedicated cell or comment. The
allowed values come from `test-design-techniques` skill. If the generator cannot
name a technique, that TC is not ready to write — re-enter design.

Allowed technique tags (short form):

- `BVA` — Boundary Value Analysis
- `EP`  — Equivalence Partitioning
- `DT`  — Decision Table
- `ST`  — State Transition
- `PW`  — Pairwise via PICT — must check in a `.pict` model file alongside the XLSX
- `EG`  — Error Guessing (must cite the prior bug / Phase-C item that motivates it)
- `UC`  — Use Case (end-to-end happy path)
- `EX`  — Exploratory: Phase A vault notes only; **not allowed** in shipped TCs. SBT (session-based testing) artifact deferred to v2.

A TC tagged `BVA` without explicit boundary values listed → fail.
A TC tagged `DT` without a condition × action grid → fail.

## Workflow

1. **Receive input** (ticket, module name, user request).
2. **Run premise checklist** — record findings as PASS / N/A-justified / MISSING.
3. **If any MISSING** → output structured report, stop. Format:

   ```
   GATE: STOP — missing premises
   Missing items:
     - <item>: <why it's needed>
     - ...
   Proposed fix: <which vault note / ticket / user question would close this>
   ```

4. **If all premises PASS** → emit `GATE: PASS` and proceed to invoke
   `test-design-techniques` (and `async-event-testing` if module touches cron /
   notifications / RabbitMQ).
5. **After generation, re-enter the gate**: every drafted TC has a technique
   tag and the artifacts the technique requires (boundaries listed for BVA,
   grid present for DT, etc.). Strip / fix anything that fails.

## Outputs

- `GATE: PASS` (proceed) or `GATE: STOP` (with a missing-items list).
- Per-TC technique-tag audit row appended to the generation log.

## References

- `references/premise-validation-checklist.md` — full 9-item checklist with worked examples
- `docs/tasks/digest/phase-c-problem-report.md` — canonical failure case
- `docs/test-design/extracted-guidelines.md` §1, §2 — premise contract origin
- `docs/test-design/src/naodeng-awesome-qa-skills/NOTES.md` — incomplete-input rule source
- `.claude/skills/test-design-techniques/SKILL.md` — technique catalog (BVA, EP, DT, ST, PW, EG, UC)
- `.claude/skills/test-data-preparation/SKILL.md` — premise item 5 (test data mode) is delegated here
