Welcome to the docs/ folder! This guide describes how we write and maintain documentation so that it is equally useful to:
- Humans – new contributors, reviewers, and future‑you.
- AIs – tools like Cursor that rely on concise, well‑structured Markdown for accurate context.
Follow the conventions below and our docs will stay discoverable, trustworthy, and friction‑free.
- Single source of truth for the parts that are not obvious from reading the code—especially design decisions and the reasons we chose this approach over alternatives—along with architecture and feature behaviour.
- Fast context for AI – Cursor automatically loads Markdown under
docs/into its context window, letting you prompt with what you want instead of why. - Living handbook – every pull‑request that changes behaviour must update or create docs.
❗ Never leave a feature undocumented. If it is worth merging, it is worth documenting.
project-root/
├── docs/
│ ├── index.md ← Overview of the app & doc index (see §4)
│ ├── architecture.md ← High‑level diagrams & design rationale
│ ├── api/
│ │ ├── README.md ← How to work with external APIs
│ │ └── auth.md
│ ├── features/
│ │ ├── user-profiles.md
│ │ └── notifications.md
│ ├── guides/
│ │ └── local-setup.md
│ ├── glossary.md ← Domain language & acronyms
│ └── contributing.md ← How to propose changes to docs/code
└── src/
Feel free to add nested folders to keep related documents together. Keep paths lowercase and use hyphens (-) not spaces.
| Aspect | Rule of Thumb |
|---|---|
| Audience | Write for a mid‑level engineer new to the codebase. |
| Length | Prefer short focused files (< ~300 lines). Split if longer. |
| Tone | Clear, active voice. Avoid future/tense ambiguity. |
| Headings | # for title, ## for major sections, ### sub‑sections. |
| Code blocks | Always annotate language (e.g. ```ts). |
| Cross‑links | Use relative links ([Auth](../api/auth.md)). |
| Diagrams | Use Mermaid or ASCII art in fenced blocks. |
| Metadata | Add a YAML front‑matter header (see below) so AIs know the intent. |
| Examples > Theory | Show typical call flows, edge‑cases, and gotchas. |
Place this at the top of every new doc (excluding index.md):
---
title: User Profiles Feature
author: @alice
last_updated: 2025-07-17
scope: feature
aliases: ["profiles", "users"]
---Cursor treats title, aliases, and scope as high‑value keywords when ranking context.
- Keep paragraphs under ~120 words.
- Define one concept per file; cross‑reference instead of duplicating.
- Use bullet lists for key facts – language models recall lists more reliably.
- Put the "why" before the "how"; motivate design choices.
index.md is the single entry point that both humans and Cursor read first. It must always answer three questions:
- What does the application do? · A 3–5 sentence elevator pitch.
- Where is the code? · A pruned file‑tree of
src/, max 2 levels deep. - What documentation exists? · A bullet list of every file under
docs/with one‑line summaries.
# <Project Name>
<Brief description of what the app achieves and its primary users.>
---
## Project File Structure (top‑level)<output of tree -L 2 -I 'node_modules|dist|.git' trimmed to essentials>
---
## Documentation Index
| Doc | Purpose |
|-----|---------|
| [architecture.md](architecture.md) | High‑level component & data‑flow diagrams |
| [api/README.md](api/README.md) | How to consume third‑party APIs |
| ... | ... |
Keep the table alphabetically sorted. When you add a new doc, update this list in the same pull‑request.
Tip: Paste the following into Cursor to regenerate
index.mdautomatically when adding files:# SYSTEM You are UpdateIndexBot. Scan docs/, list each .md file (max depth 2) with one‑line summary (first H1 or YAML title). Rewrite docs/index.md accordingly.
- Review – During code‑review, missing docs are a change‑request.
- Refactor – When deleting or moving code, delete/move its docs too.
- Automate – Consider adding a CI job that fails if
index.mdis stale (comparegit diff --name-only HEAD~1 docs/).
Diátaxis Documentation Framework – inspiration for splitting docs by purpose.
- Microsoft Writing Style Guide – clear, consistent technical prose.
Happy documenting! ✨