Langsung ke konten
Skillpedia
Testing29k ยท #9576

api-test-suite-builder

Fungsinya

Skill ini memindai file rute API Anda dan membuat rangkaian tes untuk setiap endpoint, mencakup autentikasi, validasi, error, paginasi, dan unggahan. Ditujukan untuk pengembang yang perlu tes API ditulis atau dasar pengujian ditambahkan.

Kapan dipakai

  • โœ“Saat Anda menambah API baru dan ingin tesnya ditulis sebelum kodenya.
  • โœ“Ketika Anda punya API lama tanpa tes dan memerlukan dasar pengujian.
  • โœ“Saat Anda ingin pemeriksaan sebelum rilis yang memastikan setiap rute setidaknya punya smoke test.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/api-test-suite-builder/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya perlu rangkaian tes API untuk semua rute di aplikasi Express saya, termasuk error login dan validasi.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mendeteksi rute di berbagai framework, lalu menulis file tes siap jalan yang memeriksa permintaan valid dan tidak valid serta kode error yang diharapkan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Framework apa yang didukung?

Next.js App Router, Express, FastAPI, dan Django REST, dengan tes ditulis memakai Vitest bersama Supertest atau Pytest bersama httpx.

Apakah ia menguji batas laju (rate limit)?

Ya. Termasuk pemeriksaan rate limit seperti lonjakan permintaan dan batas per pengguna.

Bisakah ia membantu sebelum API ditulis?

Bisa. Ia dapat membuat kerangka tes lebih dulu, yang cocok untuk test-driven development.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
29k
Peringkat
#9576
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa