.claude/skills/dotnet-doc-controller/SKILL.md
Generates comprehensive API documentation for a .NET REST controller. Use when the user wants to document API endpoints, generate controller docs, or create API reference documentation.
npx skillsauth add emaginebr/NNews dotnet-doc-controllerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a documentation generator for .NET REST API Controllers. Your task is to create comprehensive, concise API documentation in Markdown format.
The user will provide a controller name or file path as argument: $ARGUMENTS
Find the Controller: Search for the controller file in the project. If $ARGUMENTS is a file path, read it directly. If it's a controller name (e.g., User, UserController), search for the matching file in **/Controllers/**Controller.cs.
Read the Controller: Read the entire controller file to understand all endpoints, HTTP methods, route patterns, authorization requirements, request/response types, and error handling.
Find all DTOs and Models: For every DTO, model, enum, or parameter class referenced in the controller (input parameters, return types, response objects), search the entire codebase to find their full definitions. This includes:
[FromBody] SomeDto param)ActionResult<SomeDto>)Ok(new { ... })IMPORTANT: Search in ALL projects in the solution, including NuGet package sources if DTOs are in external packages. Use dotnet commands or search the NuGet cache if necessary. Check:
**/*.cs)~/.nuget/packages/)Generate the Documentation: Create a markdown file following the exact format and rules below.
Save the File: Save the documentation to docs/<CONTROLLER_NAME>_API_DOCUMENTATION.md where <CONTROLLER_NAME> is in UPPER_SNAKE_CASE (e.g., User → USER, UserRole → USER_ROLE). Create the docs/ directory if it doesn't exist.
The generated markdown MUST follow this exact structure:
# <ControllerName> API Documentation
> Base URL: `/<route-prefix>`
## Authentication
<Describe the authentication scheme used - Bearer token, API key, etc. Mention which endpoints require auth and which are public.>
## Objects
### <ObjectName>
<Brief one-line description of the object.>
\`\`\`json
{
"property1": "string value",
"property2": 123,
"property3": true,
"nestedObject": {
"nestedProp1": "value",
"nestedProp2": 0
},
"arrayProp": []
}
\`\`\`
| Property | Type | Description |
|----------|------|-------------|
| property1 | string | Description |
| property2 | int | Description |
### Enums
#### <EnumName>
\`\`\`json
{
"0": "Value1",
"1": "Value2",
"2": "Value3"
}
\`\`\`
---
## Endpoints
### 1. <Endpoint Name>
<One-line description of what the endpoint does.>
**Endpoint:** `<HTTP_METHOD> /<route>`
**Authentication:** Required / Not Required
**Path Parameters:**
- `paramName` (type, required) - Description
**Query Parameters:**
- `paramName` (type, optional) - Description
**Request Headers:**
- `Header-Name` (type, required/optional) - Description
**Request Body:**
\`\`\`json
{
"field1": "value",
"field2": 123
}
\`\`\`
**Request Example:**
\`\`\`http
<HTTP_METHOD> /<full-route>
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
<body if applicable>
\`\`\`
**Response Success (200):**
\`\`\`json
{
"complete": "json response with all fields populated with example values"
}
\`\`\`
**Response Error (400):**
\`\`\`json
"Validation error message"
\`\`\`
**Response Error (401):**
\`\`\`json
"Not Authorized"
\`\`\`
**Response Error (404):**
\`\`\`json
"Not found message"
\`\`\`
**Response Error (500):**
\`\`\`json
"Error message details"
\`\`\`
Complete JSON objects: Every JSON response example MUST include ALL properties of the object, fully populated with realistic example values. Never use ... or // more fields. Show the COMPLETE object.
Enums as JSON: Every enum used in any response or request object MUST be documented in the "Enums" section with its numeric values mapped to string names.
All HTTP methods: Document EVERY endpoint in the controller. Cover GET, POST, PUT, DELETE, PATCH - whatever exists.
All response codes: For each endpoint, document ALL possible HTTP response codes based on the controller code (200, 400, 401, 403, 404, 500, etc.). Only include response codes that actually exist in the code.
Realistic examples: Use realistic, contextual example values (not "string", "0", "true"). For a user name use "John Doe", for an email use "[email protected]", etc.
Nested objects: If a response contains nested objects, show them fully expanded in the JSON example.
File naming: Use UPPER_SNAKE_CASE for the file name: docs/<NAME>_API_DOCUMENTATION.md
Only include sections that apply: If an endpoint has no query parameters, don't include the "Query Parameters" section. If no request body, don't include "Request Body". Keep it concise.
Anonymous objects: If the controller returns Ok(new { token, user }), document the anonymous object shape based on what properties are included.
FormFile endpoints: For file upload endpoints (IFormFile), show the request as multipart/form-data with the appropriate Content-Type header.
**Endpoint:** `GET /user/getById/{userId}`
**Request Example:**
\`\`\`http
GET /user/getById/42
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
\`\`\`
**Endpoint:** `POST /user/insert`
**Request Example:**
\`\`\`http
POST /user/insert
Content-Type: application/json
{
"name": "John Doe",
"email": "[email protected]"
}
\`\`\`
**Endpoint:** `PUT /role/update`
**Request Example:**
\`\`\`http
PUT /role/update
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"roleId": 1,
"name": "Admin",
"slug": "admin"
}
\`\`\`
**Endpoint:** `DELETE /role/delete/{roleId}`
**Request Example:**
\`\`\`http
DELETE /role/delete/5
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
\`\`\`
**Endpoint:** `POST /user/uploadImageUser`
**Request Example:**
\`\`\`http
POST /user/uploadImageUser
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: multipart/form-data; boundary=----FormBoundary
------FormBoundary
Content-Disposition: form-data; name="file"; filename="photo.jpg"
Content-Type: image/jpeg
<binary file data>
------FormBoundary--
\`\`\`
After creating the file, inform the user:
tools
Guides how to integrate the zTools package for ChatGPT, DALL-E image generation, file upload (S3), slug generation, email sending, and document validation in a .NET 8 project. Use when the user wants to use AI features, upload files, generate slugs, send emails, or understand zTools integration.
documentation
Generates a comprehensive, standardized README.md for any project. Use when the user wants to create or regenerate a README file following the project's documentation standard.
development
Guides how to integrate the NNews NuGet package for consuming the NNews CMS API in a .NET 8 project. Use when the user wants to consume articles, categories, tags, images, or AI-powered content generation from the NNews API.
tools
Guides how to integrate the NAuth package for user authentication in a .NET 8 project. Use when the user wants to add authentication, configure NAuth, use IUserClient, or understand the NAuth authentication flow.