/cstk:e2e-integration-flow [feature/flow to test, or path to its spec/UC]from cstk
Authors and runs full-stack E2E integration tests with Playwright, verifying effects at UI, network/API, database, message queue, and side effect layers. Use when you need to prove a feature works across the whole stack.
Ships in cstk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Author and run end-to-end integration tests that prove a feature actually works across the whole stack — not just that a button is clickable, but that every meaningful action produces the right effect at every layer it touches: UI → network/API → database → message queue → downstream side effects.
The driver is Playwright (browser automation for the frontend). The
differentiator is that Playwright is only the entry point: each UI step is
paired with assertions in the layers behind it. A test that fills a form and
sees a toast is a UI test. A test that fills a form, sees the toast, confirms
the row landed in the database with the right fields, and confirms the
user.created event reached the queue — that is an integration flow test.
Scope & limits. This skill builds and runs automated functional integration tests. It is not a load/performance test, not a security pentest (use
owasp-security), and not a substitute for unit tests. It assumes you can reach a running stack (frontend + backend + datastores) in a test/staging environment. Stack-agnostic core with concrete defaults — adapt commands and selectors to the project you are in.
$ARGUMENTS is the feature/flow to test (e.g. "cadastro de cliente", "checkout
com cupom") or a path to its spec/UC (e.g. docs/specs/cadastro/spec.md,
docs/02-requisitos-casos-uso/UC-CAD-001.md). If empty, ask what flow to cover
and whether a spec/UC exists.
Most flaky, low-value e2e suites fail because they treat the UI as the whole system. The fix is to think of the feature as an ordered flow contract:
For each user action, there is an observable consequence in one or more layers. The test asserts that consequence — at the deepest layer that is practical — before moving to the next action.
A registration flow is not "click, type, click". It is:
| # | User action | UI effect | Network | Database | Queue / async | Downstream |
|---|---|---|---|---|---|---|
| 1 | Log in | redirect to dashboard | POST /auth 200 + cookie | session row (opt) | — | — |
| 2 | Open "New customer" | form renders | GET /form-meta 200 | — | — | — |
| 3 | Submit invalid email | inline error, no submit | no POST fired | no new row | — | — |
| 4 | Submit valid form | success toast, redirect | POST /customers 201 | customers row w/ fields | customer.created on exchange | welcome email enqueued |
| 5 | (async) | list shows new customer | GET /customers includes it | — | consumer ACKed | email sent |
Building this table first is the core of the skill. It turns a vague "test the registration" into a precise, layered set of assertions — and it exposes exactly which verifications are missing in a typical UI-only test.
Before writing a line of test code, establish the ground truth. Do not assume.
docs/specs/*/spec.md,
docs/02-requisitos-casos-uso/UC-*.md, or ask the user to describe the
happy path and the rules..env.test, docker-compose.*.yml, playwright.config.*, existing
e2e//tests/e2e/ folders, CI workflow.npx playwright --version)? Is there a config, an auth-setup project,
fixtures, a seeded test user? Reuse the project's conventions — do not
reinvent a harness that already exists.Capture findings as a short context block. If a prerequisite is missing (no test DB, no broker access, frontend not buildable), surface it now — a flow test you cannot verify end-to-end is worth flagging before writing it.
For a multi-step flow, create tasks (TaskCreate) to track each segment.
Produce the table above for the target flow. One row per user action.
— where a
layer genuinely isn't touched (that is information, not laziness).This table is the test plan. Keep it in the test file as a comment or in a
sibling FLOW.md so the coverage is auditable.
A flow has more than its happy path. Expand each form/decision point into cases:
| Category | What to cover | Example |
|---|---|---|
| Happy path | The full flow end-to-end, all layers verified | valid registration persists + emits event |
| Field validation | Every rule from the spec: required, format, length, uniqueness, cross-field | empty name, bad email, duplicate CPF, password mismatch |
| Boundary / edge | Min/max, special chars, unicode, very long input, leading/trailing space | 255-char name, emoji, " [email protected] " trims |
| Error paths | Backend rejects (409/422/500), network failure, timeout | duplicate → 409 surfaces a friendly error, no row, no event |
| Authz / state | Wrong role, unauthenticated, already-done | logged-out user redirected to login |
| Idempotency / async | Double-submit, eventual consistency, retry | double-click submits once; list reflects new row after consumer runs |
For each validation case assert the negative space too: an invalid submit must produce no network call (or a 4xx that creates no DB row and no event). Forgetting the negative assertion is the most common hole — the UI shows an error and the bad data still got written.
Goal: deterministic, isolated, fast-to-debug tests. Key pillars (deep patterns
in references/playwright-patterns.md):
storageState; flow tests start authenticated. Never log in inside
every test unless login is the flow under test.trace: 'on-first-retry', screenshots and video
on failure — the trace viewer is how you triage which layer broke.If the project already has a config/auth-setup/fixtures, extend them. Only scaffold from scratch when nothing exists.
Translate the flow contract into Playwright, one action → assertion pair at a time. The non-negotiables:
getByRole, getByLabel,
getByPlaceholder, getByText — they survive refactors and assert
accessibility. Use data-testid only as a last resort for ambiguous nodes.await expect(locator).toBeVisible(),
toHaveText, toHaveURL — they auto-retry until the condition holds.
Never waitForTimeout/fixed sleeps; they are the #1 source of flake.waitForResponse/expect(response)
to confirm the API was hit with the right status — bridges UI to backend. For
the negative validation cases, assert the request was never sent.test.step() to label segments so failures point at the right
action.test('register customer — persists and emits customer.created', async ({ page, db, queue }) => {
const email = uniq('e2e+%[email protected]'); // unique per run
const listener = await queue.listen('customer.created'); // bind BEFORE acting
await test.step('open form', async () => {
await page.getByRole('link', { name: 'Novo cliente' }).click();
await expect(page.getByRole('heading', { name: 'Novo cliente' })).toBeVisible();
});
await test.step('submit valid form', async () => {
await page.getByLabel('Nome').fill('Ada Lovelace');
await page.getByLabel('E-mail').fill(email);
const [res] = await Promise.all([
page.waitForResponse(r => r.url().endsWith('/customers') && r.request().method() === 'POST'),
page.getByRole('button', { name: 'Salvar' }).click(),
]);
expect(res.status()).toBe(201);
await expect(page.getByText('Cliente criado')).toBeVisible();
});
await test.step('verify database', async () => {
const row = await db.one('select * from customers where email = $1', [email]);
expect(row.name).toBe('Ada Lovelace'); // assert the persisted, transformed fields
});
await test.step('verify event reached the queue', async () => {
const msg = await listener.next({ timeoutMs: 10_000 }); // poll, never sleep
expect(msg.routingKey).toBe('customer.created');
expect(msg.payload.email).toBe(email);
});
});
This is what separates an integration flow test from a UI test. Deep recipes in
references/backend-async-verification.md.
psql / a pg fixture).
Assert the row exists with the expected, transformed fields — not just a
count. For negative cases assert it does not exist. Always clean up what
the test created (afterEach/afterAll, or a tagged teardown).expect.poll(...) / a waitFor(predicate, timeout)
helper. State the timeout; if it's exceeded, that's a real failure, not flake.npx playwright test # full run
npx playwright test --ui # watch/debug interactively
npx playwright show-trace ... # open the trace of a failed run
npx playwright test -g "register customer" # one flow
Triage failures by the layer that broke, using the flow contract as the map:
Stabilize before declaring done: re-run the suite (--repeat-each=3 on the new
specs) to flush flake. A test that isn't repeatable isn't a test.
Close with a concise report (not just "tests pass"):
bugfix).run skill (launches the app and drives it).bugfix.checklist /
analyze.owasp-security.references/playwright-patterns.md —
config, auth-state reuse, fixtures, locators, web-first assertions, network
interception, data isolation, CI wiring.references/backend-async-verification.md
— direct DB assertions & cleanup, RabbitMQ verification (temp-queue bind,
management API, side-effect proof), eventual-consistency polling helpers.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jotjunior/cstk --plugin cstk24 skills in this plugin
/advisorStrategic critique of an idea/plan/decision. Triggers: "me aconselhe", "critique meu plano", "avalie minha ideia", "feedback estrategico", "advisor". Skip for technical tasks (use bugfix/execute-task)./agente-00c-runtimeInternal POSIX runtime helpers for agente-00c/feature-00c orchestrators (state, lock, validation, hashes, secrets filter). NOT user-invocable./analyzeCross-artifact SDD consistency analysis (spec/plan/tasks/constitution) — read-only. Triggers: "analyze", "cross-check", "auditar artefatos", "validar spec vs tasks". Skip for single-document validation (use validate-documentation)./apply-insightsApply Claude Code usage insights to current project — improve CLAUDE.md, hooks, workflows. Triggers: "aplicar insights", "otimizar fluxo", "melhorar claude.md". This is the APPLY step that consumes /insights output, not the native /insights command itself./briefingStructured project discovery interview (vision, users, constraints, stack). Triggers: "briefing", "discovery", "iniciar projeto", "kickoff". Skip if briefing already complete and user did not ask for update./bugfixMulti-layer bug investigation and fix (traces across services before patching). Triggers: "bugfix", "fix bug", "corrigir bug", "debug", "investigar bug". Skip for new feature work (use execute-task/specify).Other plugins' skills for the same job