agentleFS
anandartinanandartin/celestial-skills/skills/design-tokens-to-code-engineering/AGENTS.md

celestial-skills / design-tokens-to-code-engineering

AGENTS.md1 starsChanged 18 days agoApache-2.0View on GitHub

Generate platform code from one token source, build components that only read tokens and guard them with visual regression, so a brand change ships in one commit. Generated from the Celestial engineering practice “Design tokens to code”.

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every semantic text and background pairing is contrast-checked in each theme as part of the token build.

    line 28

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — Design tokens to code

Generate platform code from one token source, build components that only read tokens and guard them with visual regression, so a brand change ships in one commit.

How to do it

  1. Collect tokens into one source — Put colour, type, spacing, radius, shadow, motion and breakpoint values in a single version-controlled JSON source (the design skill or a tokens file in the W3C draft format). Each token has a name, value, type and description.
  2. Layer primitives and semantic tokens — Keep raw primitives (blue-600, space-4) separate from semantic tokens that describe purpose (color-action-primary, color-text-muted, space-inset-md). Components use only semantic tokens; themes remap semantic tokens to different primitives.
  3. Generate platform outputs — Use a token build tool such as Style Dictionary to emit CSS custom properties, a Tailwind theme, SwiftUI or Compose constants from the same source. Generated files are build output with a do-not-edit header; never hand-edit them.
  4. Build components that read tokens — Write each component against semantic tokens only, with every state (default, hover, focus, active, disabled, error, loading) defined. Expose variants as props, not as style overrides.
  5. Wire themes — Implement light and dark (and any brand themes) by swapping the semantic layer, for example with a data-theme attribute or a platform colour scheme. Check contrast for every text and UI pair in every theme.
  6. Document components with stories — Write a story or preview for every component state and theme in a component workshop such as Storybook, so design can review the real code.
  7. Add visual regression tests — Snapshot every story in each theme at fixed viewport sizes and compare on each pull request. Review diffs as part of code review and approve intentional changes explicitly.
  8. Block raw values — Add lint rules that fail on raw hex colours, pixel sizes and font names in component code, with an allow-list for the generated token files.

Checklist (before a pull request)

  • All tokens come from one versioned source file
  • Generated outputs are rebuilt in CI and not edited by hand
  • Components reference semantic tokens only
  • Every component state has a story in each theme
  • Light and dark themes pass contrast checks for every text pair
  • Visual regression runs on every pull request with no unapproved diffs
  • Lint rejects raw colour, size and font values in components

Rules

  • Components read semantic tokens; primitives are referenced only by the theme layer. (Themes can then change without touching any component.)
  • Token names describe purpose, not appearance (color-feedback-danger, not red). (Appearance names become lies the first time the brand changes.)
  • Generated token files are build output; change the source and regenerate. (Hand edits are overwritten and leave design and code disagreeing.)
  • Every semantic text and background pairing is contrast-checked in each theme as part of the token build. (A token swap can silently break contrast across hundreds of screens.)
  • Ship tokens as CSS custom properties or compile-time constants, not runtime JavaScript lookups. (Runtime theming in script adds work to every render.)

Checks

GateToolThresholdWhen
Visual regressionSnapshot comparison of component stories (for example Playwright screenshots or a Storybook test runner)No unapproved pixel diffs in any themeEvery pull request touching tokens or components
No raw style valuesStylelint or ESLint rule for hex, px and font-family literals0 violations outside generated token filesEvery pull request

Generated from the Celestial engineering practice “Design tokens to code”.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.