|
| 1 | +# 18. Documentation Strategy for AI Agents and Developers |
| 2 | + |
| 3 | +Date: 2025-10-05 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Accepted |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +Forms Platform requires documentation that serves two audiences: human developers and AI coding agents. Existing documentation includes READMEs, ADRs, AGENTS.md, CLAUDE.md, and various technical guides. However, the documentation lacks: |
| 12 | + |
| 13 | +1. A clear navigation structure for discovery |
| 14 | +2. Consistent organization across documents |
| 15 | +3. Optimization for AI agent context windows |
| 16 | +4. Clear maintenance guidelines |
| 17 | + |
| 18 | +Research shows AI agents work best with: |
| 19 | +- Progressive disclosure (index → summary → details) |
| 20 | +- Context-efficient, modular documentation |
| 21 | +- Specific, descriptive titles (not generic "Overview") |
| 22 | +- Plain language with direct, unambiguous phrasing |
| 23 | +- Clear cross-references between related concepts |
| 24 | + |
| 25 | +The AGENTS.md standard has emerged as best practice for AI coding agents, adopted by 20,000+ repositories. |
| 26 | + |
| 27 | +## Decision |
| 28 | + |
| 29 | +We implement a six-layer documentation architecture: |
| 30 | + |
| 31 | +### Layer 1: Navigation (Discovery) |
| 32 | +- `DOCS.md` - Master documentation index with categorized links |
| 33 | +- `AGENTS.md` - AI agent quick start and repository guidelines |
| 34 | +- `CLAUDE.md` - Claude Code-specific configuration and patterns |
| 35 | +- `README.md` - Project overview and getting started |
| 36 | + |
| 37 | +### Layer 2: Quick Reference (Common Tasks) |
| 38 | +- `documents/quick-reference.md` - Commands, workflows, troubleshooting |
| 39 | +- Organized by: Setup, Development, Testing, Deployment, Common Issues |
| 40 | + |
| 41 | +### Layer 3: Concepts & Patterns (How We Build) |
| 42 | +- `documents/patterns-and-conventions.md` - Coding standards, architecture patterns |
| 43 | +- `documents/terminology.md` - Domain language (ubiquitous language) |
| 44 | +- `documents/architecture.md` - System architecture and component relationships |
| 45 | + |
| 46 | +### Layer 4: Decisions & History (Why We Build This Way) |
| 47 | +- `documents/adr/` - Architecture Decision Records (numbered NNNN-title.md) |
| 48 | +- Standard format: Status, Context, Decision, Consequences |
| 49 | + |
| 50 | +### Layer 5: Operations (Running the System) |
| 51 | +- `documents/release-process.md` - Release workflow |
| 52 | +- `documents/podman-integration.md` - Development environment setup |
| 53 | +- Other operational guides as needed |
| 54 | + |
| 55 | +### Layer 6: Package-Specific (Deep Dives) |
| 56 | +- Package-level READMEs in each workspace package |
| 57 | +- Detailed API documentation and implementation notes |
| 58 | + |
| 59 | +### Documentation Standards |
| 60 | + |
| 61 | +**File Naming** |
| 62 | +- Use descriptive, specific names: `authentication-flow.md` not `overview.md` |
| 63 | +- Use kebab-case for filenames |
| 64 | +- ADRs follow pattern: `NNNN-descriptive-title.md` |
| 65 | + |
| 66 | +**Content Structure** |
| 67 | +- Start each document with one-sentence purpose statement |
| 68 | +- Use consistent heading hierarchy (##, ###) |
| 69 | +- Include "See also" sections for related documents |
| 70 | +- Keep sentences short and direct |
| 71 | +- Use bullet lists for scannability |
| 72 | +- Provide code examples where helpful |
| 73 | +- Avoid duplication - link to authoritative source |
| 74 | + |
| 75 | +**Maintenance Process** |
| 76 | +- Documentation changes in same PR as related code changes |
| 77 | +- AI agents must update relevant docs when implementing features |
| 78 | +- Create new ADR for any significant architectural decision |
| 79 | +- Regular documentation review to identify gaps and outdated content |
| 80 | + |
| 81 | +**AI Agent Optimization** |
| 82 | +- Keep documents focused and modular (< 500 lines preferred) |
| 83 | +- Use specific, searchable titles |
| 84 | +- Include clear summary at document start |
| 85 | +- Cross-reference related documents |
| 86 | +- Avoid verbose explanations - prefer direct statements |
| 87 | + |
| 88 | +## Consequences |
| 89 | + |
| 90 | +### Positive |
| 91 | +- AI agents can quickly discover relevant documentation via DOCS.md index |
| 92 | +- Modular structure reduces context window usage |
| 93 | +- Clear maintenance guidelines ensure documentation stays current |
| 94 | +- Progressive disclosure serves both quick lookups and deep research |
| 95 | +- Consistent structure reduces cognitive load |
| 96 | +- Single source of truth reduces contradictions |
| 97 | + |
| 98 | +### Negative |
| 99 | +- Requires initial effort to create new documentation |
| 100 | +- Developers must maintain documentation alongside code |
| 101 | +- Additional files to track in version control |
| 102 | + |
| 103 | +### Mitigation |
| 104 | +- AI agents can generate initial documentation from existing code |
| 105 | +- Documentation updates are mandatory part of code review |
| 106 | +- Clear templates reduce friction for creating new docs |
| 107 | +- Index structure makes it easy to find and update docs |
0 commit comments