Test pack builder

From lightspeedwp/.github · View interactive version

Test pack builder is an AI agent skill from the GitHub repository lightspeedwp/.github. Use when the user wants to turn PRDs, acceptance criteria, design evidence, repository context, or QA inputs into a structured test pack with requirement extraction, traceability, human-readable cases, review-before-code gating, and optional Playwright generation.

How to use this skill

Skill file

Test Pack Builder

Purpose

Use this skill to produce a review-ready test pack before code generation. The skill is for workflows where the agent must extract grounded requirements, preserve evidence links, generate human-readable test cases, and only move to Playwright code after review is complete or explicitly waived.

Do not use this skill for generic repo analysis, ad hoc bug triage, or one-off code generation with no traceability requirement.

Use This Skill For Requests Like

Core Rules

  1. Ground every requirement in the current request or supplied evidence.
  2. Keep confirmed requirements separate from assumptions, inferred risks, and suggested extra coverage.
  3. Prefer human-readable test cases before code unless the user explicitly asks to skip that gate.
  4. Preserve traceability from source evidence to requirement IDs, test cases, and planned Playwright outputs.
  5. If sources conflict, stop and ask for a decision before finalising the pack or generating code.
  6. If evidence is incomplete, produce a draft pack with a gap list instead of pretending the input is complete.

Input Types

The skill can work from any combination of:

When multiple inputs are present, treat user instructions as highest priority, then approved product and design evidence, then repository and QA context.

Workflow

0. Pre-flight and environment contract

Before building the pack:

MCP, Chrome DevTools MCP, Figma, BugHerd, GitHub) and the degraded path for any

that are not, so a missing integration is not discovered at write time. Only

list capabilities actually wired into the session.

(base URL, sandbox/payment mode, test card(s), test customer, seeded

product(s), known coupon(s), shipping/tax/discount rule source, Subscriptions

test data, accessibility baseline, console-error baseline). Fill each field from

evidence or mark it as a gap and request it — never fabricate a value.

Order-placing cases stay blocked until sandbox mode and a test card are

supplied. The two baseline fields are captured from an audit run, never guessed;

without them, an a11y or console gate is proposed rather than asserted.

1. Build the evidence set

List the sources that are actually present and usable for this request.

For each source, note:

If a source is mentioned but not actually provided, do not act as though it was reviewed.

2. Extract requirements

Extract only requirements that are explicit or clearly evidenced.

For each requirement:

Do not split one criterion into many IDs unless the evidence clearly supports separate traceable requirements.

Performance rules are extracted, then routed. A speed, Core Web Vitals,

page-weight, or Lighthouse-score requirement gets an ID and evidence like any

other, but produces no test case here: record its planned output as

deferred → pagespeed-agent and name that agent as owner in Assumptions and Gaps.

Do not convert it into a wall-clock timing assertion, do not invent a threshold the

source did not state, and do not present lab metrics from a slow staging

environment as a production baseline.

3. Separate non-requirements

Keep these in their own sections instead of mixing them into confirmed requirements:

project's scope excludes

Never label these as confirmed requirements.

Scope exclusions are evidence, not gaps. If the source says a category of work

is out of scope, record it as an out-of-scope note and generate no coverage for it.

House standards (an org accessibility baseline, coding standards, a security

policy) govern how in-scope work is built; they never create new deliverables. Do

not promote one into a Confirmed Requirement for excluded work, and do not write

the cases and seek approval afterwards — raise it as a change-control item naming

the standard, the exclusion it collides with, and the coverage that would be

needed. "It is good practice" is not authorisation.

4. Generate the human-readable test pack

Create test cases before code unless the user explicitly asks to skip that step.

Each test case should include:

criterion rather than a generic "accessibility check"

When repeated context is unchanged across many cases, keep the structure but avoid unnecessary duplication.

5. Add a traceability matrix

Map:

If code has not been authorised yet, mark the planned Playwright output as proposed rather than complete.

A requirement routed to another agent records that disposition in the planned-output

column (for example deferred → pagespeed-agent) instead of a test case ID. Every

requirement is accounted for; none is left unmapped.

6. Persist the pack

Write the completed pack to a conventional path. Prefer a project-configured location if one is set;

otherwise use .github/reports/test-packs/<flow>-<YYYY-MM-DD>.md when the repo has a .github/ control plane,

or test-packs/<flow>-<YYYY-MM-DD>.md when it does not (this agent is portable and must not assume a .github/ layout).

Return the written path so the reviewer knows where the artefact lives. On a later failure-triage run,

update the same file in place rather than starting a new one. If writing is not possible, say so and fall back to inline output — do not silently skip this step.

7. Enforce review-before-code

Unless the user already authorised code generation in the current request:

Skip this gate only when the user explicitly asks for direct code generation or says review is already complete.

8. Generate Playwright code only when authorised

If the user has authorised continuing:

playwright.config sketch (baseURL from env, target browsers/viewports,

failure traces), a .env.example with the keys the specs read (placeholders

only, never real secrets), and a cart/checkout fixture with a @stateful guard

for order-placing cases. Derive it from the Environment & Test-Data Contract;

do not invent credentials or product data.

gated specs: @axe-core/playwright scoped per page/widget and tagged @a11y,

metadata assertions over a site-derived URL set, and a per-page console-error

check. Assert no new violations/errors against the recorded baselines rather

than zero outright; where a baseline is still a gap, emit the spec as proposed

and say so.

If the approved pack still has open questions, carry them forward as blockers or TODO review notes rather than guessing.

Default Output Structure

When creating a full test pack, use this section order unless the user asks for a different format:

  1. Scope Summary
  2. Sources Used
  3. Environment & Test-Data Contract
  4. Confirmed Requirements
  5. Assumptions and Gaps
  6. Human-Readable Test Cases
  7. Traceability Matrix
  8. Review Gate / Next Step

Right-size to scope by requirement count (the primary driver): when the confirmed-requirement count is ≤ 4, default to a condensed pack — Scope Summary, Environment & Test-Data Contract, a merged Requirements + Test Cases table, Traceability, and the Review Gate — keeping requirement IDs and evidence links. Use the full form when there are > 4 confirmed requirements, a whole PRD, or a stateful/multi-gateway flow; a single named flow that still yields > 4 requirements (e.g. checkout) takes the full form — being "single" does not by itself force condensed. State which form you used.

Output Template

Use this compact template shape:

Scope Summary

Sources Used

Environment & Test-Data Contract

| Field | Value or gap |

|---|---|

| Base URL / environment | ... |

| Payment / sandbox mode | ... |

| Test card(s) | ... |

| Test customer | ... |

| Seeded product(s) | ... |

| Known coupon(s) | ... |

| Shipping / tax / discount rule source | ... |

| Subscriptions test data | ... if in scope |

| Accessibility baseline | ... recorded axe violations, or gap |

| Console-error baseline | ... known console errors, or gap |

Confirmed Requirements

Assumptions and Gaps

Human-Readable Test Cases

1. ...

2. ...

Traceability Matrix

| Requirement ID | Evidence | Test Case IDs | Planned Playwright Coverage |

|---|---|---|---|

| RQ-001 | ... | TC-001 | proposed spec/module |

| RQ-002 | ... | — | deferred → pagespeed-agent |

Review Gate / Next Step

Decision Rules

Quality Bar

Before finishing, check that:

another agent; none is silently dropped

into timing assertions

excludes; such items are change-control entries, not requirements, and carry no

test cases

_This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP._

Automation Docs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.