|
| 1 | +# Design System Starter Kit — Claude Instructions |
| 2 | + |
| 3 | +Dit bestand wordt automatisch gelezen aan het begin van elke Claude-sessie. |
| 4 | +Het bevat de projectregels, architectuurpatronen en navigatiekaart naar de volledige documentatie. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## Documentatie — waar staat wat? |
| 9 | + |
| 10 | +| Vraag | Lees dit | |
| 11 | +| -------------------------------------------------- | ------------------------------------ | |
| 12 | +| Hoe is het project opgebouwd? | `docs/01-architecture.md` | |
| 13 | +| Welke tokens bestaan er en wat zijn de waarden? | `docs/02-design-tokens-reference.md` | |
| 14 | +| Welke componenten bestaan er en wat zijn de specs? | `docs/03-components.md` | |
| 15 | +| Hoe werkt het development workflow / git / CI? | `docs/04-development-workflow.md` | |
| 16 | +| Hoe werken CSS-klassen en token-namen? | `docs/06-css-naming-conventions.md` | |
| 17 | +| Hoe werkt Storybook? | `docs/05-storybook-configuration.md` | |
| 18 | +| Wat is er recent veranderd? | `docs/changelog.md` | |
| 19 | + |
| 20 | +**Voor een nieuw component:** lees altijd `docs/06-css-naming-conventions.md` en `docs/03-components.md` eerst. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Twee-lagen implementatiepatroon — ALTIJD |
| 25 | + |
| 26 | +Elk component in dit design system heeft **altijd twee lagen**. Geen uitzonderingen. |
| 27 | + |
| 28 | +| Laag | Wat | Voorbeeld | |
| 29 | +| ------------ | ------------------------------------------ | --------------------------------------------- | |
| 30 | +| **HTML/CSS** | De kern — layout en stijllogica | `<div class="dsn-stack dsn-stack--space-md">` | |
| 31 | +| **React** | De wrapper — genereert de HTML/CSS klassen | `<Stack space="md">` | |
| 32 | + |
| 33 | +- De CSS-klassen zijn de bron van waarheid |
| 34 | +- React is gemak bovenop de HTML/CSS-laag |
| 35 | +- Bij elk nieuw component: **beide** lagen uitwerken en documenteren |
| 36 | +- Storybook-docs tonen altijd zowel de HTML/CSS-variant als de React-variant |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Kritieke regels — nooit overtreden |
| 41 | + |
| 42 | +### 1. Button accessible naming — NOOIT `aria-label` |
| 43 | + |
| 44 | +Gebruik **altijd** een `dsn-button__label` span. `dsn-button--icon-only` verbergt hem visueel maar houdt hem beschikbaar voor screenreaders. |
| 45 | + |
| 46 | +```html |
| 47 | +<!-- ✅ Standaard icon-only button --> |
| 48 | +<button |
| 49 | + type="button" |
| 50 | + class="dsn-button dsn-button--subtle dsn-button--size-small dsn-button--icon-only" |
| 51 | +> |
| 52 | + <svg class="dsn-icon" aria-hidden="true"><!-- icon --></svg> |
| 53 | + <span class="dsn-button__label">Instellingen</span> |
| 54 | +</button> |
| 55 | + |
| 56 | +<!-- ✅ Icon-only met rij-context (tabelacties) --> |
| 57 | +<button |
| 58 | + type="button" |
| 59 | + class="dsn-button dsn-button--subtle dsn-button--size-small dsn-button--icon-only" |
| 60 | +> |
| 61 | + <svg class="dsn-icon" aria-hidden="true"><!-- dots-vertical --></svg> |
| 62 | + <span class="dsn-button__label"> |
| 63 | + Toon acties |
| 64 | + <span class="dsn-visually-hidden"> voor product: Laptop Pro</span> |
| 65 | + </span> |
| 66 | +</button> |
| 67 | + |
| 68 | +<!-- ❌ NOOIT --> |
| 69 | +<button aria-label="Instellingen">...</button> |
| 70 | +``` |
| 71 | + |
| 72 | +### 2. Tokens — nooit hardcoded waarden in CSS |
| 73 | + |
| 74 | +```css |
| 75 | +/* ❌ */ |
| 76 | +color: #1b59a4; |
| 77 | +padding: 8px; |
| 78 | +transition: 0.2s ease; |
| 79 | + |
| 80 | +/* ✅ */ |
| 81 | +color: var(--dsn-color-accent-1-color-default); |
| 82 | +padding: var(--dsn-space-block-md); |
| 83 | +transition: var(--dsn-transition-duration-normal) |
| 84 | + var(--dsn-transition-easing-default); |
| 85 | +``` |
| 86 | + |
| 87 | +### 3. BEM naming — zie `docs/06-css-naming-conventions.md` |
| 88 | + |
| 89 | +Kernregels: |
| 90 | + |
| 91 | +- Prefix altijd `dsn-` |
| 92 | +- Modifier altijd naast basis-klasse: `class="dsn-note dsn-note--info"` |
| 93 | +- Grootte altijd via `--size-{naam}`: `dsn-button--size-small` |
| 94 | +- Geen geneste element-namen: `dsn-alert__content__text` ❌ |
| 95 | +- HTML-toestanden via pseudo-klassen: `.dsn-button:disabled` ✅ |
| 96 | + |
| 97 | +### 4. Twee TypeScript-waarschuwingen zijn pre-existing |
| 98 | + |
| 99 | +`pnpm --filter storybook exec tsc --noEmit` geeft **4 warnings** in bestaande bestanden. Dit zijn bekende, pre-existing issues — geen blocker. Nieuwe code moet 0 nieuwe fouten introduceren. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Nieuw component bouwen — checklist |
| 104 | + |
| 105 | +### Bestanden aanmaken |
| 106 | + |
| 107 | +Elk nieuw component vereist exact deze bestanden: |
| 108 | + |
| 109 | +``` |
| 110 | +packages/components-html/src/{component-name}/ |
| 111 | + └── {component-name}.css # HTML/CSS implementatie |
| 112 | +
|
| 113 | +packages/components-react/src/{ComponentName}/ |
| 114 | + ├── {ComponentName}.tsx # React wrapper |
| 115 | + ├── {ComponentName}.test.tsx # Tests |
| 116 | + └── {ComponentName}.css # @import van components-html CSS |
| 117 | +
|
| 118 | +packages/storybook/src/ |
| 119 | + ├── {ComponentName}.stories.tsx # Storybook stories |
| 120 | + ├── {ComponentName}.docs.mdx # Storybook docs page (MDX) |
| 121 | + └── {ComponentName}.docs.md # Docs content (Markdown) |
| 122 | +``` |
| 123 | + |
| 124 | +### Exports en registraties |
| 125 | + |
| 126 | +- `packages/components-react/src/index.ts` — export toevoegen |
| 127 | +- `packages/storybook/src/Introduction.mdx` — datum updaten + component in de lijst |
| 128 | + |
| 129 | +### Token-bestanden (indien nieuwe tokens nodig) |
| 130 | + |
| 131 | +``` |
| 132 | +packages/design-tokens/src/tokens/components/{component-name}.json |
| 133 | +packages/design-tokens/src/tokens/themes/start/colors-light.json (indien kleur-tokens) |
| 134 | +packages/design-tokens/src/tokens/themes/start/colors-dark.json (altijd simultaan) |
| 135 | +packages/design-tokens/src/tokens/themes/start/base.json (indien structurele tokens) |
| 136 | +``` |
| 137 | + |
| 138 | +### Kwaliteitscontrole voor PR |
| 139 | + |
| 140 | +```bash |
| 141 | +pnpm test # alle tests groen |
| 142 | +pnpm --filter storybook exec tsc --noEmit # 0 nieuwe TypeScript-fouten |
| 143 | +pnpm lint # 0 lint-fouten |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## Storybook-docs structuur |
| 149 | + |
| 150 | +Elk component heeft een `.docs.md` met vaste secties in deze volgorde: |
| 151 | + |
| 152 | +1. **Titel + korte beschrijving** (één zin) |
| 153 | +2. **Doel** — wat doet het component en wanneer gebruik je het? |
| 154 | +3. **Use when** — bulletlijst |
| 155 | +4. **Don't use when** — bulletlijst |
| 156 | +5. **Best practices** — subsecties per onderwerp |
| 157 | +6. **Design tokens** — tabel met alle `--dsn-{component}-*` tokens |
| 158 | +7. **Accessibility** — toegankelijkheidsaandachtspunten |
| 159 | + |
| 160 | +Bekijk `packages/storybook/src/Button.docs.md` als referentie voor toon en opmaak. |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## Git-workflow |
| 165 | + |
| 166 | +```bash |
| 167 | +git checkout -b feature/naam # altijd een feature branch |
| 168 | +# ... implementatie ... |
| 169 | +pnpm test && pnpm lint # altijd testen voor commit |
| 170 | +git add [specifieke bestanden] # nooit git add -A of git add . |
| 171 | +git commit -m "feat(Component): ..." # conventional commits |
| 172 | +gh pr create # PR aanmaken |
| 173 | +gh pr merge --merge # na CI-groen en review |
| 174 | +``` |
| 175 | + |
| 176 | +Commit-prefixes: `feat` / `fix` / `docs` / `chore` / `refactor` / `test` |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## Huidige staat — zie MEMORY.md |
| 181 | + |
| 182 | +De actuele staat van het project (welke componenten af zijn, recente PRs, openstaande issues) staat in MEMORY.md. CLAUDE.md bevat de permanente projectregels; MEMORY.md bevat de actuele sessie-context. |
0 commit comments