-
Notifications
You must be signed in to change notification settings - Fork 4
feat(docs): add f0-docs skill for MDX documentation workflow #3893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ae2c6ba
32008a3
a467a3f
230c8b9
d1f9dc6
265f2eb
e15bfdc
519074a
0f838ba
d807776
88e5e76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,91 @@ | ||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||
| name: f0-docs | ||||||||||||||||||||||||||
| description: Document F0 React components in Storybook (MDX). Load automatically when a new component is created or an existing component gets new props/variants. Covers the 4-step workflow: analyze code, ask creator (if needed), write MDX, update stories. | ||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # F0 Docs | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Every component in `packages/react/src/components/` must have an MDX documentation file in its `__stories__/` folder. This skill defines the mandatory workflow for writing it correctly. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## When to Load | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - A new component is created — MDX is required before the work is considered done | ||||||||||||||||||||||||||
| - An existing component gets new props or variants — MDX must be updated to cover them | ||||||||||||||||||||||||||
| - User asks to document a component in Storybook | ||||||||||||||||||||||||||
| - User asks to convert `autodocs` to manual MDX | ||||||||||||||||||||||||||
| - `f0-quality-gate` Subagent C reports a missing or incomplete MDX file | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Mandatory Workflow — 4 Steps | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Execute these steps in order. Do not skip to MDX authoring without completing the analysis first. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Step 1 — Analyze the component | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Read the source files and extract the full public surface: props, types, defaults, variants, stories, and conditional behaviors. Build a WHEN→THEN rule list from the source code. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Full protocol: [`references/component-analysis.md`](./references/component-analysis.md) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Step 2 — Ask the creator (when needed) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| **Infer without asking** for components with a universal role in product UI (Button, Alert, Dialog, Badge, Input, etc.) and for all information that exists in the code. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| **Ask the creator** when the component has Factorial-specific behavior that cannot be inferred from code: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - Where in Factorial does this appear? | ||||||||||||||||||||||||||
| - What triggers it? | ||||||||||||||||||||||||||
| - What Factorial-specific error states or edge cases exist? | ||||||||||||||||||||||||||
| - When should developers NOT use this? | ||||||||||||||||||||||||||
| - Are there consistent prop combinations used in specific Factorial contexts? | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Ask all questions at once. Do not drip-feed. If no Factorial-specific questions apply, skip this step. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Question list: [`references/component-analysis.md → Step 4`](./references/component-analysis.md) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ### Step 3 — Evaluate quality target | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Before writing, decide the quality level to target (Acceptable / Good / Gold) based on the component's importance and completeness of available information. Check the gold standards: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - `F0Alert/__stories__/F0Alert.mdx` — gold standard: decision tables, DoDonts with visual children, a11y section, dismissible usage | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
Comment on lines
+48
to
+51
|
||||||||||||||||||||||||||
| Before writing, decide the quality level to target (Acceptable / Good / Gold) based on the component's importance and completeness of available information. Check the gold standards: | |
| - `F0Alert/__stories__/F0Alert.mdx` — best in class for decision tables, DoDonts, a11y | |
| - `F0Button/__stories__/F0Button.mdx` — most complete (DocsNav, states, full props reference, 633 lines) | |
| Before writing, decide the quality level to target (Acceptable / Good / Gold) based on the component's importance and completeness of available information. Check the best in-repo references that exist today: | |
| - `F0Alert/__stories__/F0Alert.stories.tsx` — use as the current source of truth for covered variants, states, and scenarios in this repo | |
| - `F0Button/__stories__/controls.mdx` — existing MDX reference for control wiring only; it is not a full gold-standard content example, and you should not add `DocsNav` | |
| If fuller MDX examples such as `F0Alert.mdx` or `F0Button.mdx` land in a companion PR, treat them as supplemental references only if they still match the rules in this skill. |
Copilot
AI
Apr 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“Remove autodocs from the stories meta” is unlikely to achieve the desired effect in this repo because .storybook/preview.tsx sets tags: ["autodocs"] globally for all stories. Please update this step to describe the actual supported way to avoid autodocs conflicts when adding manual MDX in this codebase (and keep it consistent with the storybook-stories skill).
| Create the MDX file and remove `autodocs` from the stories meta. Follow the full template and validation checklist. | |
| Create the MDX file and update the corresponding `*.stories.tsx` file to disable autodocs using this repo's supported story-level override for manual MDX pages (do not rely on removing `autodocs` from the stories meta, because autodocs is enabled globally in this codebase). Follow the full template and validation checklist. |
Copilot
AI
Apr 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Quick Reference row lists “DocsNav” as a utility component, but the linked MDX authoring reference explicitly forbids importing/using DocsNav. This is internally inconsistent and will confuse readers; remove the DocsNav mention here (or replace with the actual allowed utilities like Unstyled/DoDonts).
| | Need | Reference | | |
| | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | |
| | Source analysis protocol, props inventory, WHEN→THEN extraction, creator questions | [`references/component-analysis.md`](./references/component-analysis.md) | | |
| | Quality criteria per section, WHEN→THEN rules, component relationships, a11y by type, 11 global rules | [`references/documentation-quality.md`](./references/documentation-quality.md) | | |
| | Full MDX template, table templates, utility components (DocsNav, DoDonts), stories update, checklist | [`references/mdx-authoring.md`](./references/mdx-authoring.md) | | |
| | Which components have docs and which need them | [`references/component-status.md`](./references/component-status.md) | | |
| | Need | Reference | | |
| | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | |
| | Source analysis protocol, props inventory, WHEN→THEN extraction, creator questions | [`references/component-analysis.md`](./references/component-analysis.md) | | |
| | Quality criteria per section, WHEN→THEN rules, component relationships, a11y by type, 11 global rules | [`references/documentation-quality.md`](./references/documentation-quality.md) | | |
| | Full MDX template, table templates, utility components (Unstyled, DoDonts), stories update, checklist | [`references/mdx-authoring.md`](./references/mdx-authoring.md) | | |
| | Which components have docs and which need them | [`references/component-status.md`](./references/component-status.md) | |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,132 @@ | ||||||
| # Component Analysis Reference | ||||||
|
|
||||||
| Step 1 of the documentation workflow. Before writing a single line of MDX, extract everything the code can tell you — then identify the gaps that only the component creator can fill. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Step 1 — Read the Source Files | ||||||
|
|
||||||
| Read these files in order: | ||||||
|
|
||||||
| 1. **`F0ComponentName.tsx`** — public props, JSDoc comments, variants, conditional rendering, ARIA attributes, event handlers | ||||||
| 2. **`types.ts`** — exported types and union values | ||||||
| 3. **`index.tsx`** — export pattern (`experimentalComponent`, `Component({ name, type }`, or plain re-export) | ||||||
|
||||||
| 3. **`index.tsx`** — export pattern (`experimentalComponent`, `Component({ name, type }`, or plain re-export) | |
| 3. **`index.tsx`** — export pattern (`experimentalComponent`, `Component({ name, type })`, or plain re-export) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“Every component … must have an MDX … in its
__stories__/folder” isn’t accurate for this repo today (there are components using__storybook__/and some with flatindex.stories.tsxoutside__stories__/). Consider rephrasing to “next to the stories” and explicitly include__storybook__// flat-story cases so the workflow matches the current structure.