Skip to content

Documentation Standards

Documentation is structured data for both human and AI consumption. These standards ensure AI assistants can effectively help with your project across all phases — development, deployment, operations, and user support.

Use tables, JSON, YAML, and code blocks instead of paragraphs.

Bad:

The database requires a PostgreSQL connection string. You need to set the DATABASE_URL environment variable to something like postgresql://postgres:secret@localhost:5432/mydb. Make sure the database is running first.

Good:

VariableFormatExampleRequired
DATABASE_URLpostgresql://user:pass@host:port/dbpostgresql://postgres:secret@localhost:5432/mydbYes
Terminal window
npm run db:test-connection
# Expected: "Connected successfully"

Never assume prior knowledge. State what things are, not just how they work.

Bad: “Run the migration script.”

Good: “Run npm run db:migrate to apply pending database schema changes. This reads from ./migrations/ and applies them in order.”

Clear “if X then Y” statements. AI assistants need these to troubleshoot.

SymptomCauseFix
ECONNREFUSED on port 5432PostgreSQL not runningsudo systemctl start postgresql
relation does not existMigrations not appliednpm run db:migrate
authentication failedWrong credentials in DATABASE_URLCheck .env matches database user

Consistent, parseable metadata. Use ISO dates, semantic versioning, and standardised status values.

**Status**: IN_DEVELOPMENT | TESTING | PRODUCTION
**Last Updated**: 2026-01-15
**Version**: 1.7.0

Use consistent terminology, add keyword anchors, and maintain a clear heading hierarchy.

  • One H1 per page (the title)
  • H2 for major sections
  • H3 for subsections
  • Never skip levels (no H1 → H3)

Date all documentation updates. Include “Last Updated” on every file.

Explicit links between related docs. Never assume the reader knows where to find related information.

LayerPhaseDocuments
DevelopmentBuildingAGENTS.md, Architecture docs, Phase plans
DeploymentSetting upDEPLOYMENT-GUIDE.md, OPERATIONS.md, API-REFERENCE.md
UserUsingUSER-GUIDE.md, TROUBLESHOOTING.md, Configuration guides

The templates include reusable documentation components:

ComponentPurpose
AI Navigation HeaderTells AI when to read each doc file
DOCS-MAP.mdMaster index of all documentation with priorities
ADR TemplateArchitecture Decision Records with structured format
Metadata BlockMachine-readable frontmatter for any document

Add to the top of documentation files to help AI assistants decide whether to read them:

<!-- AI NAVIGATION
Primary purpose: API authentication and authorization
Read when: user asks about auth, login, tokens, or permissions
Skip when: user asks about UI, frontend, or styling
Related: DEPLOYMENT-GUIDE.md (token configuration), API-REFERENCE.md
-->

Use the ADR template for significant decisions:

# ADR-001: Use JWT for API Authentication
**Status**: Accepted
**Date**: 2026-01-15
**Decision**: Use JWT tokens with 1-hour expiry for API auth
## Context
[Why this decision was needed]
## Considered Options
1. Session cookies
2. JWT tokens
3. API keys
## Decision
JWT tokens because [reasons]
## Consequences
- [Positive]
- [Negative]
Anti-patternWhy it’s badFix
Prose-only docsAI can’t extract structured dataUse tables and code blocks
No datesCan’t tell if docs are currentAdd “Last Updated” everywhere
Assumed knowledgeAI starts from zero each sessionState what things are
Marketing language”Production-ready” is meaninglessState actual status
Broken cross-refsAI follows dead linksVerify links at each checkpoint

The complete documentation standards document (1300+ lines with examples, templates, and an ADR walkthrough) is included at DOCUMENTATION-STANDARDS.md.