agentleFS
kamishinokamishino/token-engine-builder/AGENTS.md

token-engine-builder

AGENTS.md0 starsChanged 17 days agoMITView on GitHub

Human-written onboarding. Every line runs in every session — keep it under ~150 lines. Rationale lives in ARCHITECTURE.md; this file states rules. TypeScript + Vite (SSR/Node lib mode) builder that packages colocated AI agent skills. src/skills/<skill>/ → dist/<skill>/, 1:1. Each skill is standalone after copy into an agent's skills directory (for example ~/.agents/skills/<skill>/; node only, no install). Tiers: raw values only in primitive/; semantic/ (per-theme, same paths) and component/ are {alias}-only. audit.mjs enforces it — exit 0 ships, exit 1…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every user-visible change ships with a changeset file (.changeset/<name>.md, patch/minor).

    line 48

≈ “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 — token-engine-builder

Human-written onboarding. Every line runs in every session — keep it under ~150 lines. Rationale lives in ARCHITECTURE.md; this file states rules.

WHAT — stack and layout

TypeScript + Vite (SSR/Node lib mode) builder that packages colocated AI agent skills. src/skills/<skill>/ → dist/<skill>/, 1:1. Each skill is standalone after copy into an agent's skills directory (for example ~/.agents/skills/<skill>/; node only, no install).

  • src/shared/ — bundled engine: colors.ts (OKLCH), scales.ts (type/spacing), compiler.ts (Style Dictionary v5), paths.ts (portable resolution), types.ts (DTCG types).
  • src/cli/ — unified deterministic CLI (bin/token-engine → dist/cli/token-engine.mjs): single-pass sync, init, audit, build, extract, scaffold.
  • src/skills/ — flagship cognitive skill design-tokens (Matt Pocock model: discovery, Socratic palette, single-pass sync, framework wiring) and prerequisite setup skill setup-pre-tokens.
  • scripts/build-all.mjs — one Vite pass per skill/CLI so no shared chunk leaks into dist/.
  • vite.config.ts — entry discovery, sync-skill-packages plugin (SKILL.md + templates/ + assets/ + examples/ + references/ mirror, chmod 0o755).
  • skills/ — generated mirror of built dist/<skill>/ for npx skills add; never hand-edit, CI diff-gates it.

WHY — intent

Tiers: raw values only in primitive/; semantic/ (per-theme, same paths) and component/ are {alias}-only. audit.mjs enforces it — exit 0 ships, exit 1 stops.

HOW — commands (these get used; nothing else is blessed)

npm install        # all deps are devDependencies — Vite inlines them
npm run check      # typecheck + lint + lint:skills + test + build + lint:css
npm run build      # → dist/<skill>/ + dist/cli/ via scripts/build-all.mjs
npm run deploy     # link dist/* into ~/.agents/skills (default; --dir <path> for others; rebuilds stale, prunes dead)
npx token-engine   # repo-local bin (checkout only); skills bundle dist/cli as scripts/token-engine.mjs

Node >=22.12. Pure contracts verified via npm test (node:test unit tests in test/); portable smoke (lint:css) proves dist/* generation and gold parity.

Hard invariants (never violate; ESLint enforces #1)

  1. colorjs.io/fn partials only (ColorSpace, sRGB, OKLCH, to, serialize, contrastWCAG21, parse); register just sRGB + OKLCH. Monolithic colorjs.io entry is banned.
  2. devDependencies only. Vite inlines everything; node:* stays external.
  3. Bundled scripts resolve templates/ + assets/ from import.meta.url (paths.ts), never from process.cwd(). User inputs (specs, --out) are cwd-relative by design.
  4. Tier discipline: no #hex/oklch()/px literals outside primitive/; semantic + component tokens alias only.
  5. Agent-facing paths: SKILL.md commands use <skill-root> (the folder containing the loaded SKILL.md) and <target-skill-root> for a handoff target. Never hardcode a home-directory install path; the agent resolves the placeholder, the human substitutes their install folder. Every SKILL.md with a <...-root> command carries the literal-execution guard; lint:skills enforces it.

Working rules

  • Edit source, not the mirror: engine code in src/shared/ + src/cli/, skill content in src/skills/<skill>/ (SKILL.md, references/, assets/; token templates live in src/shared/templates/tokens/ and mirror into both skills at build). Never hand-edit dist/ or skills/.
  • Shared code goes in src/shared/; skills import it — Rollup inlines it per skill at build time.
  • New CLI flag → update that skill's SKILL.md usage line in the same commit.
  • Token schema move → update src/shared/templates + compiler.ts + audit expectations together.
  • Build pipeline move → update vite.config.ts + scripts/build-all.mjs + ARCHITECTURE.md §4 together.
  • Docs never restate package.json scripts or --help output — point at them.
  • Every user-visible change ships with a changeset file (.changeset/<name>.md, patch/minor); npm run release consumes them into a version bump.

Skill lifecycle (adding, renaming, deprecating)

  • New skill: folder src/skills/<slug>/ with SKILL.md (name = slug, quoted trigger-style description, license, compatibility), scripts/, templates/, assets/ as needed. Use <skill-root>/<target-skill-root> in commands; never hardcode an install directory. Register it: pipeline order words in description, README pipeline + Use sections, ARCHITECTURE diagram if it moves a seam, changeset file. lint:skills enforces frontmatter; check proves the bundle.
  • Rename: move folder + update every reference (grep the old slug, excluding lock/dist) + docs + changeset, one commit, no aliases.
  • Deprecate: keep the folder one release with a deprecated: frontmatter note and a changeset, remove next release.

Progressive disclosure (read on demand)

  • Build rationale (per-skill passes, SSR/Node fs fix, inline token merge): ARCHITECTURE.md §4.
  • Module contracts (exports per shared file): ARCHITECTURE.md §2.
  • Token tier + alias rules: ARCHITECTURE.md §3.
  • Skill runtime contract (entry conditions, exit codes): each src/skills/<skill>/SKILL.md.
  • Token input contract: src/shared/types.ts (StyleSpec), enforced by src/shared/spec.ts.
  • Product priorities and deferred register: docs/ROADMAP.md.

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.