api-mocklisted
Install: claude install-skill manastalukdar/ai-devstudio
# API Mock Server Generator
I'll help you generate API mock servers and stub services for testing and development, based on OpenAPI specifications or code analysis.
**Mock Server Tools:**
- **json-server**: Simple REST API mocking
- **MSW (Mock Service Worker)**: Browser and Node.js request interception
- **Prism**: OpenAPI-based mock server
- **WireMock**: Advanced API simulation
## Token Optimization
This skill uses mock generation-specific patterns to minimize token usage:
### 1. API Spec Detection Caching (600 token savings)
**Pattern:** Cache API specification locations and structure
- Store spec analysis in `.api-mock-cache` (1 hour TTL)
- Cache: spec location, endpoints, schemas, examples
- Read cached spec on subsequent runs (50 tokens vs 650 tokens fresh)
- Invalidate on spec file changes
- **Savings:** 92% on repeat mock generations
### 2. OpenAPI Spec Parsing via Bash (1,800 token savings)
**Pattern:** Use yq/jq for OpenAPI parsing instead of LLM
- Extract endpoints: `yq '.paths | keys'` (200 tokens)
- Extract schemas: `yq '.components.schemas'` (200 tokens)
- No Task agents for spec parsing
- **Savings:** 90% vs LLM-based OpenAPI analysis
### 3. Template-Based Mock Generation (2,500 token savings)
**Pattern:** Use predefined mock server templates
- Standard templates: json-server, MSW, Prism configurations
- Endpoint → mock handler mapping templates
- No creative mock logic generation needed
- **Savings:** 85% vs LLM-generated mock code
### 4. Example-Base