1 ---
2 name: writing-docs
3 description: Writes and updates Medusa documentation MDX files for the book, resources, ui, user-guide, and cloud projects. Use when making documentation changes based on code diffs, adding new pages, updating existing content, or updating component examples. ALWAYS load this skill before modifying any MDX file in www/apps/.
4 ---
5
6 # Writing Medusa Documentation
7
8 Skill for writing and updating MDX documentation across the `book`, `resources`, `ui`, `user-guide`, and `cloud` projects under `www/apps/`.
9
10 ## Constraints
11
12 > **CRITICAL:** Violating these will corrupt the documentation or break CI.
13
14 - **Never document `@ignore`-tagged items** — any option, method, or parameter with `@ignore` in its TSDoc must be skipped entirely
15 - **Never touch `www/apps/resources/references/`** — auto-generated, will be overwritten
16 - **Never touch `www/apps/ui/specs/components/`** — auto-generated, will be overwritten
17 - **Never touch `www/apps/api-reference/`** — managed by a separate process
18 - **Never run `yarn prep` or `yarn lint:content`** — these run automatically after your session
19 - **Never invent Cloudinary screenshot URLs** in user-guide — leave `<!-- TODO: add screenshot -->` instead
20
21 ## Load Reference Files When Needed
22
23 > **Load at least one reference file before writing any content.**
24
25 | Task | Load |
26 |------|------|
27 | Deciding if a change needs docs | `reference/when-to-document.md` |
28 | Writing any MDX content | `reference/mdx-patterns.md` |
29 | Writing for the **book** project | `reference/book-style.md` |
30 | Writing for the **resources** project | `reference/resources-style.md` |
31 | Writing for the **user-guide** project | `reference/user-guide-style.md` |
32 | Writing for the **cloud** project | `reference/cloud-style.md` |
33 | Checking prose quality | `reference/vale-rules.md` |
34
35 ## Quick Reference
36
37 ### Project paths and writable directories
38
39 | Project | Content path | Sidebar file |
40 |---------|-------------|--------------|
41 | book | `www/apps/book/app/` | `www/apps/book/sidebar.mjs` |
42 | resources | `www/apps/resources/app/` | `www/apps/resources/sidebars/*.mjs` |
43 | ui | `www/apps/ui/app/`, `www/apps/ui/specs/examples/` | `www/apps/ui/sidebar.mjs` |
44 | user-guide | `www/apps/user-guide/app/` | `www/apps/user-guide/sidebar.mjs` |
45 | cloud | `www/apps/cloud/app/` | `www/apps/cloud/sidebar.mjs` |
46
47 ### MDX file minimum structure
48
49 ```mdx
50 export const metadata = {
51 title: `Page Title`,
52 }
53
54 # {metadata.title}
55
56 Content here.
57 ```
58
59 For book pages that use chapter numbering, the title uses `${pageNumber}`:
60
61 ```mdx
62 export const metadata = {
63 title: `${pageNumber} Chapter Title`,
64 }
65 ```
66
67 ### Cross-project links
68
69 ```mdx
70 [text](!docs!/learn/path) → book
71 [text](!resources!/path) → resources
72 [text](!user-guide!/path) → user-guide
73 ```
74
75 ## Common Mistakes
76
77 - [ ] Adding a new option, method, or parameter without a version note
78 - [ ] Documenting any option, method, or parameter tagged with `@ignore` in its TSDoc — skip these entirely
79 - [ ] Touching `references/` or `specs/components/` directories
80 - [ ] Using `we`, `us`, `let's`, `our` in prose (use "you" or imperative)
81 - [ ] Using "Medusa API" to mean the backend — use "Medusa backend" instead
82 - [ ] Writing "Medusa Cloud" — use "Medusa" (noun form) or "Cloud" (location/service)
83 - [ ] Using `e.g.,` — write `for example` instead
84 - [ ] Using em dashes (`—`) — rewrite sentence to avoid them
85 - [ ] Using passive voice ("is created", "can be configured") — write active ("you can configure", "call X to create")
86 - [ ] Writing code lines longer than 64 characters
87 - [ ] Forgetting to add a new page to the sidebar file
88 - [ ] Removing `${pageNumber}` from book page titles
89 - [ ] Using `<img>` or bare HTML instead of MDX components
90 - [ ] Documenting internal implementation details (only public APIs)
91
92 ## Reference Files
93
94 ```
95 reference/when-to-document.md - Decision tree: does this change need docs?
96 reference/mdx-patterns.md - MDX syntax, code blocks, components
97 reference/book-style.md - book-specific structure and conventions
98 reference/resources-style.md - resources-specific structure and conventions
99 reference/user-guide-style.md - user-guide writing style and conventions
100 reference/cloud-style.md - cloud-specific structure and conventions
101 reference/vale-rules.md - Vale + lint rules to follow in prose
102 ```