documentation

Rules for writing and maintaining developer documentation, including API comments, README files, architecture decisions, and examples. They focus on explaining behavior that users need but might not infer from the code.

In plain words
What is it for?
Use them when documenting public APIs, updating a README after code changes, recording design decisions, or adding working quick-start examples.
Why use it?
They help prevent outdated or unusable documentation and make it easier for someone new to install, understand, and use a project.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursor-doctor/documentation
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctor
Per session 814 This file is loaded in full into every session.
When invoked 814 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00814 $0.00814
Opus 5 $0.00407 $0.00407
Sonnet 5 $0.00163 $0.00163
Haiku 4.5 $0.00081 $0.00081

Measured yesterday against content hash f88450d86421, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

documentation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

pro-kit/templates/practices/documentation.mdc · 39 lines

How it starts

The opening of the file, as written. The whole thing — 39 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Documentation Rules

Code Documentation

  • Document public APIs: what it does, parameters, return type, thrown exceptions, and a usage example. If the function is non-trivial, the example is the most important part
  • Document non-obvious behavior: "Returns cached result if called within 5 minutes" or "Blocks until connection is established" — things the type signature doesn't tell you
  • Don't document the obvious: /** Gets the user */ function getUser() wastes everyone's time. Document what's surprising, not what's self-evident
  • Update docs when code changes or delete them. Stale docs are actively harmful — a developer follows outdated instructions, wastes hours, and loses trust in all your docs
  • JSDoc/TSDoc/Javadoc/docstrings for libraries and shared code. Internal-only functions can have lighter docs — audience matters

README

  • First line answers "what is this and why would I care" in one sentence. Not a mission statement, not a history lesson — what does it do
  • Quick start that actually works: clone → install → run in under 60 seconds. Test your own quick start on a clean machine — broken quickstarts are the #1 reason people bounce
  • Examples are copy-pasteable and produce the shown output. If the example requires unstated prerequisites, it's broken documentation
  • Configuration section: every env var, config file option, CLI flag with its default value and what it does. Undocumented config = hidden config
  • Badges (build status, version, license) only if they're accurate and maintained. A broken CI badge at the top of your README says "this project is abandoned"

Architecture Decision Records (ADRs)

  • Record significant decisions in docs/adr/ or docs/decisions/: title, context, decision, consequences. Format: NNNN-title.md
  • ADRs answer "why did we choose X over Y?" six months later when nobody remembers — they're not for today, they're for future-you and new team members
  • Include what was rejected and why: "We chose PostgreSQL over MongoDB because our data is relational and we need transactions. MongoDB was faster to prototype but we'd fight the data model long-term"
  • ADRs are immutable — if a decision is reversed, write a new ADR referencing the old one. Don't edit history

Read the full file on GitHub · 39 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 39 lines · 814 tokens per session scan A f88450d86421

Subscribe to this mod's changes

documentation is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 814 tokens to every session, about $0.0041 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.