From tdk-test-api
Generate per-endpoint test case files and execution manifest from API test plan.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tdk-test-api:tdk-test-api-generate-testcaseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Read `api-test-plan.md` and generate per-endpoint `*.testcases.md` files + `test-execution-plan.yaml` manifest. Output consumed by `/tdk-test-api-gen-code-playwright-ts`.
Read api-test-plan.md and generate per-endpoint *.testcases.md files + test-execution-plan.yaml manifest. Output consumed by /tdk-test-api-gen-code-playwright-ts.
/tdk-test-api-generate-testcase {feature-id} # Generate from plan
/tdk-test-api-generate-testcase {feature-id} --sub-workspace backend # Target sub-workspace
/tdk-test-api-generate-testcase {feature-id} --force # Overwrite existing
If testcase files already exist AND user provides an update description:
api-test-plan.md — from /tdk-test-api-plan (required).specify/templates/test/api-test/api-testcases-template.md.tpl — template structureCreates in {output_dir}/{resource}/:
| Error | Action |
|---|---|
api-test-plan.md not found | STOP: "Run /tdk-test-api-plan {feature-id} first" |
| Plan missing required sections | STOP with list of missing sections |
| Template not found | STOP: "Template missing. Check .specify/templates/test/api-test/api-testcases-template.md.tpl" |
Run environment script:
bun .specify/scripts/ts/src/commands/test-api/testcase-env.ts <feature-id> [--sub-workspace {NAME}] [--force]
Parse JSON output -> Store all fields. If error -> STOP and report to user.
If HAS_EXISTING_TESTCASES = true AND user provided update prompt:
If HAS_EXISTING_TESTCASES = true AND no update prompt AND FORCE_MODE = false:
If HAS_EXISTING_TESTCASES = false OR FORCE_MODE = true -> Continue.
api-test-plan.mdFor each unique resource (from endpoint paths):
{API_TEST_DIR}/{resource}/
Process one endpoint at a time (per-endpoint focused prompt for quality).
For each endpoint:
api-testcases-template.md.tplHappy Path (always):
Validation (for POST/PUT/PATCH):
Auth & Authorization (if auth_required):
Edge Cases (always):
{resource}/{resource}-{action}.testcases.mdCreate test-execution-plan.yaml from plan's "Suggested Execution Order":
phases:
- name: setup
parallel: false
files: [setup/auth.setup.ts]
- name: create-resources
parallel: true
depends_on: [setup]
files:
- users/users-create.api.spec.ts
- orders/orders-create.api.spec.ts
- name: read-after-create
parallel: true
depends_on: [create-resources]
files:
- users/users-detail.api.spec.ts
- users/users-list.api.spec.ts
- name: update-resources
parallel: true
depends_on: [read-after-create]
files:
- users/users-update.api.spec.ts
- name: delete-resources
parallel: false
depends_on: [update-resources]
files:
- users/users-delete.api.spec.ts
Mapping rules:
create-* phaseread-* phaseupdate-* phasedelete-* phase (always sequential, always last)depends_on follows CRUD lifecycle orderTest Cases Generated
====================
Resources: {n}
Total test case files: {m}
Total test cases: {tc_count}
Files created:
- {resource}/{resource}-{action}.testcases.md ({n} TCs)
...
- test-execution-plan.yaml
Execution phases: {p}
- setup (1 file)
- create-resources ({n} files, parallel)
...
Next: /tdk-test-api-gen-code-playwright-ts {feature-id}
| Pattern | When | TC Count |
|---|---|---|
| CRUD Happy Path | POST/GET/PUT/DELETE endpoints | 1-2 per endpoint |
| Field Validation | POST/PUT with body | 3-8 per endpoint |
| Auth (no token) | Auth-required endpoints | 1 |
| Auth (expired) | Auth-required endpoints | 1 |
| Auth (wrong role) | Role-based endpoints | 1-3 |
| Not Found | Detail/Update/Delete | 1 |
| Duplicate | Create endpoints | 1 |
| Pagination | List endpoints | 1-2 |
Cap: ~15 test cases per endpoint. Focus on P1/P2 priority.
| Error | Solution |
|---|---|
| api-test-plan.md not found | Run /tdk-test-api-plan first |
| Plan validation failed | Fix plan sections, re-run |
| Template missing | Check .specify/templates/ |
| Endpoint with no clear action | Default to "custom" action |
/tdk-test-api-plan — Generate the input plan/tdk-test-api-gen-code-playwright-ts — Generate Playwright TS from testcasesnpx claudepluginhub vinhltt/tdk --plugin tdk-test-apiWhole-repo audit for over-engineering: finds dead code, unnecessary abstractions, stdlib-replaceable dependencies. Outputs ranked findings and net line/dep savings.