AGENTS.md
design-systems/_schema/AGENTS.mdAGENTS.md
Quality
58/100
Scores the file, not the repository.Length
1,476 words
9 headings · 4 code blocksRepository
83k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# `_schema/` — design-system contracts23This directory codifies the structural contracts for design systems.4`tokens.schema.ts` re-exports the token contract that every tokenized brand under5`design-systems/<brand>/` must satisfy. The canonical runtime copy lives in6`packages/contracts/src/design-systems/token-schema.ts` so daemon importers and7repo guards consume one schema. `manifest.schema.ts` is the8project contract for Design System Project packages. Every bundled catalog9entry now ships `manifest.json`, `DESIGN.md`, and `tokens.css`; the daemon keeps10`DESIGN.md`-only discovery solely as a compatibility path for older or11user-installed folders.1213```14_schema/15├── manifest.schema.ts ← project manifest schema (TS, machine-enforced when present)16├── tokens.schema.ts ← token schema re-export (TS, machine-enforced)17├── defaults.css ← A2 fallback values (CSS, human reference)18└── AGENTS.md ← this file19```2021The TypeScript schemas are the source of truth. `defaults.css` is a22human-readable mirror of the A2 `fallback` fields in the token schema23and exists so that reviewers can scan real CSS without parsing a TS24array — drift between the two is enforced by the `design-system: A225defaults parity` guard. Manifest shape is enforced by26`scripts/check-design-system-manifests.ts` for any27`design-systems/<brand>/manifest.json` that exists.2829## Project manifest contract3031Design System Project folders use fixed v1 file names:3233- `manifest.json` — machine-readable project entry.34- `DESIGN.md` — canonical design prose.35- `tokens.css` — canonical compiled tokens.36- `design-tokens.json` — optional Design Tokens JSON derived from37 `tokens.css` + `source/token-contract.report.json`.38- `tailwind-v4.css` — optional Tailwind v4 `@theme` CSS derived from39 `tokens.css`; it must not redefine source values independently.40- `components.html` — optional standalone component fixture.41- `assets/` — optional brand assets.42- `preview/` — optional static preview pages.43- `USAGE.md` — optional agent-facing package guide.44- `components.manifest.json` — optional rebuildable cache derived from45 `components.html` and `tokens.css`.46- `fonts/` — optional webfont files.47- `source/` — optional importer evidence (`scanned-files.json`,48 `evidence.md`, `tokens.source.json`, `token-contract.report.json`,49 and `snippets/INDEX.json`).5051The manifest guard validates every bundled package through its `manifest.json`.52When rich fields are declared, paths must be safe and present, JSON indexes53must parse, and committed `components.manifest.json` files must match a fresh54derivation from `components.html` plus `tokens.css`. These fields are also55runtime inputs: catalog discovery consumes manifest metadata; prompt56composition consumes usage, tokens, component information, import mode, craft57bindings, and the manifest-derived pull index; package/static-file routes expose58only declared preview and source files. Legacy `DESIGN.md`-only folders remain59outside this manifest guard because they have no manifest to validate.6061## Four layers, two questions6263Every shared token answers two questions:64651. **Who decides the value?** — the brand author (Layer A) or the66 schema author (Layer B-slot, when the brand has no opinion).672. **What happens if the brand omits it?** — required, fallback, or68 alias.6970The four layers fall out of those answers:7172| Layer | Who decides | If omitted | Examples |73| --- | --- | --- | --- |74| **A1-identity** | brand | guard fails | `--bg`, `--fg`, `--accent`, `--font-display` |75| **A1-structure** | brand | guard fails | type scale, `--container-max`, `--section-y-*` |76| **A2** | brand (with fallback) | guard fails today; derive script fills tomorrow | `--motion-fast`, `--success`, `--space-4`, `--font-mono` |77| **B-slot** | brand or schema-suggested alias | guard fails — brand must declare, either as `var(--sibling)` (collapsed) or independent value (richer) | `--fg-2 → var(--fg)`, `--surface-warm → var(--surface)` |7879Brand-specific tokens that fall outside the shared schema are tracked80as **C-extensions** in `BRAND_EXTENSIONS` (per-brand allowlist) or81`BRAND_EXTENSION_PREFIXES` (global prefix allowlist for whole families82like `--tag-bg-*`).8384## Why A2 fails the guard today (and might not later)8586A2 conceptually means "optional with fallback" — but artifacts are87generated by agents pasting one brand's `:root` block into a single88`<style>`. There is no global stylesheet that loads alongside the89brand, so a missing `--motion-fast` resolves to nothing inside the90artifact and any `transition: var(--motion-fast)` rule silently breaks.9192Until a future derive script lands and inlines `defaults.css` values93into every brand's `tokens.css`, the only safe contract is "every94brand must declare every A2 token". The `design-system: A2 required95tokens` guard enforces that strictly.9697After the derive script ships, brand authors only need to write the98A1 tokens (and any A2 they want to override); the script populates A299slots from `defaults.css`. The guard contract does not change — every100final `tokens.css` still contains every A2 token — but the work101shifts from human author to script.102103## Why B-slot is required (and what the alias is for)104105Same artifact-paste constraint applies to B-slot tokens. Shared106components reference richer tiers via `var(--fg-2)`, `var(--meta)`,107`var(--surface-warm)`, `var(--border-soft)` — if a brand omits the108slot, those references resolve to nothing and the artifact silently109breaks.110111The `aliasTo` field on each B-slot entry is the **schema-suggested112default**, not a runtime fallback. A brand with no opinion on the113richer tier copies the alias verbatim into its `:root`:114115```116--fg-2: var(--fg); /* default brand: 2-level fg */117--surface-warm: var(--surface); /* default brand: 2-level surface */118```119120A brand that does have the richer tier binds an independent value:121122```123--fg-2: #3d3d3a; /* kami brand: dark warm */124--surface-warm: #e8e6dc; /* kami brand: warm sand */125```126127Either form satisfies the `design-system: B-slot required tokens`128guard. The pre-derive-script contract is identical to A2: every129brand's `:root` declares every shared slot.130131## C → B-slot → A2 promotion path132133Brand-specific tokens start in `BRAND_EXTENSIONS[brand]`. They earn134promotion when a second brand needs the same name:135136```137C-extension B-slot A2138(one brand declares it) (multiple brands declare, (every brand declares139 some alias to a sibling) with a sensible default)140141kami: --leading-display → schema: --leading-display → schema: --leading-display142 aliasTo: var(--leading-tight) fallback: 1.1143```144145Concrete promotion rules:1461471. **C → B-slot** when **≥2 brands** declare a token of the same name148 *and* there is a meaningful sibling to alias to for brands that149 lack the richer tier. Move the entry from `BRAND_EXTENSIONS` to150 `TOKEN_SCHEMA` with `layer: "B-slot"` and `aliasTo: "var(--sibling)"`.1512. **C → A2** when **≥2 brands** declare a token of the same name152 *and* a defensible cross-brand fallback exists (no aliasing153 needed). Move to `TOKEN_SCHEMA` with `layer: "A2"` and a `fallback`,154 then mirror the value in `defaults.css`.1553. **B-slot → A2** when a B-slot starts being independently bound by156 ≥2 brands (instead of aliasing). Replace `aliasTo` with `fallback`157 and add a defaults.css declaration.1584. **A2 → A1** is rare. It happens when the previously-defaultable159 value turns out to be brand-determining — e.g. if a future brand160 redefines `--motion-base` from 200ms to 50ms because its identity161 is "instant", and that change ripples meaningfully through the162 brand voice. Drop the `fallback` and reclassify.163164Demotion (A → B → C) is not currently supported. A token that is165genuinely no longer needed should be marked `@deprecated` in the166schema for one release and then deleted from every brand's167`tokens.css` in the same PR.168169## When **not** to add a token170171Schema growth has a cost — every new entry forces every bundled brand to172declare or alias the new name when the derive script next runs.173Resist adding tokens that are:174175- **Component-internal**: a `.btn-primary` background offset that no176 other component will ever read. Inline the value in the component177 rule.178- **One-off**: a single layout's hero crop ratio. Not a token.179- **Speculative**: "we might want a `--motion-slow` someday." Add it180 the first time a real interaction needs it, not before.181- **Already expressible**: a `--accent-tint-50` that resolves to182 `color-mix(in oklab, var(--accent), transparent 50%)`. Inline the183 `color-mix(...)` call until ≥2 components need the same tint with184 the same alpha, then promote to a token.185186## Editing this directory187188When you change the token schema:189190- Run `pnpm guard` and confirm the bundled catalog still passes every191 design-system sub-check.192- If you added an A2 entry: also update `defaults.css` with the193 matching declaration, byte-equivalent to the `fallback` field.194- If you renamed a token: bump every brand's `tokens.css` and the195 matching `components.html` `:root` paste in the same commit.196 Otherwise the drift guard will fail.197- If you removed a token from `TOKEN_SCHEMA` and the same name now198 appears in only one brand: add it to that brand's199 `BRAND_EXTENSIONS` entry so the unknown-token guard does not fail.200201## Open questions for the future derive script202203The checked-in schema and guards enforce the final token contract today, but204the following authoring-automation questions are intentionally not answered:205206- **How does the derive script source A1 values from `DESIGN.md`?**207 Some sections (color palette, type scale) parse cleanly; others208 (visual atmosphere, do's and don'ts) do not. A frontmatter or209 fenced-block convention will likely emerge.210- **What happens when a brand's `DESIGN.md` contradicts itself?**211 e.g. accents listed as both cobalt and indigo. The derive script212 will need a deterministic resolution (last-wins, manual override213 flag, or hard fail).214- **Are A2 fallback formulas stable when re-derived?** Bit-for-bit215 reproducibility of the script's output is required so that running216 the script twice on the same input does not churn the brand token files.217218These remain future work for a change that introduces219`scripts/derive-tokens-css.ts`; that script does not exist yet.220
Also in nexu-io/open-design
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nexu-io/open-designplugins/AGENTS.md · 83k | AGENTS.md | stylearchsecuritydo-not | 68/100 | 3 days ago | |
| nexu-io/open-design.github/AGENTS.md · 83k | AGENTS.md | stylearchgitapi+3 | 83/100 | 3 days ago | |
| nexu-io/open-designAGENTS.md · 83k | AGENTS.md | setupteststylearch+9 | 74/100 | 3 days ago | |
| nexu-io/open-designapps/AGENTS.md · 83k | AGENTS.md | testarchmonorepo | 90/100 | 3 days ago | |
| nexu-io/open-designapps/daemon/AGENTS.md · 83k | AGENTS.md | teststylearchtesting-strategy+4 | 86/100 | 3 days ago | |
| nexu-io/open-designapps/daemon/src/critique/AGENTS.md · 83k | AGENTS.md | archtesting-strategymonorepo | 52/100 | 3 days ago | |
| nexu-io/open-designapps/landing-page/AGENTS.md · 83k | AGENTS.md | apideploymentmonorepo | 82/100 | 3 days ago | |
| nexu-io/open-designapps/packaged/AGENTS.md · 83k | AGENTS.md | monorepodo-not | 54/100 | 3 days ago | |
| nexu-io/open-designapps/web/src/components/Theater/AGENTS.md · 83k | AGENTS.md | testarchmonorepo | 72/100 | 3 days ago | |
| nexu-io/open-designdesign-templates/AGENTS.md · 83k | AGENTS.md | apiui | 43/100 | 3 days ago | |
| nexu-io/open-designe2e/AGENTS.md · 83k | AGENTS.md | teststylearchtesting-strategy+3 | 93/100 | 3 days ago | |
| nexu-io/open-designpackages/AGENTS.md · 83k | AGENTS.md | archdependenciesmonorepo | 86/100 | 3 days ago | |
| nexu-io/open-designskills/AGENTS.md · 83k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| nexu-io/open-designtools/AGENTS.md · 83k | AGENTS.md | testing-strategy | 82/100 | 3 days ago | |
| nexu-io/open-designtools/pack/AGENTS.md · 83k | AGENTS.md | styletesting-strategyperformancedeployment+1 | 85/100 | 3 days ago | |
| nexu-io/open-designtools/serve/AGENTS.md · 83k | AGENTS.md | do-not | 32/100 | 3 days ago |
Diff against plugins/AGENTS.md Diff against .github/AGENTS.md Diff against AGENTS.md Diff against apps/AGENTS.md Diff against apps/daemon/AGENTS.md Diff against apps/daemon/src/critique/AGENTS.md Diff against apps/landing-page/AGENTS.md Diff against apps/packaged/AGENTS.md Diff against apps/web/src/components/Theater/AGENTS.md Diff against design-templates/AGENTS.md Diff against e2e/AGENTS.md Diff against packages/AGENTS.md Diff against skills/AGENTS.md Diff against tools/AGENTS.md Diff against tools/pack/AGENTS.md Diff against tools/serve/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
