|
| 1 | +--- |
| 2 | +name: migrate-integration-docs |
| 3 | +description: Migrate Home Assistant integration docs to split-page format. |
| 4 | +--- |
| 5 | + |
| 6 | +Usage: `/migrate-integration-docs <domain> [epic-or-issue]` |
| 7 | + |
| 8 | +Migrate `./source/_integrations/<domain>.markdown` to the current Home Assistant split-page documentation format. |
| 9 | + |
| 10 | +Keep the main context small. |
| 11 | +Use sub-agents for discovery and review. |
| 12 | +Do not trust the epic, issue text, or existing docs unless Core confirms them. |
| 13 | +Treat `https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/documenting/integration-docs-examples.md` as the canonical template for split pages. |
| 14 | +Treat `https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/documenting/yaml-style-guide.md` as the YAML style source for all YAML examples. |
| 15 | +Do not loosely imitate it. |
| 16 | +Follow its structure closely unless Core implementation makes a specific section inapplicable. |
| 17 | + |
| 18 | +## Stage 1: inventory with a sub-agent |
| 19 | + |
| 20 | +Launch a sub-agent to inspect: |
| 21 | + |
| 22 | +- `./source/_integrations/<domain>.markdown` |
| 23 | +- If you have Home Assistant Core and Frontend checked out, inspect: |
| 24 | + - `../core/homeassistant/components/<domain>/conditions.yaml` |
| 25 | + - `../core/homeassistant/components/<domain>/services.yaml` |
| 26 | + - `../core/homeassistant/components/<domain>/triggers.yaml` |
| 27 | + - `../core/homeassistant/components/<domain>/strings.json` |
| 28 | + - `../frontend/src/translations/en.json` |
| 29 | +- any existing split pages for `<domain>` in: |
| 30 | + - `./source/_triggers` |
| 31 | + - `./source/_conditions` |
| 32 | + - `./source/_actions` |
| 33 | + |
| 34 | +The sub-agent must return only this compact inventory: |
| 35 | + |
| 36 | +```md |
| 37 | +Domain: <domain> |
| 38 | + |
| 39 | +Triggers to document: |
| 40 | +- key: <domain>.<trigger_key> |
| 41 | + title: <title> |
| 42 | + description: <description> |
| 43 | + target domains: [...] |
| 44 | + options: [...] |
| 45 | + |
| 46 | +Conditions to document: |
| 47 | +- key: <domain>.<condition_key> |
| 48 | + title: <title> |
| 49 | + description: <description> |
| 50 | + target domains: [...] |
| 51 | + options: [...] |
| 52 | + |
| 53 | +Actions to document: |
| 54 | +- key: <domain>.<action_key> |
| 55 | + title: <title> |
| 56 | + description: <description> |
| 57 | + target domains: [...] |
| 58 | + fields: [...] |
| 59 | + |
| 60 | +Categories not implemented: |
| 61 | +- ... |
| 62 | + |
| 63 | +Existing split pages: |
| 64 | +- ... |
| 65 | + |
| 66 | +UI wording: |
| 67 | +- trigger behavior labels: ... |
| 68 | +- condition behavior labels: ... |
| 69 | +- action-specific labels: ... |
| 70 | +- automation example action labels to mirror: ... |
| 71 | + |
| 72 | +Important implementation notes: |
| 73 | +- ... |
| 74 | + |
| 75 | +Mismatches between epic/issue text and Core: |
| 76 | +- ... |
| 77 | +``` |
| 78 | + |
| 79 | +Rules for Stage 1: |
| 80 | + |
| 81 | +- Core is the source of truth. |
| 82 | +- Verify categories from Core, not from the issue. |
| 83 | +- Verify exact keys from YAML or implementation. |
| 84 | +- Verify supported target entity domains. |
| 85 | +- Verify behavior labels from frontend strings. |
| 86 | +- If actions exist, capture the current UI action label forms once in Stage 1 and reuse them later instead of doing extra lookups during writing. |
| 87 | +- Keep the output short and factual. |
| 88 | +- Note any mismatch between existing split pages and the current developer examples template. |
| 89 | + |
| 90 | +## Stage 2: template and style extraction with a sub-agent |
| 91 | + |
| 92 | +Launch a sub-agent to inspect: |
| 93 | + |
| 94 | +- `./source/_integrations/_integration_docs_template.markdown` |
| 95 | +- `https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/documenting/integration-docs-examples.md` |
| 96 | +- `https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/documenting/general-style-guide.md` |
| 97 | +- `https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/documenting/yaml-style-guide.md` |
| 98 | +- relevant include snippets under `./source/_includes` |
| 99 | +- 2-4 existing files across triggers, conditions, and actions |
| 100 | + |
| 101 | +The sub-agent must return only this: |
| 102 | + |
| 103 | +```md |
| 104 | +Integration page requirements: |
| 105 | +- ... |
| 106 | +- automation examples section requirement: ... |
| 107 | + |
| 108 | +Trigger page requirements: |
| 109 | +- required includes in order: ... |
| 110 | +- required heading flow: ... |
| 111 | +- required UI wording: ... |
| 112 | +- Good to know guidance: ... |
| 113 | + |
| 114 | +Condition page requirements: |
| 115 | +- required includes in order: ... |
| 116 | +- required heading flow: ... |
| 117 | +- required UI wording: ... |
| 118 | +- Good to know guidance: ... |
| 119 | + |
| 120 | +Action page requirements: |
| 121 | +- required includes in order: ... |
| 122 | +- required heading flow: ... |
| 123 | +- required UI wording: ... |
| 124 | +- Good to know guidance: ... |
| 125 | + |
| 126 | +Common pitfalls to avoid: |
| 127 | +- ... |
| 128 | +``` |
| 129 | + |
| 130 | +Focus on include order, heading expectations, UI wording, Good to know placement, and the integration-level automation examples section. |
| 131 | +Keep it compact. |
| 132 | + |
| 133 | +The sub-agent must explicitly call out mandatory split-page sections and include order from the developer examples template, including sections that are often missing in older docs. |
| 134 | + |
| 135 | +## Stage 3: write or update the docs |
| 136 | + |
| 137 | +Using only the distilled outputs from Stage 1 and Stage 2: |
| 138 | + |
| 139 | +1. Update `./source/_integrations/<domain>.markdown`. |
| 140 | +2. Create or update one split page per trigger. |
| 141 | +3. Create or update one split page per condition. |
| 142 | +4. Create or update one split page per action. |
| 143 | +5. If a category is not implemented, do not create pages for it. |
| 144 | +6. If split pages already exist, update them instead of duplicating them. |
| 145 | + |
| 146 | +Hard requirements: |
| 147 | + |
| 148 | +- In the integration page, if triggers, conditions, and actions all exist, use `{% include integrations/triggers_conditions_actions.md %}`. |
| 149 | +- If one or more of those categories does not exist, do not use `triggers_conditions_actions.md`. |
| 150 | +- Instead, include only the applicable lines below, separated by blank lines: |
| 151 | + - `{% include integrations/triggers.md %}` |
| 152 | + - `{% include integrations/conditions.md %}` |
| 153 | + - `{% include integrations/actions.md %}` |
| 154 | +- Ensure the integration page has an `## <Integration name> automation examples` section that follows the current integration template. |
| 155 | +- Add that section even if it was missing before the migration. |
| 156 | +- In that section, example headings must be level-3 headings prefixed with `Automation:`. |
| 157 | +- The integration-page automation examples must match the documented split pages and use the same feature names and behavior. |
| 158 | +- Do not document unsupported Core features. |
| 159 | +- When documenting a `for` attribute in options or fields, document its type as `string`, not `time`. |
| 160 | +- Do not use Markdown H1 headings. |
| 161 | +- Keep blank lines around headings and Liquid blocks. |
| 162 | +- Follow the Home Assistant YAML style guide for all YAML examples. |
| 163 | +- In UI options and YAML options sections, list default values when applicable. |
| 164 | +- Use sentence-style capitalization. |
| 165 | +- Prefer globally understood wording. |
| 166 | +- Avoid region-specific household terms. |
| 167 | +- Avoid invented workflows like “Away mode” unless explicitly framed as user-created. |
| 168 | +- If using a helper, explicitly say it must be created separately and use `{% term helper %}` where appropriate. |
| 169 | +- Do not assume a Labs note is required for actions. |
| 170 | +- Include `integrations/labs_entity_triggers_note.md` only where the current template or existing Home Assistant docs pattern actually requires it. |
| 171 | +- For trigger, condition, and action pages, follow the developer examples template section-for-section unless a section is truly not applicable. |
| 172 | +- Do not omit a template section just because the older page for this integration did not have it. |
| 173 | +- Keep include order aligned with the developer examples template. |
| 174 | +- Keep heading flow aligned with the developer examples template and the headings produced by includes. |
| 175 | +- Keep UI-step and options-section structure aligned with the developer examples template. |
| 176 | +- If deviating from the template, do so only for a Core-based reason and keep the deviation minimal. |
| 177 | + |
| 178 | +UI wording requirements: |
| 179 | + |
| 180 | +- Do not prefix selected UI items with the domain. |
| 181 | +- Trigger pages must say: `Select what you want to monitor. Under **By target** ...` |
| 182 | +- Condition pages must say: `Select what you want to check. Under **By target** ...` |
| 183 | +- Action pages must say: `Select what you want to control. Under **By target** ...` |
| 184 | +- In automation examples, do not repeat the domain in UI action names. Use the action label without the `Domain: ` prefix. |
| 185 | +- If the current UI label is `Light: Turn on light`, write `Turn on light`. |
| 186 | +- If the current UI label would read awkwardly with the domain, such as `Lock: Lock lock`, write only the non-prefixed label. |
| 187 | +- Use the action labels from their related strings.json in Core to make sure they match what users see in the UI. |
| 188 | + |
| 189 | +Split-page naming rules: |
| 190 | + |
| 191 | +- Triggers: `source/_triggers/<domain>.<trigger_key>.markdown` |
| 192 | +- Conditions: `source/_conditions/<domain>.<condition_key>.markdown` |
| 193 | +- Actions: `source/_actions/<domain>.<action_key>.markdown` |
| 194 | + |
| 195 | +Use exact Core keys. |
| 196 | + |
| 197 | +Each trigger, condition, and action page must have: |
| 198 | + |
| 199 | +- a strong introductory context explaining when it is useful |
| 200 | +- exactly two concrete automation examples for different use cases |
| 201 | + |
| 202 | +Example rules: |
| 203 | + |
| 204 | +- Examples must match what the page claims. |
| 205 | +- Prefer standard Home Assistant concepts like time, sun, person/zone, notifications, locks, lights, alarm control panels, scripts, and automations. |
| 206 | +- Do not invent unsupported modes, flows, or features. |
| 207 | +- Do not imply a helper exists unless you explicitly say it is user-created. |
| 208 | +- In automation examples, do not list default values such as default `for` or `behavior` values. |
| 209 | +- In automation examples, use the correct full action labels, such as `Lock lock` or `Turn on switch`, not shortened labels like `Lock` or `Turn on`. |
| 210 | +- For examples that use the mobile notification action, use this pattern to refer to the mobile device: |
| 211 | + |
| 212 | + In UI: |
| 213 | + |
| 214 | + ```md |
| 215 | + - **Action**: Send a notification message |
| 216 | + - **Target**: My Device (`notify.my_device`) |
| 217 | + ``` |
| 218 | + |
| 219 | + In YAML: |
| 220 | + |
| 221 | + ```yaml |
| 222 | + actions: |
| 223 | + - action: notify.send_message |
| 224 | + target: |
| 225 | + entity_id: notify.my_device |
| 226 | + data: |
| 227 | + message: > |
| 228 | + ... |
| 229 | + ``` |
| 230 | +
|
| 231 | +- If there are other `**Target**` items in UI lists, they should be nested with two spaces under the trigger/action/condition above them. |
| 232 | + |
| 233 | +## Stage 4: review with a sub-agent |
| 234 | + |
| 235 | +Launch a sub-agent to review the updated files against Core, templates, includes, and developer examples. |
| 236 | + |
| 237 | +It must return only: |
| 238 | + |
| 239 | +```md |
| 240 | +Problems found: |
| 241 | +- [severity] <file>: <issue> |
| 242 | +
|
| 243 | +Passed checks: |
| 244 | +- <check> |
| 245 | +``` |
| 246 | + |
| 247 | +Required review checks: |
| 248 | + |
| 249 | +- integration page uses `{% include integrations/triggers_conditions_actions.md %}` only when triggers, conditions, and actions all exist |
| 250 | +- if one or more categories is missing, the integration page uses only the applicable individual include lines with blank lines between them |
| 251 | +- integration page contains the `## <Integration name> automation examples` section when required by the current template |
| 252 | +- integration-page example headings are level 3 and start with `Automation:` |
| 253 | +- integration-page automation example content is consistent with the split pages |
| 254 | +- split pages follow the current developer examples template closely |
| 255 | +- no mandatory split-page template section was omitted without a Core-based reason |
| 256 | +- split pages contain required includes |
| 257 | +- include order matches the developer examples template |
| 258 | +- heading levels align with include-generated headings |
| 259 | +- section order matches the developer examples template |
| 260 | +- UI wording matches current developer examples |
| 261 | +- selected item labels do not use `Domain: Label` |
| 262 | +- trigger steps use `Select what you want to monitor. Under **By target** ...` |
| 263 | +- condition steps use `Select what you want to check. Under **By target** ...` |
| 264 | +- action steps use `Select what you want to control. Under **By target** ...` |
| 265 | +- automation examples do not use `Domain: Label` for action names |
| 266 | +- automation example action names reuse the current non-prefixed UI label form already captured during Stage 1 |
| 267 | +- `unavailable` / `unknown` notes are in **Good to know** |
| 268 | +- every documented feature exists in Core |
| 269 | +- no unsupported feature was invented |
| 270 | +- examples are realistic and globally understandable |
| 271 | +- in YAML options, `for` is documented as `type: string` and the format is explained in the description |
| 272 | +- UI options and YAML options sections list default values when applicable |
| 273 | +- automation examples do not list default values such as for `for` or `behavior` |
| 274 | +- automation examples use correct full action labels such as `Lock lock` or `Turn on switch` |
| 275 | +- YAML examples follow the Home Assistant YAML style guide |
| 276 | +- helper usage, if any, is explicitly framed as user-created |
| 277 | +- Labs note usage matches the current template and actual feature requirements |
| 278 | + |
| 279 | +## Stage 5: fix and re-review |
| 280 | + |
| 281 | +If the review sub-agent reports problems: |
| 282 | + |
| 283 | +- fix them |
| 284 | +- run one more compact review pass |
| 285 | +- stop only when no material issues remain |
| 286 | + |
| 287 | +## Final response |
| 288 | + |
| 289 | +Return: |
| 290 | + |
| 291 | +```md |
| 292 | +Summary: |
| 293 | +- ... |
| 294 | +
|
| 295 | +Files updated: |
| 296 | +- ... |
| 297 | +
|
| 298 | +Files created: |
| 299 | +- ... |
| 300 | +
|
| 301 | +Categories intentionally not documented: |
| 302 | +- <category>: <reason> |
| 303 | +
|
| 304 | +Mismatches found between epic/issue text and Core: |
| 305 | +- ... |
| 306 | +
|
| 307 | +Assumptions: |
| 308 | +- ... |
| 309 | +``` |
0 commit comments