Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

api-test-suite-builder

БесплатноЗапускает вложенные скриптыНе проверен

Generates API test skeletons from an OpenAPI spec, measures which endpoints tests really assert on, and checks response samples against the spec. Use when…

borgheiот borghei★ 1 250 звёзд на GitHub

Об этом скилле

API Test Suite Builder

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, contract testing, and load testing. Outputs ready-to-run test files for Vitest+Supertest (Node), Pytest+httpx (Python), or k6 (load testing).

Core Capabilities

  • Route detection & analysis — scan source files to extract endpoints, parse request/response schemas, detect auth middleware and authorization rules across Node, Python, and Go frameworks.
  • Test matrix generation — auth (valid/invalid/expired tokens, wrong roles), input validation (missing/wrong-type/boundary/injection), error paths (400/401/403/404/409/422/429/500), pagination, file uploads, and rate limiting.
  • Contract testing — OpenAPI-to-test generation, Pact consumer-driven contracts, schema snapshot testing for breaking-change detection.
  • Load testing — k6 scripts with ramp-up patterns and SLA thresholds, latency percentile tracking (P50/P95/P99), concurrent user simulation.

When to Use

  • New API added — generate a test scaffold before implementation (TDD).
  • Legacy API with no tests — scan and generate baseline coverage.
  • Pre-release — ensure all routes have at least smoke tests.
  • API contract change — detect and test breaking changes.
  • Security audit — generate adversarial input tests.
  • Performance validation — create load-test baselines.

Clarify First

Before generating the suite, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

  • Target framework: Vitest+Supertest, Pytest+httpx, or k6 (determines the emitted test-file format via --framework).
  • Spec or routes source: an OpenAPI spec or the source files to scan (the input the generator parses).
  • Test scope: auth, input validation, contract, load, or the full matrix (which test categories get generated).

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

Quick Start Workflow

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 valid
Полный SKILL.md на GitHub

Установить api-test-suite-builder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

assets/sample_openapi.jsonassets/sample_responses/GET_users_200.jsonassets/sample_responses/get_user.jsonassets/sample_responses_flawed/create_user.jsonassets/sample_tests/test_users.pyreferences/contract-and-load-testing.mdreferences/route-detection-and-matrices.mdreferences/workflow-and-quality.mdscripts/contract_validator.pyscripts/coverage_analyzer.pyscripts/test_generator.py

FAQ

Что делает скилл api-test-suite-builder?

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.

Как установить скилл api-test-suite-builder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл api-test-suite-builder запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить api-test-suite-builder с