Technical Documentation Auto-Generation
Code comments से लेकर API documentation से लेकर architecture diagram तक — code लिख दो तो documentation खुद generate हो गई
Documentation का pit, जिसने खोदा वह जानता है
Code 20 बार change हुआ, README 3 महीने पुरानी है। नया employee documentation को देखता है, follow करता है, सब crash हो जाता है, पूछने पर पता चलता है "वह documentation outdated है।"
कोई documentation लिखना नहीं चाहता। Developer कहता है "code ही documentation है", product कहता है "तुम पहले लिख, मैं फिर देखूँ", आखिर में कोई नहीं लिखता, सिर्फ word-of-mouth।
अच्छे से API documentation लिख दी, production में 2 fields को change किया, sync करना भूल गए, frontend engineer documentation को देख के आधे दिन waste कर गया, तुम्हारे पास account मांगने आया।
OpenClaw को documentation को handle करने दो
OpenClaw सीधे तुम्हारे source code को पढ़ता है — function signatures, parameter types, return values, comments, call relationships — सब को analyze करके, फिर structured documentation generate करता है।
"This function takes one parameter" जैसी useless documentation नहीं है। हर API endpoint का purpose, parameter details, return examples, error codes — सब है।
Code change हो गई? Prompt को फिर से run करो, documentation automatically update हो जाएगी। Documentation और code को out-of-sync होने की चिंता नहीं।
Documentation generation Prompts, सीधे use कर सकते हो
README से लेकर API documentation से लेकर architecture diagram तक, तीन Prompts सब करते हैं।
Project की complete code structure को analyze करके professional README.md generate करो।
ये sections include करो:
1. Project intro: एक-दो lines में कि project क्या करता है
2. Features: bullet points में core features
3. Quick start: install, configure, run के steps (copy-paste करके चल जाए)
4. Project structure: directory tree + हर directory का brief description
5. Configuration: environment variables, config files का explanation
6. API brief (अगर है तो)
7. FAQs
Style: simple और clear, बकवास मत लिखो। Code examples complete हो सकें।
Project की सभी API routes/controllers files को read करो।
हर endpoint के लिए standard API documentation (Markdown) generate करो:
1. Path और HTTP method (GET/POST/PUT/DELETE)
2. Description: endpoint क्या करता है
3. Request parameters: name, type, required/optional, description, example
4. Request body example (JSON format)
5. Response examples: success और failure दोनों
6. Error codes explanation
7. Authentication requirement (अगर token चाहिए)
Modules के हिसाब से group करो, table of contents add करो।
Project की complete code structure और module dependencies को analyze करो।
ये Mermaid diagrams generate करो:
1. System architecture diagram (flowchart):
- Main modules और उनके interactions
- Data flow direction को mark करो
- Frontend, backend, database, third-party services को separate करो
2. Module dependency diagram (flowchart):
- Code modules की import/dependency relationships
- Core और utility modules को mark करो
3. Data flow diagram (sequenceDiagram):
- Core business का complete request path
- User interaction से database से return तक
हर diagram के साथ text explanation दे, key design decisions को explain करो।
Documentation generation: OpenClaw vs ChatGPT
दोनों documentation generate कर सकते हैं, लेकिन approach completely अलग है।
- Project source code को directly read करता है, real code से based documentation
- Files की references को समझता है, API documentation accurate और complete होता है
- Code update के बाद re-generate करो तो documentation automatically update हो जाएगी
- Mermaid architecture diagrams, sequence diagrams generate कर सकता है
- Manually code को copy-paste करना पड़ता है, context limited है
- Complete project structure नहीं देख सकता, endpoints miss हो सकते हैं
- Generated documentation एक-बारी होता है, code change के बाद फिर से paste करना पड़ता है
- Large projects का code tokens limit से exceed कर सकता है, एक बार में process नहीं कर सकता