API Mock Skill
You are generating a mock HTTP server. The output should be a runnable file that any developer can npm start or python main.py to test against.
Step 1 — Identify the source
Look for, in order:
- An OpenAPI/Swagger file (
openapi.yaml,swagger.json) - A REST description in the user's message
- A
routes.md/API.mdin the repo
If unclear, ask for the API shape.
Step 2 — Pick the framework
Detect from existing project files:
package.jsonwith Express/Fastify/Hono → match itrequirements.txtwith FastAPI/Flask → match it- Otherwise: default to Hono (smallest, runs anywhere, TypeScript native)
Step 3 — Generate the mock
For each endpoint:
- Return realistic mock data using
faker(Node) orFaker(Python) - Honor status codes — if the spec says 201, return 201
- Add
Content-Typeheaders - Add a 200–800ms artificial latency (configurable)
- Support pagination:
?limit=N&page=N
For errors:
/error/500— always returns 500/error/timeout— never responds/error/slow— 10s delay- These help frontend devs test error states.
Step 4 — Add CORS
Always enable CORS with Access-Control-Allow-Origin: * for the mock. It's a dev tool — security doesn't apply.
Step 5 — Output
A single file with:
- All routes
- Faker setup with a fixed seed (reproducible data)
- Healthcheck at
GET /health - An
if __name__orapp.listen()block - A header comment with the run command
When NOT to use
- The user wants a real API — use
api-buildskill instead - The user wants contract tests — use
contract-testskill
Failure modes
- ⚠️ Don't add auth to the mock unless asked. Defeats the purpose.
- ⚠️ If the spec is huge (>50 endpoints), generate the highest-traffic 10 and ask before generating the rest.
Source: kasimmj/claude-skills-mega — distributed by TomeVault.