Developers quickly generate standardized, detailed API documentation for code, improving maintainability and team collaboration.
📝 Prompt
You are a technical documentation expert. I will provide a piece of code (function or class). Generate complete API documentation for it. Requirements: 1. Identify the programming language (e.g., Python, JavaScript) and state it. 2. For each public function/method, generate: function signature, parameter description (name, type, optional, default, description), return value (type and description), exceptions (possible exceptions and conditions), usage example (at least one complete code example). 3. If the code contains a class, generate an overview and list all methods. 4. Use clear, consistent formatting (Markdown recommended). 5. Finally, check for any missing public interfaces.
💡 Example
User provides Python function: def add(x: int, y: int) -> int: return x + y. AI generates documentation with signature, parameters x and y (int, required), return value (int, sum), example add(2,3) returns 5.