Documentation guide
Code is the primary documentation for Dizzy. Types, names, contracts, invariants, and tests define the implementation. Supplemental documentation addresses information that cannot be expressed adequately through those sources or the generated API reference.
Source documentation
Use the language's standard documentation comments for public interfaces and contracts. Explain units, coordinate spaces, ownership, lifetimes, threading, preconditions, failure behavior, and non-obvious invariants where relevant. Use C# XML documentation (<summary>, <param>, <returns>, <exception>, <remarks>, and <see cref="..."/>) for DocFX. Use the corresponding convention in Kotlin, Java, and other languages.
When behavior is difficult to explain, improve names, structure, and contracts first. Do not translate statements into prose, describe obvious getters, or repeat signatures. A rationale for an unusual implementation belongs beside the code that depends on it. Keep comments current as behavior changes. Tests express expected behavior and regressions; they do not replace caller contracts.
Repository layout
| Location | Content |
|---|---|
AGENTS.md |
Mandatory contributor instructions |
CLAUDE.md, GEMINI.md, .github/copilot-instructions.md |
References to the canonical AGENTS.md policy |
README.md |
Repository entry point |
Docs/Architecture/ |
System boundaries, integration contracts, accepted cross-component decisions |
Docs/<component>/ |
Component setup, integration, and design explanations |
Docs/<component>/toc.yml |
Navigation to maintained pages and generated API reference |
Docs/README.md |
DocFX build, dependency export, deployment |
Docs/Documentation.md |
This standard |
Docs/api/, Docs/_site/, Docs/.cache/ |
Generated or downloaded content; keep out of Git |
Use component names that match their project directory, including capitalization. Keep diagrams and images beside the referencing page or in that component's images/ directory. Do not create a separate documentation tree in a project or package, or a Research directory.
Preserve vendor documentation and required legal notices. The SDK placement instructions in HeartbeatApp/Watch/app/libs/README.md may remain next to the required binary. The listed agent compatibility files may remain outside Docs and must contain only a reference to AGENTS.md. Do not add nested agent instructions or duplicate the policy. Additional tool-required or distributable-package documentation outside Docs requires explicit approval. Record any approved exception here and in the layout check.
Supplemental pages
Extend an existing page when it covers the subject. A new page must address a specific maintenance or integration need, such as:
- Architecture and constraints that span multiple types or components.
- Setup and external prerequisites that the build configuration cannot express.
- Protocol semantics, compatibility limits, and evidence required to interpret external system behavior.
- An accepted design decision whose rationale affects maintenance.
Use descriptive sentence-case headings. Link to related pages with relative paths and to generated API members with DocFX cross-references, such as [StencilPortalFeature](xref:Portals.StencilPortalFeature). Do not copy signatures, maintain inventories of classes, or narrate implementation details already available in the source. Commands must identify their working directory and prerequisites.
Update the component TOC when adding, renaming, or removing a page. Use the root TOC for component navigation. Do not create placeholder articles to fill a hierarchy.
Visualizations
Use diagrams when they explain spatial relationships, lifecycles, ownership boundaries, data flow, or execution order more clearly than text. Prefer Mermaid for sequence, state, and dependency diagrams where supported by DocFX. Use SVG or screenshots for spatial and visual behavior. Name actual types and components, label relationships, and distinguish proposed designs from implemented behavior. Store editable diagram sources where practical. Do not add decorative images or diagrams that merely restate a list.
Writing standard
Write direct, factual technical English. Use the terminology of the implementation. Distinguish requirements, measured observations, and unresolved questions. Cite the specific source, version, or measurement conditions when an external claim affects the design. Do not claim an unrun test passed or describe proposed behavior as implemented.
Remove conversational introductions, praise, agreement, reassurance, rhetorical questions, filler, self-references, promotional language, vague adjectives, and repeated summaries. Avoid headings such as "Good to know", "Need to know", "What this settles", "Open gaps", and "Progress update". Describe the system rather than the conversation or the tasks that produced it.
| Avoid | Use instead |
|---|---|
| "Good to know: the queue is really robust." | Document queue capacity, overflow behavior, and caller obligations in its source contract. |
| "We decided to use this because it works great." | State an accepted constraint and its technical rationale where needed. |
| "Fixed the issue and verified everything." | Record the change in Git history and the verification result in the relevant task or pull request. |
| A copied list of methods or narration of the implementation | Link to the API and explain the missing contract or relationship. |
Research and temporary work
Keep drafts, investigations, AI responses, experiment notes, raw logs, generated reports, and unapproved proposals out of version control. Use an ignored location such as Docs/.cache/ or a temporary directory outside the checkout. Track status and decisions awaiting approval in Codecks or the relevant task discussion. Do not create a Markdown file merely to deliver a response.
If research establishes a durable constraint that affects implementation, retain the constraint, its evidence, and material limitations in the relevant maintained page or source. An external compatibility note may be justified; an entire investigation transcript is not. Keep reproducible tests as tests.
Commit policy
Commit implementation, source documentation, tests, assets, and maintained pages required by the change. Never commit credentials, personal data, transient outputs, generated API pages, or unapproved notes. Commit the portable Unity projects and reference manifests only when the documented dependency export requires them. Store the reference ZIP in the private release.
Review the staged diff and run:
pwsh -NoProfile -File Docs/Check-DocumentationLayout.ps1
The check rejects misplaced documentation and generated documentation output. Review the prose, claims, source contracts, and diagrams separately; file placement does not establish correctness. See the build guide for local generation and publication.