Skip to content
Skillpedia
Testing29k Β· #9576

api-test-suite-builder

What it does

It scans your API route files and generates test suites for each endpoint, covering authentication, validation, errors, pagination and uploads. It is for developers who need API tests written or a baseline added.

When to use it

  • βœ“When you add a new API and want tests written before the code.
  • βœ“When you have a legacy API with no tests and need a baseline.
  • βœ“When you want a pre-release check that every route has at least a smoke test.

Skill link

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/api-test-suite-builder/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/api-test-suite-builder/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI need an API test suite for all the routes in my Express app, including login and validation errors.”

5 new skills a week. 1 minute to read.

How it works

The agent detects routes across common frameworks, then writes ready-to-run test files that check valid and invalid requests and the expected error codes.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

API Test Suite Builder

Tier: POWERFUL Category: Engineering Domain: Testing / API Quality


Overview

Scans API route definitions across frameworks (Next.js App Router, Express, FastAPI, Django REST) and auto-generates comprehensive test suites covering auth, input validation, error codes, pagination, file uploads, and rate limiting. Outputs ready-to-run test files for Vitest+Supertest (Node) or Pytest+httpx (Python).


Core Capabilities

  • Route detection β€” scan source files to extract all API endpoints
  • Auth coverage β€” valid/invalid/expired tokens, missing auth header
  • Input validation β€” missing fields, wrong types, boundary values, injection attempts
  • Error code matrix β€” 400/401/403/404/422/500 for each route
  • Pagination β€” first/last/empty/oversized pages
  • File uploads β€” valid, oversized, wrong MIME type, empty
  • Rate limiting β€” burst detection, per-user vs global limits

When to Use

  • New API added β€” generate test scaffold before writing implementation (TDD)
  • Legacy API with no tests β€” scan and generate baseline coverage
  • API contract review β€” verify existing tests match current route definitions
  • Pre-release regression check β€” ensure all routes have at least smoke tests
  • Security audit prep β€” generate adversarial input tests

Route Detection

Next.js App Router

# Find all route handlers
find ./app/api -name "route.ts" -o -name "route.js" | sort

# Extract HTTP methods from each route file
grep -rn "export async function\|export function" app/api/**/route.ts | \
  grep -oE "(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)" | sort -u

# Full route map
find ./app/api -name "route.ts" | while read f; do
  route=$(echo $f | sed 's|./app||' | sed 's|/route.ts||')
  methods=$(grep -oE "export (async )?function (GET|POST|PUT|PATCH|DELETE)" "$f" | \
    grep -oE "(GET|POST|PUT|PATCH|DELETE)")
  echo "$methods $route"
done

Express

# Find all router files
find ./src -name "*.ts" -o -name "*.js" | xargs grep -l "router\.\(get\|post\|put\|delete\|patch\)" 2>/dev/null

# Extract routes with line numbers
grep -rn "router\.\(get\|post\|put\|delete\|patch\)\|app\.\(get\|post\|put\|delete\|patch\)" \
  src/ --include="*.ts" | grep -oE "(get|post|put|delete|patch)\(['\"][^'\"]*['\"]"

# Generate route map
grep -rn "router\.\|app\." src/ --include="*.ts" | \
  grep -oE "\.(get|post|put|delete|patch)\(['\"][^'\"]+['\"]" | \
  sed "s/\.\(.*\)('\(.*\)'/\U\1 \2/"

FastAPI

# Find all route decorators
grep -rn "@app\.\|@router\." . --include="*.py" | \
  grep -E "@(app|router)\.(get|post|put|delete|patch)"

# Extract with path and function name
grep -rn "@\(app\|router\)\.\(get\|post\|put\|delete\|patch\)" . --include="*.py" | \
  grep -oE "@(app|router)\.(get|post|put|delete|patch)\(['\"][^'\"]*['\"]"

Django REST Framework

# urlpatterns extraction
grep -rn "path\|re_path\|url(" . --include="*.py" | grep "urlpatterns" -A 50 | \
  grep -E "path\(['\"]" | grep -oE "['\"][^'\"]+['\"]" | head -40

# ViewSet router registration
grep -rn "router\.register\|DefaultRouter\|SimpleRouter" . --include="*.py"

Test Generation Patterns

Auth Test Matrix

For every authenticated endpoint, generate:

Test Case Expected Status
No Authorization header 401
Invalid token format 401
Valid token, wrong user role 403
Expired JWT token 401
Valid token, correct role 2xx
Token from deleted user 401

Input Validation Matrix

For every POST/PUT/PATCH endpoint with a request body:

Test Case Expected Status
Empty body {} 400 or 422
Missing required fields (one at a time) 400 or 422
Wrong type (string where int expected) 400 or 422
Boundary: value at min-1 400 or 422
Boundary: value at min 2xx
Boundary: value at max 2xx
Boundary: value at max+1 400 or 422
SQL injection in string field 400 or 200 (sanitized)
XSS payload in string field 400 or 200 (sanitized)
Null values for required fields 400 or 422

Example Test Files

β†’ See references/example-test-files.md for details

Generating Tests from Route Scan

When given a codebase, follow this process:

  1. Scan routes using the detection commands above
  2. Read each route handler to understand:
    • Expected request body schema
    • Auth requirements (middleware, decorators)
    • R
FAQ

Which frameworks does it support?

Next.js App Router, Express, FastAPI and Django REST, with tests written in Vitest with Supertest or Pytest with httpx.

Does it test rate limits?

Yes. It includes rate limiting checks such as bursts and per-user limits.

Can it help before the API is written?

Yes. It can generate a test scaffold first, which fits test-driven development.

Details

Original description by the author

Use when asked to write API, integration or contract tests for REST endpoints. Builds the suite from the routes: happy paths, auth, validation errors and edge cases per endpoint.

repo: alirezarezvani/claude-skills

Popularity

GitHub stars
29k
Ranking position
#9576
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills