بنقرة واحدة
test
Generate test plan, test cases, test data fixtures, and Playwright E2E tests mapped to acceptance criteria.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Generate test plan, test cases, test data fixtures, and Playwright E2E tests mapped to acceptance criteria.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | test |
| description | Generate test plan, test cases, test data fixtures, and Playwright E2E tests mapped to acceptance criteria. |
| argument-hint | [--plan-only | --e2e-only] |
| context | fork |
| agent | generator |
/test
/test --plan-only
/test --e2e-only
/test — generate all test artefacts: plan, cases, fixtures, and E2E tests./test --plan-only — generate test plan, test cases, and test data fixtures (everything in specs/test_artefacts/). Stop before writing Playwright files. Does NOT require source code — only needs stories from /spec./test --e2e-only — skip plan/cases, go straight to Playwright E2E generation. Use when plan already exists and source code has been built.For --plan-only (test planning phase — runs parallel with /design):
specs/stories/ — user stories with acceptance criteria (one file per story).project-manifest.json — for service configuration context.For full run or --e2e-only (Playwright generation — runs after /auto):
specs/stories/ — user stories with acceptance criteria.backend/ and/or frontend/ — source code that the E2E tests will target.project-manifest.json — for base URLs and service port configuration.specs/test_artefacts/ — test plan, cases, and fixtures (generated by --plan-only).If required prerequisites are missing, stop and report what is absent.
Read .claude/skills/code-gen/SKILL.md for quality principles (typing, error handling, test structure), plus .claude/skills/code-gen/references/test-strategy.md for the test-layer model and boundary checklist.
Read .claude/skills/evaluate/SKILL.md for the contract verification approach used by the evaluator.
Read .claude/skills/evaluate/references/playwright-patterns.md for all selector, assertion, and waiting rules — it is the single source of truth (shared with /evaluate). Read .claude/skills/code-gen/references/test-playwright.md secondarily, for config and file-structure patterns only.
Read every story file in specs/stories/. For each story, extract:
Every test case generated must trace to a specific AC. Record the mapping explicitly.
Spawn the generator agent with the full context: story files, source code structure, and the patterns read in Step 1. Point it at .claude/skills/test/references/test-authoring.md for the test-plan / test-case / Playwright-E2E / fixture authoring guidance.
The agent operates in the forked context. It must not modify source code.
specs/test_artefacts/)Create specs/test_artefacts/ if it does not exist.
specs/test_artefacts/test-plan.md
specs/test_artefacts/test-cases.md
specs/test_artefacts/test-data/
orders.json, users.json)."foo", 123, or "test" as stand-in values.--plan-only mode, fixtures are schema-free: /design runs in parallel, so specs/design/api-contracts.md may not exist yet. Derive field names from story acceptance criteria, and reconcile fixtures against api-contracts.md in Step 5 (or when /build Phase 4 begins) — field-name drift between fixtures and contracts is expected until then and must be resolved before any Playwright file uses them.specs/test_artefacts/test-traces.json — the trace spine: one entry per test case, each tracing to the acceptance-criterion id(s) it verifies:
[
{ "id": "TC-1", "text": "register returns 201 on valid input", "traces": ["E1-S1-AC1"] },
{ "id": "TC-2", "text": "register rejects duplicate email with 409", "traces": ["E1-S1-AC2"] }
]
Every test case must trace to at least one {story}-AC{n} id from specs/stories/story-traces.json. A test case tracing to no AC tests behavior nobody asked for; an AC with no test case is an untested requirement.
specs/stories/story-traces.json exists]Build the AC index (the acceptance criteria are the upstream this layer must cover) and run the deterministic check:
# Flatten every story's acceptance-criterion ids into the upstream index
node -e "const fs=require('fs');const s=JSON.parse(fs.readFileSync('specs/stories/story-traces.json'));fs.writeFileSync('specs/test_artefacts/ac-index.json',JSON.stringify(s.flatMap(x=>(x.acs||[]).map(id=>({id})))))"
node .claude/scripts/trace-check.js \
--required specs/test_artefacts/ac-index.json \
--downstream specs/test_artefacts/test-traces.json \
--layer test \
--out specs/reviews/test-grounding.json
specs/reviews/test-grounding.json is a hard gate: any net_new (test case tracing to no AC) or dropped (AC with no test case — an untested requirement) blocks. Resolve before reporting the plan. (Skip when story-traces.json does not exist.)
If --plan-only: STOP HERE. Steps 4–4.5 (plan + cases + fixtures + trace spine + grounding gate) are the complete deliverable for the planning phase. Do not proceed to Playwright generation — source code does not exist yet. Report the generated artifacts and exit.
e2e/)Create e2e/ at the project root if it does not exist.
For each story, generate a Playwright test file named {story-id}.spec.ts.
Selector and assertion rules are single-sourced in .claude/skills/evaluate/references/playwright-patterns.md (the canonical Playwright reference, shared with /evaluate). The rules below summarize it — defer to that file if they differ.
Rules for Playwright tests:
getByRole, getByLabel, getByText — never CSS selectors or XPath.waitForTimeout. Use expect(locator).toBeVisible() with retry.test() block maps to exactly one acceptance criterion. The test name must reference the AC.specs/test_artefacts/test-data/.Copy the config template:
cp .claude/templates/playwright.config.template.ts playwright.config.ts
Fill in the baseURL values from project-manifest.json. Configure webServer entries for each service that needs to be running during tests.
npx playwright install --with-deps chromium
npx playwright test
All tests must pass on the first run against the target environment. A failing test that was written incorrectly is not acceptable — fix the test before reporting results.
| Path | Purpose |
|---|---|
specs/test_artefacts/test-plan.md | Sprint test plan |
specs/test_artefacts/test-cases.md | Full test case inventory mapped to ACs |
specs/test_artefacts/test-data/ | JSON fixture files per domain entity |
specs/test_artefacts/test-traces.json | Trace spine: each test case → AC id(s) |
specs/reviews/test-grounding.json | (when story-traces exists) deterministic AC-coverage verdict |
e2e/{story-id}.spec.ts | Playwright tests per story |
playwright.config.ts | Playwright configuration |
getByRole. CSS selectors break on refactors. Use ARIA-based selectors exclusively.waitForTimeout is banned. Network or animation delays must be handled with expect(...).toBeVisible() or waitForResponse.Discover and map an existing codebase before planning or changing it.
Change the behavior of existing code — story-driven by default, or --issue N for a GitHub bug fix. Test-first, full verification, code review.
Use when a planned change touches persisted data shape — ORM models, migration files, schema definitions, serialized formats, or message contracts — in /change, /refactor, or /implement on an existing codebase. Routes schema changes through expand-contract and proves reversibility before any deploy.
Generate production code and tests for a story group using agent teams for parallel execution.
Refactor existing code for quality, performance, or maintainability. Enforces core quality principles with ratchet gate.
Use when bumping a dependency version — package.json, pyproject.toml, requirements, or lockfile changes — in an existing codebase. Classifies the bump, audits the usage surface from the code graph, and isolates the upgrade in its own proven commit.