How to Use

Try in Chat

Quick

Paste into any AI chat for instant expertise. Works in one conversation -- no setup needed.

Preview prompt
You are an expert Api Test Suite Builder (Engineering domain).

Generates API test skeletons from an OpenAPI spec, measures which endpoints tests really assert on, and checks response samples against the spec. Use when adding API tests, auditing API test coverage, or catching contract drift.

Scan API route definitions across frameworks (Next.js App Router, Express, FastAPI, Django REST, Go net/http), analyze request/response schemas, and generate comprehensive test suites covering authentication, authorization, input validation, error handling, pagination, file uploads, rate limiting, c

## Your Key Capabilities
- Status-code-only tests
- Testing the happy path only
- Contract checks on hand-made samples

## How to Help
When the user asks for help in this domain:
1. Ask clarifying questions to understand their context
2. Apply the relevant framework or workflow from your expertise
3. Provide actionable, specific output (not generic advice)
4. Offer concrete templates, checklists, or analysis

For the full skill with Python tools and references, visit:
https://github.com/borghei/Claude-Skills/tree/main/api-test-suite-builder

---
Start by asking the user what they need help with.
# Add to your project
cs install engineering/api-test-suite-builder ./

# Or copy directly
git clone https://github.com/borghei/Claude-Skills.git
cp -r Claude-Skills/engineering/api-test-suite-builder your-project/
# The skill is available in your Codex workspace at:
.codex/skills/api-test-suite-builder/

# Reference the SKILL.md in your Codex instructions
# or copy it into your project:
cp -r .codex/skills/api-test-suite-builder your-project/
# The skill is available in your Gemini CLI workspace at:
.gemini/skills/api-test-suite-builder/

# Reference the SKILL.md in your Gemini instructions
# or copy it into your project:
cp -r .gemini/skills/api-test-suite-builder your-project/
# Add to your .cursorrules or workspace settings:
# Reference: engineering/api-test-suite-builder/SKILL.md

# Or copy the skill folder into your project:
git clone https://github.com/borghei/Claude-Skills.git
cp -r Claude-Skills/engineering/api-test-suite-builder your-project/
# Clone and copy
git clone https://github.com/borghei/Claude-Skills.git
cp -r Claude-Skills/engineering/api-test-suite-builder your-project/

# Or download just this skill
curl -sL https://github.com/borghei/Claude-Skills/archive/main.tar.gz | tar xz --strip=1 Claude-Skills-main/engineering/api-test-suite-builder

Run Python Tools

python engineering/api-test-suite-builder/scripts/tool_name.py --help

Quick Start

The scripts read OpenAPI 3.x / Swagger 2.0 **JSON** specs. Auth, validation, Pact and k6 patterns for the parts the scripts do not generate are in the references.
# 1. Generate skeletons (pytest+httpx or vitest+supertest) into a scratch dir, then move what you keep
python scripts/test_generator.py assets/sample_openapi.json --framework vitest --output /tmp/api-tests

# 2. Measure coverage: endpoints called by a test, and endpoints whose tests assert on the body
python scripts/coverage_analyzer.py assets/sample_openapi.json assets/sample_tests --threshold 50 --show-covered
python scripts/coverage_analyzer.py assets/sample_openapi.json /tmp/api-tests --threshold 95   # exit 1: skeletons only

# 3. Validate recorded responses against the spec's response schemas
python scripts/contract_validator.py assets/sample_openapi.json assets/sample_responses          # exit 0
python scripts/contract_validator.py assets/sample_openapi.json assets/sample_responses_flawed   # exit 1, 3 violations
**Tools overview.** - `test_generator.py` writes one file per tag: 401 tests for secured operations, 422 tests per required field and wrong type, a success test that expects the spec's own 2xx code (201 for create, 204 for delete) on a URL with path parameters filled in, and a skipped placeholder for each declared error code. Every success test carries a TODO to assert on the body; a skeleton proves the route answers, not that it is right. - `coverage_analyzer.py` pairs each HTTP call with its own method and path, matches `{param}` segments, and ignores skipped tests. It reports two numbers: endpoints called, and endpoints with a body or header assertion. `--threshold` gates on the second, so a suite of status-only skeletons cannot pass a 95% gate. - `contract_validator.py` matches each sample by filename (`GET_users_200.json`) or a `_meta` block (`{"method", "path", "status"}`) and reports missing required fields, wrong types and disallowed properties; `--strict` also rejects extra properties where the schema does not forbid them. All three accept `--json`. **Exit codes.** `0` sound (or files generated); `1` coverage below `--threshold` or a sample violates its contract; `2` missing or unreadable spec, directory or sample set, invalid JSON, or a file that is not an OpenAPI spec. **Done when:** 1. Every TODO in the generated files is replaced by a real assertion or deleted. 2. The suite runs green against a local or mocked server, and red when you break the handler on purpose. 3. `coverage_analyzer.py --threshold` passes at the bar your team agreed (asserted coverage, not call coverage). 4. Each auth and validation rule in the spec has a negative test, and `contract_validator.py` passes on fresh recorded responses.

Related Skills in Engineering

View on GitHub