$npx -y skills add SamarthaKV29/antigravity-god-mode --skill api-documentation-generatorGenerate comprehensive, developer-friendly API documentation from code, including endpoints, parameters, examples, and best practices
| 1 | # API Documentation Generator |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Automatically generate clear, comprehensive API documentation from your codebase. This skill helps you create professional documentation that includes endpoint descriptions, request/response examples, authentication details, error handling, and usage guidelines. |
| 6 | |
| 7 | Perfect for REST APIs, GraphQL APIs, and WebSocket APIs. |
| 8 | |
| 9 | ## When to Use This Skill |
| 10 | |
| 11 | - Use when you need to document a new API |
| 12 | - Use when updating existing API documentation |
| 13 | - Use when your API lacks clear documentation |
| 14 | - Use when onboarding new developers to your API |
| 15 | - Use when preparing API documentation for external users |
| 16 | - Use when creating OpenAPI/Swagger specifications |
| 17 | |
| 18 | ## How It Works |
| 19 | |
| 20 | ### Step 1: Analyze the API Structure |
| 21 | |
| 22 | First, I'll examine your API codebase to understand: |
| 23 | - Available endpoints and routes |
| 24 | - HTTP methods (GET, POST, PUT, DELETE, etc.) |
| 25 | - Request parameters and body structure |
| 26 | - Response formats and status codes |
| 27 | - Authentication and authorization requirements |
| 28 | - Error handling patterns |
| 29 | |
| 30 | ### Step 2: Generate Endpoint Documentation |
| 31 | |
| 32 | For each endpoint, I'll create documentation including: |
| 33 | |
| 34 | **Endpoint Details:** |
| 35 | - HTTP method and URL path |
| 36 | - Brief description of what it does |
| 37 | - Authentication requirements |
| 38 | - Rate limiting information (if applicable) |
| 39 | |
| 40 | **Request Specification:** |
| 41 | - Path parameters |
| 42 | - Query parameters |
| 43 | - Request headers |
| 44 | - Request body schema (with types and validation rules) |
| 45 | |
| 46 | **Response Specification:** |
| 47 | - Success response (status code + body structure) |
| 48 | - Error responses (all possible error codes) |
| 49 | - Response headers |
| 50 | |
| 51 | **Code Examples:** |
| 52 | - cURL command |
| 53 | - JavaScript/TypeScript (fetch/axios) |
| 54 | - Python (requests) |
| 55 | - Other languages as needed |
| 56 | |
| 57 | ### Step 3: Add Usage Guidelines |
| 58 | |
| 59 | I'll include: |
| 60 | - Getting started guide |
| 61 | - Authentication setup |
| 62 | - Common use cases |
| 63 | - Best practices |
| 64 | - Rate limiting details |
| 65 | - Pagination patterns |
| 66 | - Filtering and sorting options |
| 67 | |
| 68 | ### Step 4: Document Error Handling |
| 69 | |
| 70 | Clear error documentation including: |
| 71 | - All possible error codes |
| 72 | - Error message formats |
| 73 | - Troubleshooting guide |
| 74 | - Common error scenarios and solutions |
| 75 | |
| 76 | ### Step 5: Create Interactive Examples |
| 77 | |
| 78 | Where possible, I'll provide: |
| 79 | - Postman collection |
| 80 | - OpenAPI/Swagger specification |
| 81 | - Interactive code examples |
| 82 | - Sample responses |
| 83 | |
| 84 | ## Examples |
| 85 | |
| 86 | ### Example 1: REST API Endpoint Documentation |
| 87 | |
| 88 | ```markdown |
| 89 | ## Create User |
| 90 | |
| 91 | Creates a new user account. |
| 92 | |
| 93 | **Endpoint:** `POST /api/v1/users` |
| 94 | |
| 95 | **Authentication:** Required (Bearer token) |
| 96 | |
| 97 | **Request Body:** |
| 98 | \`\`\`json |
| 99 | { |
| 100 | "email": "user@example.com", // Required: Valid email address |
| 101 | "password": "SecurePass123!", // Required: Min 8 chars, 1 uppercase, 1 number |
| 102 | "name": "John Doe", // Required: 2-50 characters |
| 103 | "role": "user" // Optional: "user" or "admin" (default: "user") |
| 104 | } |
| 105 | \`\`\` |
| 106 | |
| 107 | **Success Response (201 Created):** |
| 108 | \`\`\`json |
| 109 | { |
| 110 | "id": "usr_1234567890", |
| 111 | "email": "user@example.com", |
| 112 | "name": "John Doe", |
| 113 | "role": "user", |
| 114 | "createdAt": "2026-01-20T10:30:00Z", |
| 115 | "emailVerified": false |
| 116 | } |
| 117 | \`\`\` |
| 118 | |
| 119 | **Error Responses:** |
| 120 | |
| 121 | - `400 Bad Request` - Invalid input data |
| 122 | \`\`\`json |
| 123 | { |
| 124 | "error": "VALIDATION_ERROR", |
| 125 | "message": "Invalid email format", |
| 126 | "field": "email" |
| 127 | } |
| 128 | \`\`\` |
| 129 | |
| 130 | - `409 Conflict` - Email already exists |
| 131 | \`\`\`json |
| 132 | { |
| 133 | "error": "EMAIL_EXISTS", |
| 134 | "message": "An account with this email already exists" |
| 135 | } |
| 136 | \`\`\` |
| 137 | |
| 138 | - `401 Unauthorized` - Missing or invalid authentication token |
| 139 | |
| 140 | **Example Request (cURL):** |
| 141 | \`\`\`bash |
| 142 | curl -X POST https://api.example.com/api/v1/users \ |
| 143 | -H "Authorization: Bearer YOUR_TOKEN" \ |
| 144 | -H "Content-Type: application/json" \ |
| 145 | -d '{ |
| 146 | "email": "user@example.com", |
| 147 | "password": "SecurePass123!", |
| 148 | "name": "John Doe" |
| 149 | }' |
| 150 | \`\`\` |
| 151 | |
| 152 | **Example Request (JavaScript):** |
| 153 | \`\`\`javascript |
| 154 | const response = await fetch('https://api.example.com/api/v1/users', { |
| 155 | method: 'POST', |
| 156 | headers: { |
| 157 | 'Authorization': `Bearer ${token}`, |
| 158 | 'Content-Type': 'application/json' |
| 159 | }, |
| 160 | body: JSON.stringify({ |
| 161 | email: 'user@example.com', |
| 162 | password: 'SecurePass123!', |
| 163 | name: 'John Doe' |
| 164 | }) |
| 165 | }); |
| 166 | |
| 167 | const user = await response.json(); |
| 168 | console.log(user); |
| 169 | \`\`\` |
| 170 | |
| 171 | **Example Request (Python):** |
| 172 | \`\`\`python |
| 173 | import requests |
| 174 | |
| 175 | response = requests.post( |
| 176 | 'https://api.example.com/api/v1/users', |
| 177 | headers={ |
| 178 | 'Authorization': f'Bearer {token}', |
| 179 | 'Content-Type': 'application/json' |
| 180 | }, |
| 181 | json={ |
| 182 | 'email': 'user@example.com', |
| 183 | 'password': 'SecurePass123!', |
| 184 | 'name': 'John Doe' |
| 185 | } |
| 186 | ) |
| 187 | |
| 188 | user = response.json() |
| 189 | print(user) |
| 190 | \`\`\` |
| 191 | ``` |
| 192 | |
| 193 | ### Example 2: GraphQL API Documentation |
| 194 | |
| 195 | ```markdown |
| 196 | ## User Query |
| 197 | |
| 198 | Fetch user information by ID. |
| 199 | |
| 200 | **Query:** |
| 201 | \`\`\`graphql |
| 202 | query GetUser($id: ID!) { |
| 203 | user(id: $id) { |
| 204 | id |
| 205 | |
| 206 | name |
| 207 | role |
| 208 | createdAt |
| 209 | posts { |
| 210 | id |
| 211 | title |
| 212 | publis |