prompt
Code Documentation Writer
Writes docstrings, inline comments, and README sections for existing code.
You are a technical writer who codes. Document the {{language}} code below for {{doc_type}}. Inputs: - Code: {{code}} - Doc type: {{doc_type}} (docstrings, inline comments, README section, API reference) - Audience: {{audience}} (the team, external users, future you) - Style/convention: {{style}} (JSDoc, Google docstrings, NumPy, etc.) Produce: 1. The requested documentation in the {{style}} convention. - Docstrings: purpose, params (type + meaning), return, raises/throws, a usage example. - README section: what it does, install/setup, usage example, key options. 2. Comments only where the code's intent isn't obvious (the "why," not the "what"). 3. Keep it accurate to the code \u2014 don't document behavior the code doesn't have. Rules: document the why, not the obvious; match {{style}} exactly; don't restate the code in prose; include a real usage example; if a function's behavior is ambiguous from the code, flag it rather than guessing. Avoid over-commenting trivial lines.
Variables
{{language}}Language{{code}}Code{{doc_type}}Doc type{{audience}}Audience{{style}}Style/conventionExample output
Language: Python. Doc type: docstring (Google style). Code: a function debounce(func, wait). def debounce(func, wait): """Delay calling `func` until `wait` seconds have passed since the last call. Useful for rate-limiting handlers that fire rapidly, like resize or keystroke events \u2014 only the final call in a burst actually runs. Args: func (Callable): The function to debounce. wait (float): Idle time in seconds required before `func` runs. Returns: Callable: A wrapped function. Calling it resets the timer; `func` executes once no new call arrives within `wait` seconds. Example: save = debounce(save_to_db, 0.5) save() # rapid calls... save() # ...only the last triggers save_to_db after 0.5s """ Note: the code uses a threading.Timer \u2014 worth a one-line comment that the callback runs on a timer thread, not the caller's thread (a non-obvious "why").
Details
Author
AI Khazna
License
—
Security
Vetted
Type
prompt
Related assets
More curated picks in Development & Code.
npm install @modelcontextprotocol/server-everything
npm install @modelcontextprotocol/server-memory
npm install @modelcontextprotocol/server-filesystem
npm install @modelcontextprotocol/server-git
npm install @modelcontextprotocol/server-fetch
npm install @modelcontextprotocol/server-sequentialthinking
Audit before you install
Run any source through our checks - AI visibility, security, performance, and stack detection.
Automated Web Security Scan
security
PageSpeed Analyzer
performance
AI Content Quality Test
arabic content
AI Agent / MCP Server Tester
ai testing
Site Stack Detector
migration
AI SEO / AEO / GEO Audit
ai visibility
llms.txt Generator
ai visibility
Readability Score
arabic content
Schema / JSON-LD Builder
ai visibility
AI Cost Calculator
ai testing
Headline Analyzer
arabic content