Skip to content

Commit 6b07c18

Browse files
feat: enhance documentation guidelines with new heading and ToC policies, validation gates, and explanatory content requirements (#381)
1 parent 37381aa commit 6b07c18

File tree

4 files changed

+162
-19
lines changed

4 files changed

+162
-19
lines changed

.roo/rules-documentation-writer/1_writing_style.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,64 @@
248248
</steps>
249249
</phase>
250250
</content_change_workflow>
251+
<heading_and_toc_policy>
252+
<overview>Minimize right-sidebar ToC noise. Reserve H3 for jump-worthy anchors and prefer H4 for in-body sub-chunking.</overview>
253+
<rules>
254+
<rule>H1 is implicit (page title). Do not write H1 in the body.</rule>
255+
<rule>H2 = primary sections; aim for 3–6 per page.</rule>
256+
<rule>H3 = ToC-worthy anchors only. Target 0–2 per page; hard cap 4.</rule>
257+
<rule>H4 = break up long H2 sections without adding ToC items. Prefer H4 over H3 for minor subtopics.</rule>
258+
<rule>Disallow H5/H6 entirely.</rule>
259+
<rule>No orphan headings: any H2/H3/H4 must be followed by ≥2 sentences or a list.</rule>
260+
<rule>Any H3 under ~75 words or a single short paragraph must be demoted to H4 .</rule>
261+
<rule>Convert chains of small H3s into a single H2 with a numbered list; use H4 callouts if needed.</rule>
262+
<rule>If an H4 exceeds ~200–250 words or needs substructure, split it into its own page (new H2 there) rather than promoting inside the same page.</rule>
263+
</rules>
264+
<budgets>
265+
<page_h2>3–6</page_h2>
266+
<total_h3>typical ≤ 2, max 4</total_h3>
267+
</budgets>
268+
<author_workflow>
269+
<step>Outline H2 skeleton first.</step>
270+
<step>Mark jump-worthy items as H3 only if sidebar navigation helps.</step>
271+
<step>Everything else becomes H4 under the H2.</step>
272+
<step>Preview ToC; demote noisy H3s to H4s before publishing.</step>
273+
</author_workflow>
274+
<example name="checkpoints_restructure">
275+
<description>Demote unnecessary H3s under “Working with Checkpoints”.</description>
276+
<before>
277+
## Working with Checkpoints
278+
### Viewing Differences
279+
### Restoring Checkpoints
280+
### Limitations and Considerations
281+
</before>
282+
<after>
283+
## Working with Checkpoints
284+
#### Viewing differences: when it helps
285+
#### Restore a checkpoint: trade-off
286+
#### Limits and gotchas
287+
</after>
288+
</example>
289+
</heading_and_toc_policy>
290+
291+
<explanatory_baseline>
292+
<requirement when="applicable">Include sections: “Why it matters”, “What you can’t do (and why)”, and “Troubleshooting”.</requirement>
293+
<troubleshooting_pattern>
294+
<item>symptom</item>
295+
<item>cause</item>
296+
<item>fix</item>
297+
<item>prevention</item>
298+
</troubleshooting_pattern>
299+
</explanatory_baseline>
300+
301+
<tone_guidelines>
302+
<rules>
303+
<rule>Colloquial, informal, light. Use contractions and “you” voice.</rule>
304+
<rule>Bold, honest, human—avoid mechanical or professoral tone.</rule>
305+
</rules>
306+
</tone_guidelines>
307+
308+
<screenshot_caption_policy>
309+
<requirement>Every screenshot must include a one-line “why this view matters” caption in addition to outcome-focused alt text.</requirement>
310+
</screenshot_caption_policy>
251311
</writing_style_guide>

.roo/rules-documentation-writer/2_docusaurus_conventions.xml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
</policy>
5858

5959
<example>
60-
<![CDATA[
60+
6161
<!-- First discover the actual image path structure, then use it -->
6262
<img src="/img/installing/installing-2.png" alt="VS Code's Install from VSIX dialog" width="600" />
63-
]]>
63+
6464
</example>
6565
</rule>
6666
</media>
@@ -85,7 +85,7 @@
8585
<step>Follow the established pattern</step>
8686
</discovery_steps>
8787
<example>
88-
<![CDATA[
88+
8989
---
9090
description: A concise summary of the page content.
9191
keywords:
@@ -95,7 +95,7 @@ keywords:
9595
- search
9696
image: /img/social-share.jpg
9797
---
98-
]]>
98+
9999
</example>
100100
</rule>
101101
</frontmatter>
@@ -135,7 +135,7 @@ image: /img/social-share.jpg
135135
- File paths discovered
136136
</validation_requirement>
137137
<example>
138-
<![CDATA[
138+
139139
<!-- MANDATORY: Search with multiple variations -->
140140
<codebase_search>
141141
<query>authentication setup configuration</query>
@@ -153,7 +153,7 @@ image: /img/social-share.jpg
153153
<query>user access credentials permissions</query>
154154
<path>docs</path>
155155
</codebase_search>
156-
]]>
156+
157157
</example>
158158
</step>
159159

@@ -337,7 +337,7 @@ image: /img/social-share.jpg
337337
<scenario>When the impact on other documents is unclear</scenario>
338338
</scenarios>
339339
<example>
340-
<![CDATA[
340+
341341
<ask_followup_question>
342342
<question>I found existing content about this topic in three different locations. How would you like me to proceed?</question>
343343
<follow_up>
@@ -347,7 +347,39 @@ image: /img/social-share.jpg
347347
<suggest>Show me the existing locations first so I can decide</suggest>
348348
</follow_up>
349349
</ask_followup_question>
350-
]]>
350+
351351
</example>
352352
</ask_before_proceeding>
353+
<headings>
354+
<overview>Control sidebar ToC noise and standardize heading usage.</overview>
355+
<rules>
356+
<rule>H1 comes from the page title; do not include H1 in body content.</rule>
357+
<rule>Use H2 for primary sections (aim for 3–6 per page).</rule>
358+
<rule>Use H3 only for ToC-worthy anchors users may want to jump to (target 0–2; hard cap 4 per page).</rule>
359+
<rule>Prefer H4 for in-body sub-chunking so minor topics don’t pollute the ToC.</rule>
360+
<rule>Disallow H5/H6 entirely.</rule>
361+
<rule>No orphan headings: any H2/H3/H4 must be followed by at least two sentences or a list.</rule>
362+
<rule>Any H3 under ~75 words or a single short paragraph must be demoted to H4 under its H2.</rule>
363+
<rule>Convert chains of small H3s into one H2 with a numbered list; optional H4 callouts for sub-points.</rule>
364+
</rules>
365+
<toc_noise_standard>Total H3 ≤ 4 (typical ≤ 2). Demote non‑essential H3s to H4.</toc_noise_standard>
366+
<example name="demote_h3_to_h4">
367+
<before>
368+
## Working with Checkpoints
369+
### Viewing Differences
370+
### Restoring Checkpoints
371+
### Limitations and Considerations
372+
</before>
373+
<after>
374+
## Working with Checkpoints
375+
#### Viewing differences: when it helps
376+
#### Restore a checkpoint: trade-offs
377+
#### Limits and gotchas
378+
</after>
379+
</example>
380+
</headings>
381+
382+
<media_adjustments>
383+
<caption_requirement>Each screenshot must have a one‑line “why this view matters” caption in addition to outcome‑focused alt text. Use screenshots only for complex states or decision points; keep limits ≤1 per section and ≤3 per page.</caption_requirement>
384+
</media_adjustments>
353385
</docusaurus_conventions>

.roo/rules-documentation-writer/3_validation_enforcement.xml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,54 @@
133133
- Get approval before proceeding
134134
</enforcement>
135135
</gate>
136+
<gate name="toc_noise_gate" type="BLOCKING">
137+
<description>Prevents noisy sidebars and redundant anchors.</description>
138+
<requirements>
139+
<requirement>Total H3 ≤ 4 (typical ≤ 2)</requirement>
140+
<requirement>Demote non-essential H3s to H4 under the parent H2</requirement>
141+
<requirement>No orphan headings (H2/H3/H4 must be followed by ≥2 sentences or a list)</requirement>
142+
</requirements>
143+
<enforcement>
144+
If limits are exceeded or headings are orphaned:
145+
- Demote H3s to H4 under the parent H2 before proceeding.
146+
</enforcement>
147+
</gate>
148+
149+
<gate name="heading_depth_gate" type="CRITICAL">
150+
<description>Restricts heading depth.</description>
151+
<requirements>
152+
<requirement>Allow only H2–H4</requirement>
153+
<requirement>Reject H5/H6</requirement>
154+
</requirements>
155+
<enforcement>
156+
Any H5/H6 usage blocks the edit until replaced or removed.
157+
</enforcement>
158+
</gate>
159+
160+
<gate name="thin_subsection_blocker" type="BLOCKING">
161+
<description>Prevents shallow ToC items.</description>
162+
<requirements>
163+
<requirement>Any H3 under ~75 words or a single short paragraph must be demoted to H4 under its H2</requirement>
164+
</requirements>
165+
</gate>
166+
167+
<gate name="explanatory_content_gate" type="BLOCKING">
168+
<description>Requires explanatory sections when applicable.</description>
169+
<requirements>
170+
<requirement>Include “Why it matters”</requirement>
171+
<requirement>Include “What you can’t do (and why)” when applicable</requirement>
172+
<requirement>Include “Troubleshooting” using symptom → cause → fix → prevention when applicable</requirement>
173+
</requirements>
174+
</gate>
175+
176+
<gate name="screenshot_selectivity_gate" type="BLOCKING">
177+
<description>Enforces complex-state-only screenshots and caption/alt-text quality.</description>
178+
<requirements>
179+
<requirement>Use screenshots only for complex states or decision points</requirement>
180+
<requirement>Provide outcome-focused alt text and a one-line “why this view matters” caption</requirement>
181+
<requirement>Respect limits: ≤1 per section, ≤3 per page</requirement>
182+
</requirements>
183+
</gate>
136184
</validation_gates>
137185

138186
<mandatory_workflows>
@@ -182,7 +230,7 @@
182230
<user_communication_requirements>
183231
<requirement type="validation_reporting">
184232
<description>MUST report validation findings before making changes</description>
185-
<template><![CDATA[
233+
<template>
186234
<ask_followup_question>
187235
<question>I've completed the mandatory validation process. Here are my findings:
188236

@@ -207,7 +255,7 @@ Should I proceed with this approach?</question>
207255
<suggest>Consolidate the scattered content instead</suggest>
208256
</follow_up>
209257
</ask_followup_question>
210-
]]></template>
258+
</template>
211259
</requirement>
212260
</user_communication_requirements>
213261

.roomodes

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,20 @@ customModes:
5151
roleDefinition: |-
5252
You are Roo Code, a documentation specialist who writes only what matters.
5353
Core behaviors:
54-
- Value-first: explain why before how; cut anything users can infer from the UI.
55-
- Bold, honest voice: direct, punchy, zero fluff; never fake hype.
56-
- Developer audience: precise, actionable, minimal steps.
57-
- Enforce the rules in .roo/rules-documentation-writer/ (writing style, value filter, screenshot policy).
58-
- Prefer consolidation over duplication; link to authoritative sources.
54+
- Explanatory first: tell users why, why not, and how to recover (troubleshooting).
55+
- Minimal ToC noise: H2 for primary sections; H3 only for jump-worthy anchors (max 4 per page, typically <= 2); prefer H4 for in-body sub-chunking; disallow H5/H6.
56+
- Merge thin subsections and convert step chains into numbered lists under their H2.
57+
- Bold, honest, human voice with contractions; informal and clear, not professoral.
58+
- Selective screenshots: only for complex states/decisions; require outcome-focused alt text and a one-line "why this matters" caption.
59+
- Prefer consolidation over duplication; link to the single source of truth.
60+
- Enforce .roo/rules-documentation-writer/ policies (writing style, headings/structure, Docusaurus conventions, validation gates).
5961
whenToUse: |-
60-
Use this mode to create or refine technical docs (.md/.mdx) with a value-first approach.
62+
Use this mode to create or refine technical docs (.md/.mdx) with an explanatory, value-first approach and a clean, minimal ToC.
6163
Triggers:
62-
- Pages drifting into UI narration or screen-by-screen walkthroughs
63-
- Need for concise "why it matters / what you can do" structure
64-
- Requests to add screenshots or restructure content for clarity
64+
- Pages with noisy right-sidebar ToCs or overuse of H3s
65+
- Requests to restructure into H2 sections with H4 sub-chunks and numbered lists
66+
- Need to add "Why it matters / What you can't do (and why) / Troubleshooting"
67+
- Requests to add or prune screenshots for complex states/decisions
6568
description: Creates and maintains Roo technical docs.
6669
groups:
6770
- read

0 commit comments

Comments
 (0)