一键导入
custom-qa
Generate test suites from planning artifacts before implementation. Use when the user says "qa to done", "run qa cycle", or "write the tests".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate test suites from planning artifacts before implementation. Use when the user says "qa to done", "run qa cycle", or "write the tests".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Orchestrate the full planning pipeline from idea to backlog-ready epics. Use when the user says "plan to backlog", "run planning pipeline", or "create the full plan".
Orchestrate the full build cycle from sprint planning to implemented code with docs. Use when the user says "dev to done", "run build cycle", or "implement the backlog".
Document brownfield projects for AI context. Use when the user says "document this project" or "generate project docs"
AI-assisted development, testing, and reverse engineering through structured agent collaboration
Create, import, browse, and maintain design system components and tokens
| name | custom-qa |
| description | Generate test suites from planning artifacts before implementation. Use when the user says "qa to done", "run qa cycle", or "write the tests". |
This workflow generates comprehensive test suites — unit (Vitest), integration (Vitest), and E2E (Playwright) — from planning artifacts produced by custom-plan. It runs in parallel with custom-dev, not after it. Tests are the specification: they're expected to fail until implementation catches up. custom-dev must make them pass without modifying them.
Args: Accepts an optional epic identifier to test a single epic, or no args to process all epics. Supports --layer unit|integration|e2e to generate only one test layer, --story {id} to scope to a single story within an epic, and --validate to run in post-implementation mode (detect real bugs and file backlog items for custom-dev).
Output: Failing test suites across all three layers (unit, integration, E2E), a test plan per epic, a coverage summary in {test_artifacts}/, and — when --validate is used — bug tickets in backlog/to-do/ for any assertion failures that indicate real bugs.
You are a test architecture strategist who generates specification-first test suites from design documents. You think in terms of acceptance criteria, contract boundaries, and coverage risk. You reason about what should be tested before prescribing how to test it.
it('should display appointment form when user clicks book') not it('test form visibility')Load config from {project-root}/_bmad/bmm/config.yaml and resolve:
{user_name}, {communication_language}, {document_output_language}{planning_artifacts} — where epics and stories live{test_artifacts} = {project-root}/_bmad-output/test-artifacts — where test plans and summaries go{project_knowledge} — existing project docs for contextSearch for **/project-context.md. If found, load as foundational reference.
Download open GitHub issues into the backlog. This keeps backlog/to-do/ in sync with issues opened by other contributors.
github_repo MCP tool to list all open GitHub issuesbacklog/to-do/{number}-*/ or backlog/done/{number}-*/backlog/to-do/{number}-{slug}/00-request.md with the issue title, body, and URLbacklog/README.md under To-Do with columns # and Title onlyBacklog numbering convention:
{number}-{slug}/0-: 0-{number}-{slug}/ (e.g., 0-210-comprar-producto)Before proceeding, validate prerequisites. If any check fails, print a diagnostic with next steps and stop.
{project-root}/_bmad/bmm/config.yaml exists and is parseable{planning_artifacts}/epics/ exists and contains at least one epic directoryvitest is in project dependencies; playwright config exists at apps/web-e2e/playwright.config.tsIf planning artifacts are missing, suggest: "Run custom-plan first to generate epics and stories, then come back here."
Check {test_artifacts}/ for existing state to determine where to resume:
| Artifact | File | Indicates |
|---|---|---|
| Test plan | {test_artifacts}/test-plan-{epic}.md | Planning done for epic |
| QA status | {test_artifacts}/qa-status.yaml | Per-epic/story progress |
If qa-status.yaml exists, parse it to find the current state — which epics/stories have tests written. Resume from the next incomplete item.
If no state exists, start from Step 1.
Resolve scope from user arguments:
--layer was provided (unit, integration, or e2e), generate only that test layer. Otherwise, generate all three.--story was provided, generate tests only for that story within the scoped epic.--force was provided, regenerate tests even if qa-status.yaml shows them as complete.--validate was provided, run in post-implementation mode. After running tests, classify failures and file bug tickets in backlog/to-do/ for any assertion failures that indicate real bugs (not missing implementation). custom-dev will pick these up.Once scope is determined, begin the pipeline.
Tests are written from acceptance criteria and technical architecture only — not from implementation. This means:
Tests will fail. That is correct and expected. custom-dev treats these tests as the contract it must satisfy.
custom-qa must never create, modify, or delete implementation source files. Its write scope is strictly limited to:
*.test.ts(x), *.integration.test.ts(x), *.spec.ts){test_artifacts}/)backlog/to-do/)backlog/README.md)When filing bug tickets, use the 0- prefix for the ticket number: 0-{number}-{slug}/. Find the next number by scanning the highest existing 0-* local folder number and incrementing by one.
If a test fails because of a bug in the application, file a backlog item — do not fix the application code. If a test cannot compile because an implementation module doesn't exist yet, that is expected in spec-first mode — do not create the module.
Execute steps in sequence per epic. Between steps, verify the output was produced, then immediately proceed — no pause, no menu, no confirmation needed.
For each epic, first extract structured data from story files:
python3 ./scripts/extract-criteria.py {planning_artifacts}/epics/{epic}/stories/ -o {test_artifacts}/criteria-{epic}.json
If any stories are flagged as stories_missing_criteria > 0, note them in the test plan as untestable and proceed with the stories that have criteria.
Then produce a test plan at {test_artifacts}/test-plan-{epic}.md.
Goal: Decide what to test at each layer and why. Map acceptance criteria → test cases → test layer (unit / integration / E2E).
Additional inputs:
{planning_artifacts}/architecture.md{planning_artifacts}/ux-design*.mdapps/web/src/ for component structure, apps/web-e2e/tests/ for Playwright patterns)The test plan should cover:
These two steps are independent — both read from the test plan (Step 1 output) and write to different file patterns. Run them in parallel when possible (e.g., using subagents). If parallel execution is unavailable, run sequentially.
Skip either step if the --layer filter excludes it.
Step 2 — Unit Tests (Vitest):
Generate unit test files co-located with the code they'll target.
Goal: Cover the component and function API surface described in stories and architecture. Each test file targets a single module.
Conventions:
apps/web/src/**/*.test.ts(x) — co-located with the source they testdescribe, it, expect)@testing-library/react if available, otherwise Vitest aloneit('should display appointment form when user clicks book')Step 3 — Integration Tests (Vitest):
Generate integration test files for cross-module flows.
Goal: Verify that modules interact correctly — data flows through loaders, components compose properly, service boundaries work.
Conventions:
apps/web/src/**/*.integration.test.ts(x)Wait for both to complete before proceeding.
Skip if --layer filter excludes e2e.
Invoke bmad-qa-generate-e2e-tests with the epic's stories as context. If that skill is unavailable, generate E2E tests directly using existing Playwright patterns from the test plan.
Goal: Cover user journeys end-to-end as described in acceptance criteria.
Conventions:
apps/web-e2e/tests/{feature}.spec.tsplaywright.config.ts with baseURL at localhost:5173)Run the test suites to confirm they are syntactically valid — they should compile and execute, even if assertions fail.
Run only the test files generated in the current run (not the full suite):
# Unit + Integration — should compile, failures expected
pnpm vitest run {generated-test-files} --reporter=verbose 2>&1 || true
# E2E — should compile (may skip if no dev server)
cd apps/web-e2e && npx playwright test {generated-spec-files} --reporter=list 2>&1 || true
Fix any syntax or import errors in the generated test files — the tests must be runnable. Never modify implementation source files to make tests pass. Assertion failures are expected and correct in spec-first mode.
Then run python3 ./scripts/count-tests.py {test_artifacts}/ --epic {epic} to collect test metrics for the coverage summary.
If --validate mode is active, proceed to Step 5b (Bug Filing) before the coverage summary.
Skip this step unless --validate was provided.
Analyze test failures from Step 5 and file bug tickets for real bugs. A failure is a real bug when:
For each real bug found:
Determine the next bug number — scan both backlog/done/ and backlog/to-do/ for the highest existing number and increment by 1:
HIGHEST=$(ls -d backlog/done/*/ backlog/to-do/*/ 2>/dev/null | grep -oE '[0-9]+' | sort -n | tail -1)
NEXT=$((HIGHEST + 1))
Create the bug ticket at backlog/to-do/{NEXT}-{slug}/00-request.md:
# Bug: {descriptive title}
## Description
{What's wrong — expected behavior vs actual behavior}
## Reproduction Steps
1. {How to trigger the bug}
## Expected Behavior
{What the acceptance criteria say should happen}
## Actual Behavior
{What actually happens based on test output}
## Failing Test
- **File**: `{test file path}`
- **Test**: `{test name}`
- **Story**: `{story reference if available}`
## Error Output
{Test runner error output}
## Priority
{Critical / High / Medium — based on acceptance criteria importance}
## Labels
bug, qa-discovered
Update backlog/README.md — add the new bug to the To-Do table.
Log filed bugs in {test_artifacts}/bugs-filed-{epic}.md for the coverage summary.
Produce a summary at {test_artifacts}/qa-summary-{epic}.md:
# QA Summary — Epic: {epic name}
## Test Counts
- Unit tests: N files, M test cases
- Integration tests: N files, M test cases
- E2E tests: N files, M test cases
## Coverage Map
| Story | Unit | Integration | E2E |
|-------|------|-------------|-----|
| story-1 | 3 tests | 1 test | 2 tests |
| ... | ... | ... | ... |
## Status
Tests are syntactically valid: ✅/❌
Assertion failures (expected — no implementation yet): N
## Test Locations
- Unit: apps/web/src/**/*.test.ts(x)
- Integration: apps/web/src/**/*.integration.test.ts(x)
- E2E: apps/web-e2e/tests/*.spec.ts
Update {test_artifacts}/qa-status.yaml with the epic's completion status.
Repeat Steps 1–6 for each remaining epic in scope.
When all epics are processed:
custom-dev must make these tests pass without modifying them--validate mode was active: summarize all bug tickets filed — count, locations in backlog/to-do/, and severity breakdown. Remind that custom-dev will pick these up automaticallybmad-sprint-status for an overview, or start custom-dev to implement