name: docs-writing description: 'Write and maintain SDK documentation in packages/docs/content/. Use when adding new doc pages, updating existing docs, or modifying the documentation structure. Ensures frontmatter, meta.json, and LLM index stay in sync.'
SDK Documentation Writing
Write documentation for the Sui TypeScript SDK ecosystem in packages/docs/content/. All docs are MDX files organized by package, rendered by fumadocs, and exported as flat markdown for LLM consumption.
Before Writing
- Read the relevant
meta.jsonto understand the section structure. - Check existing pages in the same section for style and conventions.
- Read references/structure.md for directory layout and meta.json format.
- Read references/style-guide.md for writing conventions.
Creating a New Doc Page
- Create the
.mdxfile in the appropriatecontent/subdirectory. - Add YAML frontmatter with both
titleanddescription(required):
---
title: My New Feature
description: Short one-line description under 120 characters
---
Content goes here...
- Add the page name to the parent
meta.jsonpagesarray in the correct order. - If creating a new section directory, create a
meta.jsonwithtitleandpages. - Regenerate the LLM index:
pnpm --filter @mysten/docs build:docs - Validate:
pnpm --filter @mysten/docs validate-docs
Adding Docs for a New Package
When a new SDK package needs documentation:
- Create
packages/docs/content/<package-name>/withmeta.json(root: true) andindex.mdx - Add
"build:docs": "tsx ../docs/scripts/build-docs.ts"to the package'spackage.jsonscripts - Add
"docs"to the package'sfilesarray inpackage.json(so docs are published to npm) - Add the package as a dependency in
packages/docs/package.json - See references/structure.md for full checklist
Editing Existing Docs
- Read the full page before editing — understand context.
- Keep the
descriptionfrontmatter accurate after changes. - After significant structural changes, regenerate and validate:
pnpm --filter @mysten/docs build:docs pnpm --filter @mysten/docs validate-docs
Key Rules
- Every MDX file must have
titleanddescription— CI validates this. - Descriptions under 120 characters — used in the LLM index.
- No trailing period on descriptions.
- Use code examples liberally — show, don't tell.
- Import from public API paths —
@mysten/sui/transactions, not internal paths. - Use fenced code blocks with
tsxortypescriptlanguage tag. - Every new page must be in a
meta.jsonpagesarray — or it won't appear in navigation. dist/anddocs/are generated at build time — not committed to git. Runbuild:docsto verify output locally.- New packages need
build:docsscript anddocsinfiles— or docs won't be published to npm.
Common Mistakes — STOP
- Adding an MDX file without updating
meta.json→ Page won't appear in navigation or index - Missing
descriptionin frontmatter → CI validation will fail - Using internal import paths → Readers won't be able to use them
- Using JSX components without imports → MDX build will fail
- Adding a new section directory without
meta.json→ Pages won't be indexed
Navigation
- Directory Structure — Content layout, meta.json format, how pages are organized by package
- Style Guide — Writing conventions, MDX features, code example patterns
Before Committing
Always validate before committing doc changes:
pnpm --filter @mysten/docs validate-docs
This checks frontmatter completeness and orphan detection. Fix any errors before committing.
Build Commands
# Generate all docs (combined dist/ + per-section indices)
pnpm --filter @mysten/docs build:docs
# Generate docs for a single package (run from package dir)
pnpm --filter @mysten/sui build:docs
# Build everything (includes build:docs automatically via turbo)
pnpm turbo build
# Validate frontmatter + orphan detection
pnpm --filter @mysten/docs validate-docs
# Full site build (Next.js)
pnpm --filter @mysten/docs build