Turn your undocumented code into comprehensive developer guides instantly. No more staring at blank README files or explaining the same API endpoints over and over.
Quick Start
Stop procrastinating on documentation and get started with these simple prompts:
Generate documentation for this API file: C:/project/api/users.js
Create markdown documentation for this utility class: C:/src/utils/DataProcessor.ts
Add JSDoc comments to this JavaScript file: C:/components/UserAuth.js
Magic Happens
The function analyses your code structure, understands the purpose of each function, and generates documentation that actually helps other developers understand your code.
What It Does
Imagine having a technical writer who understands code sitting next to you. generate_documentation
analyses your code and creates comprehensive documentation that explains what your functions do, how to use them, and what to expect in return.
This isn't just comment generation - it's intelligent documentation that:
- Understands Context - Knows the difference between utilities and API endpoints
- Explains Purpose - Describes what each function actually accomplishes
- Documents Parameters - Types, required fields, and examples
- Shows Usage - Practical examples that developers can copy and use
- Warns About Gotchas - Edge cases and important considerations
The output is tailored to your chosen documentation style - whether you need JSDoc for IDE support, markdown for README files, or structured formats for documentation sites.
Parameters
Customise your documentation generation to match your project's style and needs:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
filePath |
string | Yes* | - |
Path to the code file you want documented Example:
"C:/api/routes/users.js" |
code |
string | Yes* | - |
Code content directly (alternative to filePath) Perfect for documenting code snippets or functions
|
docStyle |
string | No | "jsdoc" |
Documentation format: "jsdoc", "markdown", "docstring", "javadoc", "phpdoc" Choose based on your project's documentation system
|
includeExamples |
boolean | No | true |
Include practical usage examples in the documentation Highly recommended - examples make documentation much more useful
|
context |
object | No | {} |
Project context for better documentation quality Example:
{"audience": "external_developers", "api_version": "v2"} |
*Either filePath or code is required - choose based on whether you're documenting files or snippets
Real-World Examples
Here's how to generate documentation for different types of code:
API Endpoint Documentation
houtini-lm:generate_documentation with:
- filePath: "C:/api/routes/users.js"
- docStyle: "markdown"
- includeExamples: true
- context: {"api_type": "REST", "audience": "external_developers"}
TypeScript Class Documentation
houtini-lm:generate_documentation with:
- filePath: "C:/src/services/PaymentService.ts"
- docStyle: "jsdoc"
- includeExamples: true
- context: {"typescript": true, "audience": "team_developers"}
React Component Documentation
houtini-lm:generate_documentation with:
- filePath: "C:/components/DataTable.tsx"
- docStyle: "markdown"
- context: {"framework": "React", "component_type": "reusable"}
Python Module Documentation
houtini-lm:generate_documentation with:
- filePath: "C:/utils/data_processor.py"
- docStyle: "docstring"
- includeExamples: true
- context: {"language": "python", "style": "google"}
Quick Code Snippet Documentation
houtini-lm:generate_documentation with:
- code: "function calculateTax(amount, rate = 0.2) { return amount * rate; }"
- docStyle: "jsdoc"
- includeExamples: true
Documentation Styles
Choose the right style for your project and workflow:
📝 JSDoc (JavaScript/TypeScript)
Perfect for JavaScript and TypeScript projects. Generates comments that IDEs understand for better autocomplete and inline help.
/**
* Calculates tax amount for a given price
* @param {number} amount - The base amount to calculate tax for
* @param {number} [rate=0.2] - Tax rate as decimal (default: 20%)
* @returns {number} The calculated tax amount
* @example
* // Calculate VAT on £100
* const vat = calculateTax(100, 0.2); // Returns 20
*/
📄 Markdown (README/Wiki)
Great for README files, wikis, and documentation sites. Easy to read and renders beautifully on GitHub.
🐍 Docstring (Python)
Follows Python documentation conventions with proper parameter descriptions and examples.
☕ JavaDoc (Java)
Standard Java documentation format that integrates with Java development tools.
🐘 PHPDoc (PHP)
PHP-specific documentation format perfect for WordPress plugins and PHP applications.
What You Get Back
Professional-quality documentation that saves hours of manual writing:
📋 Function & Class Documentation
- Clear descriptions - What each function actually does
- Parameter documentation - Types, requirements, and examples
- Return value details - What to expect back and when
- Exception handling - What can go wrong and how to handle it
💡 Usage Examples
- Practical scenarios - Real-world usage patterns
- Copy-paste ready - Code examples that actually work
- Common patterns - How the function is typically used
- Edge cases - Examples showing boundary conditions
🚨 Important Notes & Warnings
- Performance considerations - When to use and when to avoid
- Compatibility notes - Browser, Node.js, or framework requirements
- Breaking changes - Deprecated features and migration guidance
- Security considerations - Safe usage patterns
🔗 Integration Guidelines
- Setup requirements - Dependencies and configuration
- Common workflows - How this fits into typical development patterns
- Troubleshooting - Solutions to common issues
- Related functions - What to use alongside this code
Human-Quality Writing
The documentation reads naturally and explains concepts clearly - not robotic API dumps that nobody wants to read.
Perfect Use Cases
When documentation generation becomes your secret productivity weapon:
📚 README File Creation
Generate comprehensive README sections for your utility functions, API endpoints, or React components. Perfect for open source projects that need professional documentation.
🔗 API Documentation
Document your REST API endpoints with proper parameter descriptions, response examples, and error codes. Great for both internal APIs and public-facing services.
👥 Team Onboarding
Help new team members understand your codebase faster with clear function documentation and usage examples. Reduce the "how does this work?" questions.
🧩 Component Libraries
Document React, Vue, or Angular components with prop descriptions, usage examples, and integration guidelines. Essential for design systems and reusable component libraries.
📖 Legacy Code Understanding
Generate documentation for inherited code to understand what it does before making changes. Safer refactoring starts with understanding existing functionality.
🚀 Open Source Projects
Create professional documentation that encourages contributions and makes your project more approachable for new users.
Best Practices
Get the best documentation output with these professional tips:
🎯 Choose the Right Style
Match your documentation style to your project's ecosystem:
- JSDoc - JavaScript/TypeScript projects, IDE support needed
- Markdown - README files, GitHub repos, documentation sites
- Docstring - Python projects, Sphinx documentation
- PHPDoc - WordPress plugins, PHP applications
📝 Provide Context
Help the generator understand your project:
- Specify your audience (internal team vs external developers)
- Mention frameworks or libraries you're using
- Include API version numbers for consistency
- Note if this is production code vs experimental features
✨ Always Include Examples
Examples make documentation immediately useful:
- Set
includeExamples: true
for better adoption - Examples help developers understand intended usage patterns
- Show both simple and advanced use cases when relevant
- Include error handling examples for critical functions
🔄 Iterative Improvement
- Start with basic documentation and refine based on team feedback
- Update documentation when you modify the underlying code
- Use generated docs as a starting point, then customise for your specific needs
- Keep examples realistic and test them periodically
Pro Tip
Generated documentation is most valuable when it's maintained. Set up a process to update docs when code changes, and your future self will thank you.
Troubleshooting
Solve common documentation generation issues:
Documentation is too generic or unhelpful
The generated documentation doesn't provide useful insights about your specific code.
- Add more context about your project and intended audience
- Include framework information:
{"framework": "React", "version": "18"}
- Specify the documentation purpose:
{"audience": "external_developers"}
- Use meaningful function and variable names in your code
Missing examples or incomplete usage patterns
Generated documentation doesn't include practical examples or shows incomplete usage.
- Always set
includeExamples: true
- Provide context about typical use cases in your project
- Include information about dependencies or setup requirements
- Add comments in your code explaining complex logic
Wrong documentation format or style
The documentation format doesn't match your project's conventions.
- Choose the correct
docStyle
for your language and tools - Use "jsdoc" for JavaScript/TypeScript projects
- Use "markdown" for README files and documentation sites
- Use "docstring" for Python with specific style contexts
Cannot find or read the file
Getting file access errors or path-related issues.
- Use absolute paths:
C:/project/src/utils.js
not./utils.js
- Ensure the file path is within your
LLM_MCP_ALLOWED_DIRS
- Check file permissions and that the file exists
- Try using the
code
parameter instead and paste your code directly
Documentation is too technical or too simple
The tone and complexity level doesn't match your audience.
- Specify audience in context:
{"audience": "external_developers"}
- Use
{"audience": "team_developers"}
for internal documentation - Add technical level hints:
{"technical_level": "intermediate"}
- Include project context to help gauge appropriate complexity