PrizmKit API Doc Generator
Generate API documentation from source code by scanning routes, controllers, and handlers. Produces OpenAPI 3.0 specs or Markdown reference docs.
Commands
prizmkit.api-docs [api-directory]
Generate API documentation from source code.
STEPS:
- Read
.prizm-docs/for project tech stack (framework, language, API style: REST / GraphQL / gRPC) - Scan API source files (routes, controllers, handlers):
- Detect routing patterns based on framework:
- Express/Fastify:
app.get(),router.post(), etc. - Django/Flask:
@app.route(),urlpatterns - Spring:
@GetMapping,@PostMapping, etc. - Go:
http.HandleFunc, gorilla/mux, chi routes
- Express/Fastify:
- If
api-directoryis specified, limit scan to that directory
- Detect routing patterns based on framework:
- Extract for each endpoint:
- HTTP method and path: GET /api/users/:id
- Request parameters:
- Path parameters (with types)
- Query parameters (with types and defaults)
- Request body schema (from types, validation decorators, or inline definitions)
- Response body schemas: Success and error response structures
- Authentication requirements: Which auth mechanism is required (JWT, API key, session, none)
- Error responses: Common error codes and their meanings (400, 401, 403, 404, 500)
- Description: From JSDoc comments, docstrings, or function/handler names
- Generate documentation in requested format:
- OpenAPI 3.0 YAML (default): Full spec with schemas, security definitions, and server info
- Markdown API reference: Human-readable endpoint documentation
- Both: Generate both formats
- Include examples for each endpoint:
- Sample request (curl command)
- Sample success response (JSON)
- Sample error response (JSON)
- Write to
docs/api/directory:docs/api/openapi.yamlfor OpenAPI specdocs/api/API_REFERENCE.mdfor Markdown docs
Path References
All internal asset paths MUST use ${SKILL_DIR} placeholder for cross-IDE compatibility.
Output
docs/api/openapi.yaml: OpenAPI 3.0 specificationdocs/api/API_REFERENCE.md: Markdown API reference
微信扫一扫