Documentation Guidelines
Goal
Treat documentation as durable semantic context for agents. Capture what code cannot
safely explain alone: business intent, ownership, invariants, lifecycle, permissions,
side effects, contracts, operational constraints, and decision rationale. Let source
and tests own implementation detail and executable evidence.
Prefer compact facts over tutorial prose. Follow repository instructions and existing
conventions; do not impose a standard directory tree.
Run this skill in the main conversation. Delegation can increase usage; do not use
subagents unless the user explicitly approves the proposed agent count and scope.
Ask again before expanding an approved scope.
Read only the relevant reference:
references/templates.md for module, feature, workflow, contract, or runbook docs.
references/architecture.md for multi-owner routing, registries, and structure.
references/audit-cleanup.md for broad audits, consolidation, or stale-doc removal.
Context Protocol
Start with documentation before broad source exploration:
- Read repository instructions and the nearest documentation router or index.
- Read the owner document for the relevant scope.
- Follow its required-context links for parent scope, contracts, dependencies,
state models, decisions, and operational constraints.
- Use named source and test anchors to verify missing, risky, or plausibly stale
facts; do not rediscover the whole system from code by default.
- Ask a targeted question only when docs, focused evidence, and history cannot
resolve a fact or a product decision is required.
Do not cap reading by file count. Stop when the completeness gate passes, and do not
follow merely related links after that point. Mark required context separately from
additional context when the distinction prevents over-reading or missed dependencies.
Context Completeness Gate
Before relying on docs, be able to state the applicable:
- Business outcome, scope, non-goals, and terminology.
- Actors, permissions, preconditions, and triggers.
- Rules, invariants, lifecycle or state transitions, and failure paths.
- Inputs, outputs, persisted facts, public contracts, and compatibility constraints.
- Side effects, transaction boundaries, retries, and idempotency expectations.
- Ownership boundaries, upstream dependencies, and downstream consumers.
- Authoritative source and test anchors, plus unresolved or intentionally unspecified
behavior.
Omit inapplicable items. Treat an unknown applicable item as a documentation gap:
follow required context, verify focused evidence, and update its canonical owner when
the task includes documentation changes.
Documentation Impact Gate
Update docs only when a durable fact would otherwise become wrong or undiscoverable.
| Change |
Default action |
| Internal refactor, test-only change, formatting, or bug fix restoring documented behavior |
No docs change unless a documented route or evidence anchor changed |
| User-visible behavior, business rule, workflow, or stable feature scope |
Update its canonical owner |
| API, schema, event, permission, validation, compatibility, or cross-boundary contract |
Update the contract owner and only affected consumer or relationship mappings |
| Setup, migration, deployment, recovery, queue, schedule, or operational behavior |
Update the owning runbook or reference |
| Add, rename, move, archive, or remove an owned entity |
Update its owner and minimum discovery routes |
| Obsolete, duplicated, or contradictory docs |
Preserve valid facts in owners, fix routes, then remove the stale copy when Git history is sufficient |
Do not edit docs merely to record a review. Keep plans, raw commands, screenshots,
CI output, and implementation history in the task, pull request, tests, CI, or Git
unless they encode a durable operational requirement.
Ownership And Routing
- Give every durable fact one canonical enforcement owner.
- Routers resolve ownership and link to context; they do not copy owner content.
- Consumer docs link to owned contracts and record only local mapping, behavior,
error handling, or constraints.
- Add registries only when repeated discovery across many entities justifies them;
generate alternate catalogs when practical.
- Map only dependencies that cross ownership boundaries and materially affect
behavior, compatibility, deployment, data, or operations.
- Prefer existing names and layout. Stable headings, searchable business terms, and
exact links matter more than prescribed filename suffixes.
- Use frontmatter only when tooling or routing consumes it. Avoid mechanical dates,
versions, ownership fields, and status metadata that will rot.
- Keep historical records only for an active coordination, audit, legal, migration,
or operational need, outside the default context path when possible.
Authoring Rules
- Write facts, rules, boundaries, exceptions, negative rules, and compact examples;
omit explanations of concepts a capable agent can infer reliably.
- Prefer stable headings, short bullets, exact mapping tables, and diagrams only for
non-trivial flows or relationships.
- Provide a small set of stable evidence anchors: symbols, entrypoints, schemas,
commands, or test suites rather than line numbers or source inventories.
- Separate required context, additional context, and evidence anchors when useful.
- Link another owner's contract instead of paraphrasing it; record only local
consequences.
- Exclude placeholders, speculation, copied implementation, transient counts, and
task-specific results from durable docs.
Workflow
- Apply the impact gate and identify each changed durable fact.
- Discover existing routes and canonical owners.
- Read enough owner and relationship context to pass the completeness gate; verify
with focused source, tests, schemas, and configuration.
- Update the smallest set of owner docs that would otherwise be wrong or incomplete.
- Update routes, registries, or relationship maps only when discovery, identity,
ownership, or cross-boundary context changed.
- Remove contradictory copies; search for stale names, paths, IDs, links, contracts,
and consumers.
- Run focused documentation checks. After the documentation work is complete,
list any broader repository or full-suite checks and ask the user whether to
run them. Report changed durable context, unresolved gaps, or why no docs
update was needed.
Verification
Confirm that the shortest discoverable path reaches the correct owner and required
context; the completeness gate passes without broad code search; owner and consumer
docs do not compete; links, identifiers, relationships, and evidence anchors remain
current; and documentation fan-out is proportionate to the durable change.
1---2name: documentation-guidelines3description: Coordinator-routed specialist for documentation architecture, broad audits, canonical ownership, module/feature docs, contracts, workflows, runbooks, or stale-content consolidation. Use after project-development-mindset makes documentation the primary deliverable, or directly when explicitly invoked or installed standalone. Do not use for routine docs alignment accompanying code or configuration changes.4---5
6# Documentation Guidelines
7
8## Goal
9
10Treat documentation as durable semantic context for agents. Capture what code cannot
11safely explain alone: business intent, ownership, invariants, lifecycle, permissions,
12side effects, contracts, operational constraints, and decision rationale. Let source
13and tests own implementation detail and executable evidence.
14
15Prefer compact facts over tutorial prose. Follow repository instructions and existing
16conventions; do not impose a standard directory tree.
17
18Run this skill in the main conversation. Delegation can increase usage; do not use
19subagents unless the user explicitly approves the proposed agent count and scope.
20Ask again before expanding an approved scope.
21
22Read only the relevant reference:
23
24- `references/templates.md` for module, feature, workflow, contract, or runbook docs.
25- `references/architecture.md` for multi-owner routing, registries, and structure.
26- `references/audit-cleanup.md` for broad audits, consolidation, or stale-doc removal.
27
28## Context Protocol
29
30Start with documentation before broad source exploration:
31
321. Read repository instructions and the nearest documentation router or index.
332. Read the owner document for the relevant scope.
343. Follow its required-context links for parent scope, contracts, dependencies,
35 state models, decisions, and operational constraints.
364. Use named source and test anchors to verify missing, risky, or plausibly stale
37 facts; do not rediscover the whole system from code by default.
385. Ask a targeted question only when docs, focused evidence, and history cannot
39 resolve a fact or a product decision is required.
40
41Do not cap reading by file count. Stop when the completeness gate passes, and do not
42follow merely related links after that point. Mark required context separately from
43additional context when the distinction prevents over-reading or missed dependencies.
44
45## Context Completeness Gate
46
47Before relying on docs, be able to state the applicable:
48
49- Business outcome, scope, non-goals, and terminology.
50- Actors, permissions, preconditions, and triggers.
51- Rules, invariants, lifecycle or state transitions, and failure paths.
52- Inputs, outputs, persisted facts, public contracts, and compatibility constraints.
53- Side effects, transaction boundaries, retries, and idempotency expectations.
54- Ownership boundaries, upstream dependencies, and downstream consumers.
55- Authoritative source and test anchors, plus unresolved or intentionally unspecified
56 behavior.
57
58Omit inapplicable items. Treat an unknown applicable item as a documentation gap:
59follow required context, verify focused evidence, and update its canonical owner when
60the task includes documentation changes.
61
62## Documentation Impact Gate
63
64Update docs only when a durable fact would otherwise become wrong or undiscoverable.
65
66| Change | Default action |
67| :--- | :--- |
68| Internal refactor, test-only change, formatting, or bug fix restoring documented behavior | No docs change unless a documented route or evidence anchor changed |
69| User-visible behavior, business rule, workflow, or stable feature scope | Update its canonical owner |
70| API, schema, event, permission, validation, compatibility, or cross-boundary contract | Update the contract owner and only affected consumer or relationship mappings |
71| Setup, migration, deployment, recovery, queue, schedule, or operational behavior | Update the owning runbook or reference |
72| Add, rename, move, archive, or remove an owned entity | Update its owner and minimum discovery routes |
73| Obsolete, duplicated, or contradictory docs | Preserve valid facts in owners, fix routes, then remove the stale copy when Git history is sufficient |
74
75Do not edit docs merely to record a review. Keep plans, raw commands, screenshots,
76CI output, and implementation history in the task, pull request, tests, CI, or Git
77unless they encode a durable operational requirement.
78
79## Ownership And Routing
80
81- Give every durable fact one canonical enforcement owner.
82- Routers resolve ownership and link to context; they do not copy owner content.
83- Consumer docs link to owned contracts and record only local mapping, behavior,
84 error handling, or constraints.
85- Add registries only when repeated discovery across many entities justifies them;
86 generate alternate catalogs when practical.
87- Map only dependencies that cross ownership boundaries and materially affect
88 behavior, compatibility, deployment, data, or operations.
89- Prefer existing names and layout. Stable headings, searchable business terms, and
90 exact links matter more than prescribed filename suffixes.
91- Use frontmatter only when tooling or routing consumes it. Avoid mechanical dates,
92 versions, ownership fields, and status metadata that will rot.
93- Keep historical records only for an active coordination, audit, legal, migration,
94 or operational need, outside the default context path when possible.
95
96## Authoring Rules
97
98- Write facts, rules, boundaries, exceptions, negative rules, and compact examples;
99 omit explanations of concepts a capable agent can infer reliably.
100- Prefer stable headings, short bullets, exact mapping tables, and diagrams only for
101 non-trivial flows or relationships.
102- Provide a small set of stable evidence anchors: symbols, entrypoints, schemas,
103 commands, or test suites rather than line numbers or source inventories.
104- Separate required context, additional context, and evidence anchors when useful.
105- Link another owner's contract instead of paraphrasing it; record only local
106 consequences.
107- Exclude placeholders, speculation, copied implementation, transient counts, and
108 task-specific results from durable docs.
109
110## Workflow
111
1121. Apply the impact gate and identify each changed durable fact.
1132. Discover existing routes and canonical owners.
1143. Read enough owner and relationship context to pass the completeness gate; verify
115 with focused source, tests, schemas, and configuration.
1164. Update the smallest set of owner docs that would otherwise be wrong or incomplete.
1175. Update routes, registries, or relationship maps only when discovery, identity,
118 ownership, or cross-boundary context changed.
1196. Remove contradictory copies; search for stale names, paths, IDs, links, contracts,
120 and consumers.
1217. Run focused documentation checks. After the documentation work is complete,
122 list any broader repository or full-suite checks and ask the user whether to
123 run them. Report changed durable context, unresolved gaps, or why no docs
124 update was needed.
125
126## Verification
127
128Confirm that the shortest discoverable path reaches the correct owner and required
129context; the completeness gate passes without broad code search; owner and consumer
130docs do not compete; links, identifiers, relationships, and evidence anchors remain
131current; and documentation fan-out is proportionate to the durable change.