AIUI Documentation Writer
Use this repository-local skill when changing official documentation under
documentation/. It defines the documentation layout, bilingual maintenance
rules, portable Markdown requirements, and the syntax for switchable Web and
wx examples.
This skill is for maintaining the AIUI repository itself. Do not publish it as
an installable skill, move it into the root skills/ directory, or add it to
public skill listings.
Before Writing
- Read
documentation/toc.json when adding, moving, renaming, or removing a
page. Keep its nested IDs aligned with the file path.
- Read the target page and nearby pages before editing. Follow the terminology,
heading depth, link style, and amount of detail used in that section.
- Verify API, component, configuration, and runtime behavior against current
source, type declarations, packages, or runnable samples. Do not document
inferred capabilities as supported behavior.
- Check whether both the Chinese and English files exist before changing a
page.
Documentation Layout
documentation/0-guide/: onboarding, concepts, and workflows.
documentation/1-framework/: application format and framework behavior.
documentation/2-components/: built-in component reference.
documentation/3-api/: runtime, Web, and wx API reference.
documentation/4-tutorials/: task-oriented, runnable example tutorials and their catalog configuration.
documentation/5-cloud/: cloud services and server integration.
documentation/6-design/: visual and interaction guidance.
documentation/7-tools/: development tools and supporting workflows.
documentation/8-changelog/: release-oriented change summaries.
documentation/toc.json: navigation hierarchy shared by localized pages.
Use the existing directory that matches the reader's task. Do not reorganize
the navigation or invent a new top-level section for a single page unless the
request explicitly requires it.
Bilingual Files
Chinese is stored in <name>.md; English is stored in <name>.en-US.md beside
it.
- Treat a documentation change as bilingual by default.
- Keep both versions aligned in meaning, heading structure, links, examples,
warnings, and capability claims.
- Write natural text in each language instead of translating word by word.
- Keep identifiers, API names, file paths, payload fields, and executable code
consistent across languages unless localized sample data improves clarity.
- If only one locale exists, do not silently create or remove the other without
checking the surrounding section and the user's scope.
Writing Style
- Start with what the feature enables, then show how to use it.
- Prefer task-oriented sections and short paragraphs.
- Use real Markdown headings for content that should appear in the page outline.
- Use backticks for identifiers, API names, paths, attributes, and literal
values.
- Use fenced code blocks with an explicit language.
- Keep examples focused and executable. Avoid unrelated setup and placeholder
behavior that the runtime does not support.
- Explain important defaults, errors, permissions, lifecycle constraints, and
platform limitations close to the relevant example.
- Use root-relative AIUI documentation links such as
/AIUI/api/... when
linking between rendered documentation pages, following nearby pages.
API Reference Page Structure
Detailed pages under documentation/3-api/ are task-first documents, not
reference dumps. Organize them so a reader sees representative usage before
individual signatures and parameter tables.
Use this order for a page that documents callable APIs, constructors,
properties, methods, or events:
- Start with a short introduction explaining what the capability enables and
when to choose it.
- Add a small set of task-named sections for typical scenarios. Each section
should show a focused, runnable example, followed only by the behavioral
explanation needed to use that example correctly.
- Put cross-cutting guidance such as availability, lifecycle, platform limits,
recommendations, and related links after the scenarios but before the
reference section.
- Make
## API Reference the final level-two section on the page. Do not add
another level-two section after it.
Inside ## API Reference:
- Give each public API, constructor, object, property group, method group, or
event group a descriptive level-three heading.
- Document exact signatures, parameters, parameter fields, defaults, return
values, events, errors, and supported behavior as applicable.
- Use tables for structured parameters and fields. Do not bury parameter
definitions in the earlier scenario sections.
- Keep short code fragments only when they clarify a signature or return shape;
full workflows belong in the scenario sections above.
- Keep related APIs together under the same reference section. For Web and
wx
equivalents, describe both reference surfaces even when their scenario code
uses an API Style group.
Name scenario headings after the reader's task, such as Send a Request,
Read a Streamed Response, or Cancel or Observe a Request. Avoid generic
headings such as Examples, Basic Usage, or numbered Example 1 when a
specific task name is available.
This structure applies to API detail pages. Category landing pages whose only
purpose is navigation, and compact compatibility catalogs that only enumerate
supported APIs, do not need an artificial API Reference section. When a page
contains real signatures or parameter details, treat it as a detail page even
if it also serves as an overview.
A typical outline is:
# Capability
Short introduction.
## Complete a Typical Task
Focused example and the explanation needed for this task.
## Handle Another Common Scenario
Focused example and the explanation needed for this task.
## Availability and Current Behavior
Cross-cutting constraints and guidance.
## API Reference
### `apiName(options?)`
Signature, parameters, return value, events, and errors.
Portable Markdown
Documentation must remain understandable in GitHub, editors, and ordinary
Markdown renderers even when js.rokid.com enhancements are unavailable.
- Prefer CommonMark-compatible headings, paragraphs, lists, links, tables, and
fenced code blocks.
- Do not wrap Markdown content in custom HTML elements; many renderers stop
parsing Markdown inside them.
- Do not use
::: custom containers for essential content because ordinary
renderers expose the container markers as text.
- HTML comments may mark optional enhanced regions because they remain hidden
while their enclosed Markdown continues to render normally.
- Enhanced rendering failure must not hide the only copy of an example or
explanation.
API Style Code Groups
Use an API Style group only when Web and wx examples perform the same task.
Keep prose outside the group style-neutral and branch only at the code level.
Use this exact structure:
<!-- aiui-api-style default=web -->
**Web**
```javascript api-style=web
const response = await fetch('https://api.example.com/items');
console.log(await response.json());
```
**wx**
```javascript api-style=wx
wx.request({
url: 'https://api.example.com/items',
success(response) {
console.log(response.data);
}
});
```
<!-- /aiui-api-style -->
API Style Rules
- The visible labels are exactly
Web and wx.
- The stable IDs are
web and wx; write them as api-style=web and
api-style=wx in the fence info string.
- Use
default=web unless the documented capability is explicitly centered on
the compatibility API.
- A group must contain at least two options and must not repeat an ID.
- Put one bold-only label immediately before each fenced block.
- Keep the opening and closing comments on their own lines.
- Both examples must use equivalent endpoints, operations, payloads, and
observable outcomes. Differences should reflect API shape, not different
scenarios.
- Keep each code fence's first info token as the real language so ordinary
renderers retain syntax highlighting.
- Do not add separate
### Web or ### wx headings around the group; the
switch labels already identify the variants and headings would pollute the
outline.
- When only one API style is supported, use a normal fenced code block instead
of manufacturing a second variant.
In an ordinary Markdown renderer, the comments are hidden and both bold labels
and code blocks remain visible. On js.rokid.com, the same source becomes an
equal-width Web / wx switch with a sliding selection indicator.
Tutorial Step Blocks
Tutorial pages may pair an explanation with its corresponding code by wrapping
one or more Markdown paragraphs and one fenced code block in these comments:
<!-- aiui-tutorial-step -->
Explain what the reader should notice or do. Keep the explanation useful even
when it renders above the code instead of beside it.
```javascript
const message = 'Hello, AIUI!';
```
<!-- /aiui-tutorial-step -->
- Keep both markers on their own lines.
- Put the explanation first and exactly one fenced code block second.
- Use multiple step blocks when a tutorial needs multiple explanation and code pairs.
- Do not put essential content in marker attributes.
- In ordinary Markdown the explanation and code render vertically. On
js.rokid.com, desktop layouts may place the explanation on the left and code
on the right; narrow layouts must stack them in source order.
Tables and Notes
- Use tables for compact field comparisons, not for long narrative content.
- Keep column labels and row ordering aligned between locales.
- Use the existing note syntax in the surrounding section. Do not introduce a
new callout convention in one page.
- State unsupported or planned behavior plainly. Do not present roadmap items
as currently available.
Validation
Before finishing a documentation change:
- Confirm every changed Chinese page has its corresponding English update when
a pair exists.
- For new or moved pages, verify
documentation/toc.json resolves to the
intended files in both locales.
- Check API Style groups for matching markers, valid defaults, unique IDs,
bold-only labels, and equivalent examples.
- Render or inspect the Markdown without AIUI-specific enhancement and confirm
that labels and fenced code blocks remain readable.
- Run
git diff --check from the repository root.
- Review the final diff for accidental source changes, stale links, mismatched
headings, and claims not supported by the implementation.
- For changed
documentation/3-api/ detail pages, verify that typical
scenario sections precede the reference material, ## API Reference is the
final level-two section, and all concrete parameter definitions live inside
it.
1---2name: aiui-docs3description: Write, revise, and review official AIUI documentation under documentation/. Invoke for guides, component or API references, bilingual documentation updates, toc changes, and API Style code examples. Do not use for public skills under skills/.4---56# AIUI Documentation Writer78Use this repository-local skill when changing official documentation under9`documentation/`. It defines the documentation layout, bilingual maintenance10rules, portable Markdown requirements, and the syntax for switchable Web and11`wx` examples.1213This skill is for maintaining the AIUI repository itself. Do not publish it as14an installable skill, move it into the root `skills/` directory, or add it to15public skill listings.1617## Before Writing18191. Read `documentation/toc.json` when adding, moving, renaming, or removing a20 page. Keep its nested IDs aligned with the file path.212. Read the target page and nearby pages before editing. Follow the terminology,22 heading depth, link style, and amount of detail used in that section.233. Verify API, component, configuration, and runtime behavior against current24 source, type declarations, packages, or runnable samples. Do not document25 inferred capabilities as supported behavior.264. Check whether both the Chinese and English files exist before changing a27 page.2829## Documentation Layout3031- `documentation/0-guide/`: onboarding, concepts, and workflows.32- `documentation/1-framework/`: application format and framework behavior.33- `documentation/2-components/`: built-in component reference.34- `documentation/3-api/`: runtime, Web, and `wx` API reference.35- `documentation/4-tutorials/`: task-oriented, runnable example tutorials and their catalog configuration.36- `documentation/5-cloud/`: cloud services and server integration.37- `documentation/6-design/`: visual and interaction guidance.38- `documentation/7-tools/`: development tools and supporting workflows.39- `documentation/8-changelog/`: release-oriented change summaries.40- `documentation/toc.json`: navigation hierarchy shared by localized pages.4142Use the existing directory that matches the reader's task. Do not reorganize43the navigation or invent a new top-level section for a single page unless the44request explicitly requires it.4546## Bilingual Files4748Chinese is stored in `<name>.md`; English is stored in `<name>.en-US.md` beside49it.5051- Treat a documentation change as bilingual by default.52- Keep both versions aligned in meaning, heading structure, links, examples,53 warnings, and capability claims.54- Write natural text in each language instead of translating word by word.55- Keep identifiers, API names, file paths, payload fields, and executable code56 consistent across languages unless localized sample data improves clarity.57- If only one locale exists, do not silently create or remove the other without58 checking the surrounding section and the user's scope.5960## Writing Style6162- Start with what the feature enables, then show how to use it.63- Prefer task-oriented sections and short paragraphs.64- Use real Markdown headings for content that should appear in the page outline.65- Use backticks for identifiers, API names, paths, attributes, and literal66 values.67- Use fenced code blocks with an explicit language.68- Keep examples focused and executable. Avoid unrelated setup and placeholder69 behavior that the runtime does not support.70- Explain important defaults, errors, permissions, lifecycle constraints, and71 platform limitations close to the relevant example.72- Use root-relative AIUI documentation links such as `/AIUI/api/...` when73 linking between rendered documentation pages, following nearby pages.7475## API Reference Page Structure7677Detailed pages under `documentation/3-api/` are task-first documents, not78reference dumps. Organize them so a reader sees representative usage before79individual signatures and parameter tables.8081Use this order for a page that documents callable APIs, constructors,82properties, methods, or events:83841. Start with a short introduction explaining what the capability enables and85 when to choose it.862. Add a small set of task-named sections for typical scenarios. Each section87 should show a focused, runnable example, followed only by the behavioral88 explanation needed to use that example correctly.893. Put cross-cutting guidance such as availability, lifecycle, platform limits,90 recommendations, and related links after the scenarios but before the91 reference section.924. Make `## API Reference` the final level-two section on the page. Do not add93 another level-two section after it.9495Inside `## API Reference`:9697- Give each public API, constructor, object, property group, method group, or98 event group a descriptive level-three heading.99- Document exact signatures, parameters, parameter fields, defaults, return100 values, events, errors, and supported behavior as applicable.101- Use tables for structured parameters and fields. Do not bury parameter102 definitions in the earlier scenario sections.103- Keep short code fragments only when they clarify a signature or return shape;104 full workflows belong in the scenario sections above.105- Keep related APIs together under the same reference section. For Web and `wx`106 equivalents, describe both reference surfaces even when their scenario code107 uses an API Style group.108109Name scenario headings after the reader's task, such as `Send a Request`,110`Read a Streamed Response`, or `Cancel or Observe a Request`. Avoid generic111headings such as `Examples`, `Basic Usage`, or numbered `Example 1` when a112specific task name is available.113114This structure applies to API detail pages. Category landing pages whose only115purpose is navigation, and compact compatibility catalogs that only enumerate116supported APIs, do not need an artificial `API Reference` section. When a page117contains real signatures or parameter details, treat it as a detail page even118if it also serves as an overview.119120A typical outline is:121122```markdown123# Capability124125Short introduction.126127## Complete a Typical Task128129Focused example and the explanation needed for this task.130131## Handle Another Common Scenario132133Focused example and the explanation needed for this task.134135## Availability and Current Behavior136137Cross-cutting constraints and guidance.138139## API Reference140141### `apiName(options?)`142143Signature, parameters, return value, events, and errors.144```145146## Portable Markdown147148Documentation must remain understandable in GitHub, editors, and ordinary149Markdown renderers even when js.rokid.com enhancements are unavailable.150151- Prefer CommonMark-compatible headings, paragraphs, lists, links, tables, and152 fenced code blocks.153- Do not wrap Markdown content in custom HTML elements; many renderers stop154 parsing Markdown inside them.155- Do not use `:::` custom containers for essential content because ordinary156 renderers expose the container markers as text.157- HTML comments may mark optional enhanced regions because they remain hidden158 while their enclosed Markdown continues to render normally.159- Enhanced rendering failure must not hide the only copy of an example or160 explanation.161162## API Style Code Groups163164Use an API Style group only when Web and `wx` examples perform the same task.165Keep prose outside the group style-neutral and branch only at the code level.166167Use this exact structure:168169````markdown170<!-- aiui-api-style default=web -->171172**Web**173174```javascript api-style=web175const response = await fetch('https://api.example.com/items');176console.log(await response.json());177```178179**wx**180181```javascript api-style=wx182wx.request({183 url: 'https://api.example.com/items',184 success(response) {185 console.log(response.data);186 }187});188```189190<!-- /aiui-api-style -->191````192193### API Style Rules194195- The visible labels are exactly `Web` and `wx`.196- The stable IDs are `web` and `wx`; write them as `api-style=web` and197 `api-style=wx` in the fence info string.198- Use `default=web` unless the documented capability is explicitly centered on199 the compatibility API.200- A group must contain at least two options and must not repeat an ID.201- Put one bold-only label immediately before each fenced block.202- Keep the opening and closing comments on their own lines.203- Both examples must use equivalent endpoints, operations, payloads, and204 observable outcomes. Differences should reflect API shape, not different205 scenarios.206- Keep each code fence's first info token as the real language so ordinary207 renderers retain syntax highlighting.208- Do not add separate `### Web` or `### wx` headings around the group; the209 switch labels already identify the variants and headings would pollute the210 outline.211- When only one API style is supported, use a normal fenced code block instead212 of manufacturing a second variant.213214In an ordinary Markdown renderer, the comments are hidden and both bold labels215and code blocks remain visible. On js.rokid.com, the same source becomes an216equal-width `Web` / `wx` switch with a sliding selection indicator.217218## Tutorial Step Blocks219220Tutorial pages may pair an explanation with its corresponding code by wrapping221one or more Markdown paragraphs and one fenced code block in these comments:222223````markdown224<!-- aiui-tutorial-step -->225226Explain what the reader should notice or do. Keep the explanation useful even227when it renders above the code instead of beside it.228229```javascript230const message = 'Hello, AIUI!';231```232233<!-- /aiui-tutorial-step -->234````235236- Keep both markers on their own lines.237- Put the explanation first and exactly one fenced code block second.238- Use multiple step blocks when a tutorial needs multiple explanation and code pairs.239- Do not put essential content in marker attributes.240- In ordinary Markdown the explanation and code render vertically. On241 js.rokid.com, desktop layouts may place the explanation on the left and code242 on the right; narrow layouts must stack them in source order.243244## Tables and Notes245246- Use tables for compact field comparisons, not for long narrative content.247- Keep column labels and row ordering aligned between locales.248- Use the existing note syntax in the surrounding section. Do not introduce a249 new callout convention in one page.250- State unsupported or planned behavior plainly. Do not present roadmap items251 as currently available.252253## Validation254255Before finishing a documentation change:2562571. Confirm every changed Chinese page has its corresponding English update when258 a pair exists.2592. For new or moved pages, verify `documentation/toc.json` resolves to the260 intended files in both locales.2613. Check API Style groups for matching markers, valid defaults, unique IDs,262 bold-only labels, and equivalent examples.2634. Render or inspect the Markdown without AIUI-specific enhancement and confirm264 that labels and fenced code blocks remain readable.2655. Run `git diff --check` from the repository root.2666. Review the final diff for accidental source changes, stale links, mismatched267 headings, and claims not supported by the implementation.2687. For changed `documentation/3-api/` detail pages, verify that typical269 scenario sections precede the reference material, `## API Reference` is the270 final level-two section, and all concrete parameter definitions live inside271 it.