api-test-generatelisted
Install: claude install-skill manastalukdar/ai-devstudio
# API Test Generation
I'll generate comprehensive API tests for your REST or GraphQL endpoints with proper validation and assertions.
**Features:**
- Auto-detect API framework (Express, FastAPI, Next.js API routes)
- Generate request/response tests
- Schema validation
- Error handling tests
- Authentication tests
**Token Optimization:**
- ✅ Bash-based API framework detection (minimal tokens)
- ✅ Grep to find API routes/endpoints (300 tokens vs 4,000+ reading all files)
- ✅ Template-based test generation (no file reads for test templates)
- ✅ Caching endpoint discovery - saves 80% on reruns
- ✅ Early exit when no API routes found
- ✅ Incremental test generation (one endpoint at a time)
- **Expected tokens:** 1,200-2,500 (vs. 3,000-5,000 unoptimized)
- **Optimization status:** ✅ Optimized (Phase 2 Batch 2, 2026-01-26)
**Caching Behavior:**
- Cache location: `.claude/cache/api/endpoints.json`
- Caches: Discovered endpoints, framework detection, schema info
- Cache validity: Until route files change (checksum-based)
- Shared with: `/api-validate`, `/api-docs-generate` skills
## Phase 1: API Framework Detection
```bash
# Detect API framework efficiently
detect_api_framework() {
if [ -f "package.json" ]; then
if grep -q "\"express\"" package.json; then
echo "express"
elif grep -q "\"fastify\"" package.json; then
echo "fastify"
elif grep -q "\"next\"" package.json; then
echo "nextjs"
elif grep -q "\"@apoll