From tdk-test-api
Generate API test plan from endpoints discovered via OpenAPI specs, codebase scouting, or manual input.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tdk-test-api:tdk-test-api-planThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate `api-test-plan.md` from API endpoints. Discovers endpoints via OpenAPI spec, codebase scouting, or manual input. Output consumed by `/tdk-test-api-generate-testcase`.
Generate api-test-plan.md from API endpoints. Discovers endpoints via OpenAPI spec, codebase scouting, or manual input. Output consumed by /tdk-test-api-generate-testcase.
/tdk-test-api-plan {feature-id} # Auto-discover endpoints
/tdk-test-api-plan {feature-id} --openapi path/to/spec.yaml # From OpenAPI spec
/tdk-test-api-plan {feature-id} --sub-workspace backend # Target sub-workspace
/tdk-test-api-plan {feature-id} --url http://localhost:3000/api # Set base URL
/tdk-test-api-plan {feature-id} --force # Overwrite existing plan
If api-test-plan.md already exists AND user provides an update description in natural language:
| Priority | Source | Flag | Behavior |
|---|---|---|---|
| A | OpenAPI spec | --openapi <path> | Parse via parse_openapi_spec.py -> structured JSON |
| B | Codebase scout | (auto) | Spawn Explore agent to find API endpoints. If nothing found -> fallback to C |
| C | Manual input | (fallback) | Ask user via AskUserQuestion for endpoints |
Creates in {output_dir}/ (default: tests/api/):
| Error | Action |
|---|---|
test.api missing in .specify.json | STOP with error + show suggested JSON config block for user to copy-paste |
| OpenAPI file not found | Warning, fallback to mode B/C |
| No endpoints discovered | STOP with error |
| Template not found | STOP: "Template missing. Check .specify/templates/test/api-test/api-test-plan-template.md.tpl" |
Parse user input for sub-workspace targeting:
--sub-workspace NAME in command argsRun environment script:
# Standard mode:
bun .specify/scripts/ts/src/commands/test-api/plan-env.ts <feature-id>
# With options:
bun .specify/scripts/ts/src/commands/test-api/plan-env.ts <feature-id> --sub-workspace {NAME} --openapi {PATH}
Parse JSON output -> Store all fields. If error -> STOP and report to user.
From script output, check HAS_TEST_API_CONFIG:
If false -> STOP with error message:
API test config not found in .specify.json.
Add the following block to your .specify/.specify.json:
{
"test": {
"api": {
"outputDir": "tests/api",
"authStrategy": "bearer",
"baseUrlEnv": "API_BASE_URL",
"tokenEnv": "API_TOKEN"
}
}
}
If true -> Continue. Log config values.
If HAS_EXISTING_PLAN = true AND user provided update prompt:
api-test-plan.mdIf HAS_EXISTING_PLAN = true AND no update prompt AND FORCE_MODE = false:
If HAS_EXISTING_PLAN = false OR FORCE_MODE = true -> Continue to Step 1.
Mode A — OpenAPI spec (if OPENAPI_VALID = true):
python "{PARSER_SCRIPT}" "{OPENAPI_PATH}" (paths quoted!)Mode B — Subagent Scout (default, if no --openapi):
Find all API endpoints in this codebase. Look for:
- Route definitions (Express, Laravel, Django, FastAPI, etc.)
- Controller classes with route decorators
- API route files
For each endpoint found, report: HTTP method, path, description, auth requirement.
Working directory: {OUTPUT_ROOT}
Mode C — Manual input (fallback):
After discovery: Show discovered endpoints to user for confirmation via AskUserQuestion.
For each discovered endpoint:
.specify/templates/test/api-test/api-test-plan-template.md.tpl| Section | Source |
|---|---|
| Endpoint Inventory | From Step 1 discovery |
| Auth Configuration | From .specify.json test.api config |
| Test Categories | AI analysis per endpoint |
| Suggested Execution Order | CRUD lifecycle grouping (POST->GET->PUT->PATCH->DELETE) |
| Environment | From config (base_url_env, token_env) |
{API_TEST_DIR}/api-test-plan.mdAPI Test Plan Created
=====================
Endpoints: {n} across {m} resources
Auth: {strategy}
Output: {path}/api-test-plan.md
Resources:
- {resource}: {n} endpoints
...
Next: /tdk-test-api-generate-testcase {feature-id}
| Error | Solution |
|---|---|
| .specify.json not found | Check workspace config |
| test.api block missing | Show suggested JSON config block |
| Template missing | Check .specify/templates/test/api-test/api-test-plan-template.md.tpl |
| OpenAPI parse error | Validate spec format, fallback to scout |
| No endpoints found | Ask user for manual input |
| Parser script missing | Warning: "parse_openapi_spec.py not found. Falling back to scout mode." |
/tdk-test-api-generate-testcase — Generate testcase files from this plan/tdk-test-api-gen-code-playwright-ts — Generate Playwright TS code 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.