[TERMINAL · SKILLS]
> mounting /skills...
> indexing skill manifests...
> linking agents: claude · codex · gemini · cursor
> ready.
[░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
Use Cases/Build an API Documentation and Testing Workflow

Build an API Documentation and Testing Workflow

Generate accurate API documentation from code, test endpoints systematically, and validate payment integrations with realistic scenarios.

Development#openapi#swagger#api-design#documentation#rest
Works with:claude-codeopenai-codexgemini-clicursor

Skills stack · 4 skills

Avg quality 91/100·All SAFE
>

openapi-spec

v1.1.0

OpenAPI is the standard format for describing HTTP APIs in YAML or JSON, from which docs, typed clients and mock servers can be generated. Use this skill to write an OpenAPI 3.1 spec, lint it with Redocly CLI, generate TypeScript types and a typed fetch client, build HTML docs, and keep a spec valid. Use when someone says "write an OpenAPI spec", "document my REST API", "generate a client from openapi.yaml" or "lint my swagger file".

83/100 quality
7.30× impact
SAFE· stale score
View skill
>

scalar

v1.0.0

Scalar renders an OpenAPI document as interactive API documentation with a built-in request client, and ships a CLI to validate, lint, bundle, mock and preview specs. Use when asked to "add API docs to my Express/Fastify/Hono app", "replace Swagger UI", "preview my openapi.yaml", "lint an OpenAPI file", "mock an API from a spec", or "serve a reference page from a spec".

87/100 quality
8.20× impact
SAFE
View skill
>

api-tester

v1.1.0

Test REST and GraphQL API endpoints with structured assertions and reporting. Use when a user asks to test an API, hit an endpoint, check if an API works, validate a response, debug an API call, test authentication flows, or verify API contracts. Supports GET, POST, PUT, PATCH, DELETE with headers, body, auth, and response validation.

93/100 quality
1.73× impact
SAFE· stale score
View skill
>

stripe-testing

v1.1.0

Test and debug Stripe payment integrations from the terminal with the Stripe CLI. Use when someone needs to verify webhook handling, simulate payment flows, debug failed charges, validate subscription lifecycle with test clocks, or troubleshoot Stripe API errors. Trigger words: stripe, payment testing, webhook debugging, stripe listen, stripe trigger, charge failed, subscription error, payment intent, checkout session, test clock.

100/100 quality
1.86× impact
SAFE· stale score
View skill
$

The Problem

Your API documentation lives in a Notion page that was last updated four months ago. Three endpoints have been added since then, two have changed their request format, and one was deprecated. New developers waste half a day figuring out which docs are accurate. Partners integrating with your API open support tickets because the documented response format does not match what the API actually returns. Testing is manual -- someone runs curl commands from a shared script. The Stripe integration has never been tested with edge cases like disputed charges or failed subscription renewals because setting up those scenarios manually is tedious.

The Solution

Use the openapi-spec skill to produce an OpenAPI 3.1 document from the codebase, lint it and build HTML docs with Redocly CLI, api-tester to systematically test every endpoint with automated assertions, and stripe-testing to validate payment flows with realistic scenarios including disputes, refunds, and webhook retries.

Step-by-Step Walkthrough

1. Generate API documentation from code

Extract route definitions, request/response types, and validation rules into one spec, then lint it and build the docs page.

Scan our Express API routes in src/routes/ and write an OpenAPI 3.1 openapi.yaml. Convert the request body schemas from our Zod validators, take response types from our TypeScript return types, and include authentication requirements and example values. Then run npx @redocly/cli lint openapi.yaml and npx @redocly/cli build-docs openapi.yaml -o docs/index.html.

With Zod 4, z.toJSONSchema(schema) emits JSON Schema 2020-12, the dialect OpenAPI 3.1 uses, so the documented request format is generated from the schema the server actually validates with. Redocly's lint step must print "Your API description is valid" and build-docs writes a static HTML page you can host anywhere.

2. Test all endpoints systematically

Run every endpoint through happy path, error, and edge case scenarios.

Test all 34 endpoints in our API on the local dev server (http://127.0.0.1:$PORT) with the api-tester skill. For each endpoint, verify: correct HTTP status codes, response schema matches the OpenAPI spec, authentication is enforced on protected routes, validation rejects malformed input with helpful error messages, and pagination returns correct page sizes. Report failures as a summary table.

The test runner produces a table showing pass/fail status for every endpoint and test category:

API Test Results — 34 endpoints, 187 assertions
=================================================
Endpoint                    Status  Auth  Validation  Schema  Pagination
GET    /api/v1/products     PASS    PASS  PASS        PASS    PASS
POST   /api/v1/products     PASS    PASS  PASS        PASS    --
GET    /api/v1/products/:id PASS    PASS  PASS        PASS    --
PUT    /api/v1/products/:id PASS    PASS  PASS        PASS    --
DELETE /api/v1/products/:id PASS    PASS  PASS        PASS    --
GET    /api/v1/orders       PASS    PASS  PASS        PASS    PASS
POST   /api/v1/orders       PASS    PASS  FAIL *      PASS    --
GET    /api/v1/users        PASS    PASS  PASS        PASS    PASS
POST   /api/v1/checkout     PASS    PASS  PASS        FAIL *  --
...

Summary: 183 passed, 4 failed
  * POST /api/v1/orders     — empty body returns 500 instead of 400
  * POST /api/v1/checkout   — response missing "currency" field in schema
  * PUT  /api/v1/users/:id  — accepts invalid email format "not-an-email"
  * GET  /api/v1/reports     — returns 200 without auth header (should be 401)

The four failures represent real bugs. The orders endpoint crashes on empty bodies instead of returning a validation error, and the reports endpoint is missing authentication middleware entirely.

3. Validate Stripe payment flows end-to-end

Payment integrations have edge cases that only appear under specific conditions.

Test our Stripe integration in test mode with these scenarios: successful one-time payment, declined card (insufficient funds), 3D Secure authentication required, subscription creation with trial period, subscription upgrade with proration, failed renewal, disputed charge, and webhook replay for a missed event. Use the test key in $STRIPE_API_KEY and Stripe's documented test cards.

The stripe-testing skill maps each scenario to a command or card from the Stripe docs:

ScenarioHow
Insufficient fundscard 4000000000009995 (card_declined, insufficient_funds)
3D Secure always requiredcard 4000002760003184
Failed charge after attachingcard 4000000000000341
Fraudulent disputecard 4000000000000259 creates a dispute, or stripe trigger charge.dispute.created
Trial, proration, renewalsa test clock: stripe post /v1/test_helpers/test_clocks -d frozen_time=$(date +%s), then advance it
Missed eventstripe events resend evt_... --webhook-endpoint=we_... (works up to 30 days)

Run stripe listen --forward-to http://127.0.0.1:3000/api/webhooks/stripe in another terminal so the local handler receives each event with the CLI's signing secret.

4. Set up continuous documentation and testing

Automate doc generation and API testing so they run on every pull request.

Create a CI workflow that regenerates the OpenAPI spec from code on every PR, runs npx @redocly/cli lint, and runs oasdiff breaking main:openapi.yaml openapi.yaml --fail-on ERR to fail on breaking changes. Run the API test suite against a staging environment after every deployment.

Real-World Example

A payments platform had three partner companies struggling to integrate because the API docs showed v1 request formats while the live API had silently migrated to v2. The spec was written from the actual route definitions and Zod schemas in 20 minutes. The api-tester discovered that 4 of 34 endpoints returned 500 errors on empty request bodies instead of 400 validation errors. The stripe-testing skill caught a critical bug: disputed charges were being processed as refunds, which meant the company was losing both the charge amount and the dispute fee. The overhaul took the team two days.

Tips

  • Generate documentation on every pull request and diff it against the previous version. If an endpoint's request schema changed but the changelog was not updated, fail the CI check.
  • Test with realistic payloads, not minimal valid objects. An endpoint that accepts a product with a 3-character name might break when someone submits a 500-character name with Unicode characters.
  • For Stripe testing, always test the webhook signature verification path. A common bug is accepting webhooks without verifying the signature, which allows attackers to forge events. Use stripe.webhooks.constructEvent on the raw request body, and test that a request with a wrong signature gets a 400.
  • Keep a separate test environment with its own Stripe test API keys. Sharing keys between developers causes test data collisions and flaky test results.

Related Skills

  • scalar — render the OpenAPI document as an interactive reference with a built-in request client, and lint it with the Scalar CLI

Related use cases