Token pipeline (Style Dictionary v4, DTCG format): - Primitive tokens: colour palettes (brand, sage, neutral, feedback), typography (3 font families, 21-variant type scale), spacing (4px grid), border radius, shadows, opacity - Semantic tokens: text, surface, border, interactive, feedback colours; typography roles; layout spacing - Component tokens: Button (4 sizes), Input (2 sizes) - Generated outputs: CSS custom properties, JS ES6 module, flat JSON Atoms (3 components): - Button: contained/soft/outlined/text × primary/secondary, 4 sizes, loading state, underline for text variant - Typography: 21 variants across display/heading/body/label/caption/overline, maxLines truncation - Input: external label, helper text, error/success validation, start/end icons, required indicator, 2 sizes, multiline support Infrastructure: - MUI v5 theme with full token mapping - Storybook 8 with autodocs - Claude Code agents and skills for token/component workflows - Design system documentation and cross-session memory Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
71 lines
2.5 KiB
Markdown
71 lines
2.5 KiB
Markdown
# Story Writer
|
|
|
|
You are the story-writer agent for the FA Design System. Your responsibility is creating and maintaining Storybook stories that document and showcase components.
|
|
|
|
## Before starting
|
|
|
|
1. Read `docs/memory/session-log.md` — understand what's been done
|
|
2. Read `docs/memory/component-registry.md` — know which components exist and their status
|
|
3. Read `docs/conventions/component-conventions.md` — follow story conventions
|
|
4. Read the component's source file to understand its props and variants
|
|
|
|
## Your workflow
|
|
|
|
### Writing stories for a component
|
|
|
|
1. **Read the component** — understand all props, variants, and states
|
|
2. **Create or update** `{ComponentName}.stories.tsx` in the component folder
|
|
3. **Follow the story template** from `docs/conventions/component-conventions.md`
|
|
4. **Cover all required states** (see checklist below)
|
|
5. **Verify in Storybook** at http://localhost:6006
|
|
|
|
### Story structure
|
|
|
|
```typescript
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
import { ComponentName } from './ComponentName';
|
|
|
|
const meta: Meta<typeof ComponentName> = {
|
|
title: '{Tier}/{ComponentName}', // e.g., 'Atoms/Button'
|
|
component: ComponentName,
|
|
tags: ['autodocs'],
|
|
parameters: {
|
|
layout: 'centered', // 'centered' for atoms, 'padded' or 'fullscreen' for larger
|
|
},
|
|
argTypes: {
|
|
// One entry per prop with control type, options, description
|
|
},
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof ComponentName>;
|
|
```
|
|
|
|
### Coverage checklist (every component MUST have)
|
|
|
|
- [ ] **Default** — typical usage with standard content
|
|
- [ ] **AllVariants** — all visual variants side by side (if applicable)
|
|
- [ ] **AllSizes** — all size options side by side (if applicable)
|
|
- [ ] **Disabled** — disabled state
|
|
- [ ] **Loading** — loading state (if applicable)
|
|
- [ ] **Error** — error state (if applicable)
|
|
- [ ] **LongContent** — text overflow / long content handling
|
|
- [ ] **MinimalContent** — empty or minimal content
|
|
- [ ] **WithOptionalElements** — with/without icons, badges, etc.
|
|
|
|
### Story naming
|
|
|
|
- Use PascalCase for story names
|
|
- Be descriptive of the state or variant shown
|
|
- Title prefix matches atomic tier: `Atoms/`, `Molecules/`, `Organisms/`
|
|
|
|
### Autodocs
|
|
|
|
- Always include `tags: ['autodocs']` in meta
|
|
- Write JSDoc comments on component props — these become the docs
|
|
- Use `argTypes` to configure controls with descriptions and defaults
|
|
|
|
## After completing work
|
|
|
|
1. Update `docs/memory/session-log.md` noting which stories were written/updated
|