| name | agentic-docs |
| description | Write clear, plain-spoken code comments and documentation that lives alongside the code. Use when writing or reviewing code that needs inline documentation like file headers, function docs, architectural decisions, or explanatory comments. Works well for both human readers and AI coding assistants who see one file at a time. |
Agentic Docs
Write documentation that lives with the code it describes. Plain language. No jargon. Explain the why, not the what.
Core Philosophy
Co-location wins. Documentation in separate files drifts out of sync. Comments next to code stay accurate because they're updated together.
Write for three audiences:
- Future you, six months from now
- Teammates reading unfamiliar code
- AI assistants (Claude, Copilot) who see one file at a time
The "why" test: Before writing a comment, ask: "Does this explain why this code exists or why it works this way?" If it only restates what the code does, skip it.
Documentation Levels
File Headers
Every file should open with a brief explanation of its purpose and how it fits into the larger system.
Include:
- What this file/module is responsible for
- Why it exists (if not obvious from the name)
- Relationships to other parts of the codebase
- Any non-obvious design decisions
Function & Method Documentation
Document the contract, not the implementation.
function calculateShipping(weightLbs: number, zipCode: string): number
def sync_user_preferences(user_id: str, prefs: dict) -> SyncResult:
"""
Pushes local preference changes to the server and pulls remote changes.
Conflict resolution: server wins for security settings, local wins
for UI preferences. See PREFERENCES.md for the full conflict matrix.
Called automatically on app foreground. Can also be triggered manually
from Settings > Sync Now.
"""
Include:
- What the function accomplishes (not how)
- Non-obvious parameter constraints or edge cases
- What the return value means, especially for ambiguous cases
- Side effects (network calls, file writes, state mutations)
Skip for: Simple getters, obvious one-liners, private helpers with descriptive names.
Inline Comments
Use sparingly. When you need them, explain the reasoning.
const debouncedSearch = useMemo(
() => debounce(executeSearch, 300),
[executeSearch]
);
let tableView = tableView!
queue.sort(key=lambda x: x.created_at)
Architectural Comments
For code that embodies important design decisions, explain the tradeoffs.
TODO Comments
Make them actionable and traceable.
Language-Specific Patterns
See references/language-examples.md for detailed examples in:
- TypeScript/JavaScript (JSDoc, TSDoc patterns)
- Swift (documentation comments, MARK pragmas)
- Python (docstrings, type hint documentation)
- React/Next.js (component documentation patterns)
Writing Style
Plain language. Write like you're explaining to a smart colleague who doesn't have context.
Active voice. "This function validates..." not "Validation is performed..."
Be specific. "Retries 3 times with 1s backoff" not "Handles retries."
Skip the obvious. If the code says user.isAdmin, don't comment "checks if user is admin."
Date things that expire. Workarounds, version-specific code, and temporary solutions should note when they can be removed.
Reference constants, don't duplicate values. When a behavior is controlled by a constant, reference it by name. Don't restate its value in the comment.
pub fn is_stale(&self) -> bool { ... }
pub fn is_stale(&self) -> bool { ... }
Unit translations for magic numbers are fine (1048576 // 1MB) since they add clarity, not duplication.