zudo-doc-writing-rules
Doc-writing rules for zudo-doc content (mdx files under src/content/docs/ and src/content/docs-ja/). Consult before writing or editing doc content. Covers: no h1 in content, sidebar_position is mandatory, kebab-case file names, bilingual rule, linking conventions, and admonition syntax. Triggered by 'writing rules', 'zudo-doc-writing-rules', 'doc rule', 'mdx rule', 'write a doc', 'create a page'.
- License 许可
- MIT
- 所属仓库
- zudolab/zudo-doc
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- zudo-doc-writing-rules
- description
- Doc-writing rules for zudo-doc content (mdx files under src/content/docs/ and src/content/docs-ja/). Consult before writing or editing doc content. Covers: no h1 in content, sidebar_position is mandatory, kebab-case file names, bilingual rule, linking conventions, and admonition syntax. Triggered by 'writing rules', 'zudo-doc-writing-rules', 'doc rule', 'mdx rule', 'write a doc', 'create a page'.
- user-invocable
- true
03 SKILL.md 正文
zudo-doc Doc-Writing Rules
IMPORTANT: Consult these rules before writing or editing any mdx content under src/content/docs/ or src/content/docs-ja/. These rules exist to prevent common AI mistakes that silently break layout, navigation, or i18n.
Reference
For navigation structure rules (which category, filesystem layout), see the companion skill zudo-doc-navigation-design. This skill covers content-level mistakes, not structural ones.
Hard Rules (never violate)
No h1 in content
- Frontmatter
titleis the page h1. It is rendered automatically by the doc layout. - Content MUST start with
## h2, not# h1. - Writing
# Somethinginside the body produces a duplicate h1 and breaks heading hierarchy / TOC / a11y.
---
title: Installation
sidebar_position: 1
---
## Prerequisites ← start here, NOT with a "# Installation" heading
...
Do not use horizontal rules as section separators
- Headings and whitespace already express document structure; do not add body-level
---merely to divide sections. - Use a horizontal rule only when the rule itself has semantic meaning, such as documentation that demonstrates horizontal-rule syntax.
Always set sidebar_position
- Without it, pages sort alphabetically within their category — almost never what you want.
- Set it in the frontmatter of every page, including category
index.mdxfiles (which control the category's position in the parent sidebar). - Small integers are fine; leaving gaps (1, 2, 3, 10) makes later insertion easier.
Kebab-case file names
my-article.mdx✓myArticle.mdx✗ — breaks on case-sensitive filesystemsmy_article.mdx✗ — inconsistent with the rest of the site
The URL slug is derived from the filename, so kebab-case also keeps URLs clean.
Bilingual rule
- When creating or updating any doc page, update both EN (
src/content/docs/) and JA (src/content/docs-ja/) versions. - Keep code blocks identical — only translate prose.
- Keep
<HtmlPreview>and other JSX blocks identical. - The JA directory should mirror the EN directory tree exactly.
- Exception: files with
generated: truein frontmatter are generator-owned; do not hand-edit or translate them. - Exception: the Claude/Codex resource generators own their overview and category
index.mdxtargets in the default content directory and every configured locale directory. They generate localized indexes fromresource.*translations, so do not create hand-written locale stubs. If an authored file already occupies a target path, the generator refuses to overwrite it; remove or rename the file and express its title, description, and labels throughZudoDocConfig.translations. - Exception: Claude/Codex resource detail files stay in the default content directory and use body fallback at other locale routes. Do not copy those generated detail files into locale directories.
- Exception: pages whose paths are explicitly listed under
settings.defaultLocaleOnlyPrefixesare default-locale-only by design — do not create a JA mirror for them. The source of truth issettings.defaultLocaleOnlyPrefixesinsrc/config/settings.ts; this repository currently configures no such prefixes.
Frontmatter Schema
The schema is package-owned (@takazudo/zudo-doc/docs-schema, source packages/zudo-doc/src/docs-schema/index.ts — the default buildDocsSchema, wired in via zudoDoc(); there is no more host src/content.config.ts). Zod validation. Required and key optional fields:
| Field | Type | Required? | Notes |
|---|---|---|---|
title |
string | yes | Renders as page h1 |
sidebar_position |
number | recommended | Without it, pages sort alphabetically |
description |
string | no | Subtitle below the h1 |
sidebar_label |
string | no | Overrides title in the sidebar only |
category_shape |
"note-tray" |
no | Declares a top-level, flat note-tray category on its index.mdx |
note_tray_dated |
boolean | no | Requires date on every tray item, including unlisted items |
note_tray_sidebar |
"index" | "year" | "month" |
no | Tray sidebar style; grouped styles require a dated tray |
category_sort_order |
"asc" | "desc" |
no | Category or tray display direction; defaults to "asc" |
date |
"YYYY-MM-DD" |
no | Required on every item in a dated tray; quoting is optional because zfb keeps scalar values as strings |
updated |
"YYYY-MM-DD" |
no | Optional update date on any doc; quoting is optional because zfb keeps scalar values as strings |
tags |
string[] | no | Cross-category grouping |
draft |
boolean | no | Excludes the page from the build entirely |
unlisted |
boolean | no | Built but hidden from sidebar/nav |
generated |
boolean | no | Build-time generated; skip JA translation |
hide_sidebar |
boolean | no | Hide the left sidebar on this page |
hide_toc |
boolean | no | Hide the right-side table of contents |
The schema ends with .passthrough(), so custom keys (e.g. author, status) are preserved rather than rejected — they simply carry no built-in behavior. Consequence: a typo in a framework field name (sidebar_postion) does NOT error at build time; double-check spellings against the table above.
Linking Between Docs
Use relative paths with the .mdx extension. The framework's link resolver rewrites them to the correct URLs at build time and validates them.
[Link text](./sibling-page.mdx)
[Link text](../other-category/page.mdx#anchor)
- Do NOT use absolute paths like
/docs/foo/barin prose — the resolver cannot verify them. - Do NOT omit the
.mdxextension — the resolver needs it to find the target.
For the companion skill that audits links: /check-docs.
Admonitions
Admonitions are available globally — no imports needed.
Directive syntax (preferred in prose-heavy content):
:::note[Optional Title]
Body content.
:::
JSX syntax (preferred when nesting other JSX):
<Note title="Optional Title">Body content.</Note>
<Tip>...</Tip>
<Info>...</Info>
<Warning>...</Warning>
<Danger>...</Danger>
<Caution>...</Caution>
All admonition components accept an optional title prop. (caution is danger-adjacent, used by GitHub-style [!CAUTION] alerts; JSX additionally registers <Important> for [!IMPORTANT].)
Common Mistakes (Do Not Do)
- Starting content with
# Foo— duplicates the h1. Start with## Foo. - Adding
---between headed sections — headings and whitespace already provide the separation. - Forgetting
sidebar_position— produces alphabetical chaos in the sidebar. - camelCase or PascalCase file names — breaks on some filesystems.
- Updating only the EN or only the JA version — breaks the bilingual mirror (except for generator-owned content and pages explicitly covered by
defaultLocaleOnlyPrefixes). - Absolute
/docs/...links in prose — the resolver cannot verify them; use relative./page.mdxinstead. - Omitting the
.mdxextension in links — the resolver requires it. - Misspelling framework frontmatter fields — the schema passes unknown keys through, so a typo'd
sidebar_positionsilently does nothing instead of erroring. - Translating code inside code blocks — the bilingual rule says code stays identical.
Recommended Workflow
- Decide where the page belongs: for a new page or a changed role, run the four-question placement check in
zudo-doc-navigation-design(skip it for typo/wording-only edits). - Create the EN file under
src/content/docs/<category>/<page>.mdxwithtitleandsidebar_position. - Write content starting with
## h2headings only. - Use
./relative links with.mdxextension for cross-refs. - Create the matching JA file under
src/content/docs-ja/<category>/<page>.mdx— same code blocks, translated prose. - Run
pnpm formatthenpnpm buildto verify — the build will catch missing required fields, broken links, and unknown frontmatter.
04 同仓库更多 Skills
zudo-doc-writing
Doc-writing and navigation-structure guide for this zudo-doc project. Consult BEFORE creating pages, adding categories, designing header navigation, or writing/editing mdx content under src/content/. Covers: reading the AUTHORING.md editorial policy and its four placement questions, when to run a structure review, plan-the-nav-tree-first workflow, tree vs note-tray categories, the recommended 3-level hierarchy (header → sidebar → nested), filesystem navigation as the default, linked versus heading-only category rows, category index pages, sidebar_position discipline, frontmatter schema, no-h1 rule, relative .mdx links, and admonition syntax. Triggered by 'write docs', 'add a page', 'create a page', 'add category', 'structure navigation', 'nav design', 'zudo-doc-writing'.
zudo-doc-version-bump
Bump package version, update changelog and versioned docs snapshot (if those features are enabled), commit, tag, and create a GitHub release. Use when: (1) User says 'version bump', 'bump version', 'release', or 'zudo-doc-version-bump', (2) User wants to create a new release of this project.
zudo-doc-translate
Translate zudo-doc documentation between the locales configured in this project, with Japanese conventions applied only to the `ja` locale.
zudo-doc-design-system
Project-specific CSS and component rules for zudo-doc. Must be consulted before writing or editing CSS, zudo-wind utilities, color tokens, or component markup in this project. Covers: component-first strategy, design token system, three-tier color architecture, and palette index convention. Triggered by 'design system', 'zudo-doc-design-system', 'zudo-doc-css-wisdom' (old name).
localized-shell
Fixture skill for localized generated resource routes.
zudo-doc-version-bump
Bump the lockstep monorepo version, author package-specific changelogs, commit, tag all three packages, and create distinct GitHub releases. Use when: (1) User says 'version bump', 'bump version', 'release', or 'zudo-doc-version-bump', (2) User wants to create a new release of this monorepo.