| name | api-doc-generation |
| description | Generate and update API documentation from NestJS controllers. Use when modifying controllers, adding endpoints, or when the user asks about API documentation. |
| event | controller-change |
| auto_trigger | true |
| version | 2.0.0 |
| last_updated | 2026-01-26 |
| inputs | ["controller_files","existing_api_docs","dto_files"] |
| output | updated_api_docs |
| output_format | Markdown API doc (04-API-DESIGN-TEMPLATE.md) |
| output_path | docs/technical/backend/api/ |
| auto_invoke | {"events":["controller-change","api-endpoint-added"],"file_patterns":["apps/api/**/*.controller.ts","apps/api/**/*.dto.ts"],"conditions":["controller file modified","new endpoint added"]} |
| validation_rules | ["all endpoints documented","request/response DTOs included","status codes listed"] |
| chain_after | [] |
| chain_before | ["doc-index-update"] |
| called_by | ["@Backend"] |
| mcp_tools | ["grep_search","read_file","mcp_payment-syste_query_docs_by_type"] |
API Documentation Generation Skill
Purpose: Generate and update API documentation from NestJS controllers. Keeps API docs in sync with implementation.
Trigger
When: Controller files (*.controller.ts) are modified
Context Needed: Controller code, DTOs, existing API docs
MCP Tools: grep_search, read_file, mcp_payment-syste_query_docs_by_type
Controller → Doc Mapping
Parse NestJS decorators to extract:
@Controller('products')
@Get(':id')
@Post()
@UseGuards(JwtAuthGuard)
@ApiOperation({ summary: '...'})
Extraction Rules
| Decorator | Extracted Info |
|---|
@Controller(path) | Base path |
@Get/@Post/@Put/@Delete | HTTP method |
@Param/@Query/@Body | Parameters |
@UseGuards | Authentication |
@ApiOperation | Description |
@ApiResponse | Response codes |
API Doc Format
### GET /api/v1/products/:id
Get product by ID
Required (JWT)
| Name | In | Type | Required | Description |
| :--- | :--- | :----- | :------- | :---------- |
| id | path | string | Yes | Product ID |
| Code | Description | Schema |
| :--- | :---------- | :----------------- |
| 200 | Success | ProductResponseDto |
| 404 | Not found | ErrorDto |