Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "api-documentation-generator",
"title": "API Documentation Generator",
"description": "Generate comprehensive API documentation from code with interactive examples and detailed specifications",
"category": "technical",
"job": "engineering",
"example_prompt": "Analyze my Express.js API code and generate comprehensive documentation. I have a REST API with endpoints for user management, authentication, and data operations. Create interactive documentation with examples for each endpoint, including request/response schemas, error codes, and authentication requirements.",
"example_result": "I've analyzed your Express.js API and generated comprehensive documentation. Here's your complete API documentation:\n\n# API Documentation\n\n## Overview\n\n```yaml\nAPI Name: User Management API\nVersion: 1.0.0\nBase URL: https://api.yourapp.com/v1\nAuthentication: Bearer Token (JWT)\nContent-Type: application/json\n```\n\n## Authentication\n\nAll endpoints require authentication via JWT token in the Authorization header:\n\n```http\nAuthorization: Bearer <your-jwt-token>\n```\n\n## Endpoints\n\n### 1. User Management\n\n#### Create User\n```http\nPOST /api/users\n```\n\n**Request Body:**\n```json\n{\n \"username\": \"string (required)\",\n \"email\": \"string (required, valid email)\",\n \"password\": \"string (required, min 8 chars)\",\n \"firstName\": \"string (optional)\",\n \"lastName\": \"string (optional)\",\n \"role\": \"string (optional, default: 'user')\"\n}\n```\n\n**Example Request:**\n```bash\ncurl -X POST https://api.yourapp.com/v1/users \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\" \\\n -d '{\n \"username\": \"johndoe\",\n \"email\": \"john@example.com\",\n \"password\": \"securepassword123\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\"\n }'\n```\n\n**Success Response (201):**\n```json\n{\n \"success\": true,\n \"data\": {\n \"id\": \"507f1f77bcf86cd799439011\",\n \"username\": \"johndoe\",\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"role\": \"user\",\n \"createdAt\": \"2025-01-15T10:30:00Z\",\n \"updatedAt\": \"2025-01-15T10:30:00Z\"\n },\n \"message\": \"User created successfully\"\n}\n```\n\n**Error Responses:**\n```json\n// 400 Bad Request\n{\n \"success\": false,\n \"error\": {\n \"code\": \"VALIDATION_ERROR\",\n \"message\": \"Invalid input data\",\n \"details\": [\n {\n \"field\": \"email\",\n \"message\": \"Email format is invalid\"\n }\n ]\n }\n}\n\n// 409 Conflict\n{\n \"success\": false,\n \"error\": {\n \"code\": \"USER_EXISTS\",\n \"message\": \"User with this email already exists\"\n }\n}\n```\n\n#### Get User by ID\n```http\nGET /api/users/{id}\n```\n\n**Path Parameters:**\n- `id` (string, required): User ID\n\n**Example Request:**\n```bash\ncurl -X GET https://api.yourapp.com/v1/users/507f1f77bcf86cd799439011 \\\n -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n```\n\n**Success Response (200):**\n```json\n{\n \"success\": true,\n \"data\": {\n \"id\": \"507f1f77bcf86cd799439011\",\n \"username\": \"johndoe\",\n \"email\": \"john@example.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"role\": \"user\",\n \"createdAt\": \"2025-01-15T10:30:00Z\",\n \"updatedAt\": \"2025-01-15T10:30:00Z\"\n }\n}\n```\n\n#### Update User\n```http\nPUT /api/users/{id}\n```\n\n**Request Body:**\n```json\n{\n \"firstName\": \"string (optional)\",\n \"lastName\": \"string (optional)\",\n \"email\": \"string (optional, valid email)\"\n}\n```\n\n#### Delete User\n```http\nDELETE /api/users/{id}\n```\n\n**Success Response (200):**\n```json\n{\n \"success\": true,\n \"message\": \"User deleted successfully\"\n}\n```\n\n### 2. Authentication\n\n#### Login\n```http\nPOST /api/auth/login\n```\n\n**Request Body:**\n```json\n{\n \"email\": \"string (required)\",\n \"password\": \"string (required)\"\n}\n```\n\n**Example Request:**\n```bash\ncurl -X POST https://api.yourapp.com/v1/auth/login \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"email\": \"john@example.com\",\n \"password\": \"securepassword123\"\n }'\n```\n\n**Success Response (200):**\n```json\n{\n \"success\": true,\n \"data\": {\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\",\n \"user\": {\n \"id\": \"507f1f77bcf86cd799439011\",\n \"username\": \"johndoe\",\n \"email\": \"john@example.com\",\n \"role\": \"user\"\n },\n \"expiresIn\": 3600\n }\n}\n```\n\n#### Refresh Token\n```http\nPOST /api/auth/refresh\n```\n\n**Request Body:**\n```json\n{\n \"refreshToken\": \"string (required)\"\n}\n```\n\n### 3. Data Operations\n\n#### Get All Items\n```http\nGET /api/items\n```\n\n**Query Parameters:**\n- `page` (number, optional): Page number (default: 1)\n- `limit` (number, optional): Items per page (default: 10, max: 100)\n- `sort` (string, optional): Sort field (default: 'createdAt')\n- `order` (string, optional): Sort order ('asc' or 'desc', default: 'desc')\n- `search` (string, optional): Search term\n\n**Example Request:**\n```bash\ncurl -X GET \"https://api.yourapp.com/v1/items?page=1&limit=20&sort=name&order=asc&search=example\" \\\n -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n```\n\n**Success Response (200):**\n```json\n{\n \"success\": true,\n \"data\": [\n {\n \"id\": \"507f1f77bcf86cd799439011\",\n \"name\": \"Example Item\",\n \"description\": \"This is an example item\",\n \"price\": 29.99,\n \"category\": \"electronics\",\n \"createdAt\": \"2025-01-15T10:30:00Z\",\n \"updatedAt\": \"2025-01-15T10:30:00Z\"\n }\n ],\n \"pagination\": {\n \"page\": 1,\n \"limit\": 20,\n \"total\": 150,\n \"pages\": 8,\n \"hasNext\": true,\n \"hasPrev\": false\n }\n}\n```\n\n## Error Codes\n\n| Code | HTTP Status | Description |\n|------|-------------|-------------|\n| `VALIDATION_ERROR` | 400 | Invalid input data |\n| `UNAUTHORIZED` | 401 | Authentication required |\n| `FORBIDDEN` | 403 | Insufficient permissions |\n| `NOT_FOUND` | 404 | Resource not found |\n| `USER_EXISTS` | 409 | User already exists |\n| `RATE_LIMITED` | 429 | Too many requests |\n| `SERVER_ERROR` | 500 | Internal server error |\n\n## Rate Limiting\n\n```yaml\nRate Limits:\n Authentication: 5 requests per minute\n General API: 100 requests per minute\n File Upload: 10 requests per minute\n\nHeaders:\n X-RateLimit-Limit: Request limit per window\n X-RateLimit-Remaining: Remaining requests\n X-RateLimit-Reset: Reset time (Unix timestamp)\n```\n\n## SDK Examples\n\n### JavaScript/Node.js\n```javascript\n// Using fetch\nconst response = await fetch('https://api.yourapp.com/v1/users', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${token}`\n },\n body: JSON.stringify({\n username: 'johndoe',\n email: 'john@example.com',\n password: 'securepassword123'\n })\n});\n\nconst data = await response.json();\n```\n\n### Python\n```python\nimport requests\n\nurl = 'https://api.yourapp.com/v1/users'\nheaders = {\n 'Content-Type': 'application/json',\n 'Authorization': f'Bearer {token}'\n}\ndata = {\n 'username': 'johndoe',\n 'email': 'john@example.com',\n 'password': 'securepassword123'\n}\n\nresponse = requests.post(url, headers=headers, json=data)\nresult = response.json()\n```\n\n### cURL Examples\n```bash\n# Create user\ncurl -X POST https://api.yourapp.com/v1/users \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\"username\":\"johndoe\",\"email\":\"john@example.com\",\"password\":\"secure123\"}'\n\n# Get user\ncurl -X GET https://api.yourapp.com/v1/users/507f1f77bcf86cd799439011 \\\n -H \"Authorization: Bearer $TOKEN\"\n\n# Update user\ncurl -X PUT https://api.yourapp.com/v1/users/507f1f77bcf86cd799439011 \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\"firstName\":\"John\",\"lastName\":\"Smith\"}'\n```\n\n## Testing\n\n### Postman Collection\n```json\n{\n \"info\": {\n \"name\": \"User Management API\",\n \"schema\": \"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\"\n },\n \"item\": [\n {\n \"name\": \"Create User\",\n \"request\": {\n \"method\": \"POST\",\n \"header\": [\n {\n \"key\": \"Content-Type\",\n \"value\": \"application/json\"\n }\n ],\n \"body\": {\n \"mode\": \"raw\",\n \"raw\": \"{\\\"username\\\":\\\"testuser\\\",\\\"email\\\":\\\"test@example.com\\\",\\\"password\\\":\\\"testpass123\\\"}\"\n },\n \"url\": {\n \"raw\": \"{{base_url}}/users\",\n \"host\": [\"{{base_url}}\"],\n \"path\": [\"users\"]\n }\n }\n }\n ]\n}\n```\n\n## Changelog\n\n### Version 1.0.0 (2025-01-15)\n- Initial API release\n- User management endpoints\n- Authentication system\n- Basic CRUD operations\n\n---\n\n**Generated on:** 2025-01-15T10:30:00Z\n**API Version:** 1.0.0\n**Documentation Version:** 1.0.0\n\nWould you like me to:\n1. Generate OpenAPI/Swagger specification?\n2. Create Postman collection?\n3. Generate client SDKs?\n4. Add more detailed examples?\n5. Create API testing scripts?",
"extensions": [
{
"name": "Developer",
"command": "developer",
"is_builtin": true,
"environmentVariables": [

]
}
]
}