agentleFS
CloudflareKnown publishercloudflare/kumo-astro/packages/kumo-docs-astro/AGENTS.md

kumo-astro / kumo-docs-astro

AGENTS.md4 starsChanged 9 months agoMITView on GitHub

Astro documentation site for Kumo. React islands architecture. Deployed to Cloudflare Workers at kumo-ui.com. Parent: See root AGENTS.md for monorepo context. Demo extraction relies on exact naming: Wrong naming = function not extracted = missing from component registry. Pattern: DocLayout (title, sourceFile) → ComponentSection → ComponentExample → <DemoComponent client:visible /> Imports: ~/layouts/DocLayout.astro, ~/components/docs/ComponentExample.astro, ~/components/demos/{Name}Demo ComponentExample supports `vrS

The file

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

2 rules. About 0 are common, 1 is distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT mix them.

    line 72
  2. Very specific:

    dist/ is gitignored: If dist/demo-metadata.json is missing, codegen:registry produces incomplete output

    line 96

≈ “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

Docs Site (@cloudflare/kumo-docs-astro)

Astro documentation site for Kumo. React islands architecture. Deployed to Cloudflare Workers at kumo-ui.com.

Parent: See root AGENTS.md for monorepo context.

STRUCTURE

kumo-docs-astro/
├── src/
│   ├── pages/
│   │   ├── index.astro              # Homepage (HomeGrid showcase)
│   │   ├── components/{name}.astro  # 38 component doc pages
│   │   ├── blocks/{name}.astro      # 2 block doc pages
│   │   └── api/                     # JSON endpoints (version, component-registry)
│   ├── components/
│   │   ├── demos/                   # 49 files: *Demo.tsx (feed into registry!)
│   │   ├── docs/                    # Doc components (PropsTable, CodeBlock, etc.)
│   │   └── kumo/                    # Installed blocks (via CLI, not package imports)
│   ├── layouts/                     # BaseLayout → MainLayout → DocLayout
│   ├── lib/
│   │   ├── vite-plugin-kumo-colors.ts    # virtual:kumo-colors
│   │   ├── vite-plugin-kumo-registry.ts  # virtual:kumo-registry
│   │   ├── vite-plugin-kumo-hmr.ts       # Dev-only: rewires @cloudflare/kumo → source
│   │   └── component-registry.ts         # Server-side registry access
│   └── styles/global.css            # Tailwind entry + @source to kumo dist
├── scripts/
│   └── extract-demo-examples.ts     # Parses demos → dist/demo-metadata.json
├── astro.config.mjs                 # React + Tailwind + 3 custom Vite plugins
└── wrangler.jsonc                   # CF Workers deployment (static assets)

WHERE TO LOOK

TaskLocationNotes
Component doc pagesrc/pages/components/{name}.astroUses DocLayout + ComponentExample
Demo examplessrc/components/demos/{Name}Demo.tsxNaming is load-bearing (see below)
Props tablesrc/components/docs/PropsTable.astroServer-rendered from registry
Layout/navsrc/layouts/, src/components/SidebarNav.tsxNav items are hard-coded
Color tokens pagesrc/pages/colors.astro + ColorsDemo.tsxUses virtual:kumo-colors
Registry viewersrc/pages/registry.astro + RegistryDemo.tsxUses virtual:kumo-registry
Installed blockssrc/components/kumo/{block}/Installed via kumo add, not pkg

CONVENTIONS

Demo File Naming (CRITICAL)

Demo extraction relies on exact naming:

  • File: {Component}Demo.tsx (e.g., ButtonDemo.tsx)
  • Exports: Functions ending in Demo suffix (e.g., export function ButtonPrimaryDemo())
  • Both forms work: export function FooDemo() and export const FooDemo = () =>
  • JSDoc on demos becomes the description field in metadata

Wrong naming = function not extracted = missing from component registry.

Hydration Directives

DirectiveWhen
client:visibleMost component demos (lazy)
client:loadInteractive: Dialog, Search, Toast, Registry
client:only="react"SSR mismatch: ThemeToggle, HomeGrid
client:idleLow priority: CopyPageButton

Two Registry Access Patterns

  • Server-side (.astro files): Import from ~/lib/component-registry.ts
  • Client-side (React demos): Use virtual:kumo-registry Vite module
  • Do NOT mix them.

Page Template

Pattern: DocLayout (title, sourceFile) → ComponentSection → ComponentExample → <DemoComponent client:visible />

Imports: ~/layouts/DocLayout.astro, ~/components/docs/ComponentExample.astro, ~/components/demos/{Name}Demo

Visual Regression

ComponentExample supports vrSection and vrTitle props for screenshot targeting by visual regression tests.

ANTI-PATTERNS

PatternWhyInstead
Demo function without Demo suffixWon't be extracted for registryAlways suffix with Demo
Manually updating PropsTableData comes from registryRegistry auto-generated at build time
Forgetting @source in global.cssTailwind misses kumo classesKeep @source "../../../kumo/dist/**/*"
Using system prefers-color-schemeSite uses data-mode attributeUse ThemeToggle / localStorage.theme

NOTES

  • Build order: codegen:demos runs first in build script; produces dist/demo-metadata.json consumed by kumo registry codegen
  • dist/ is gitignored: If dist/demo-metadata.json is missing, codegen:registry produces incomplete output
  • SidebarNav is manual: Adding a component page requires updating SidebarNav.tsx arrays (staticPages, componentItems, chartItems, blockItems)
  • HomeGrid is manual: New components need adding to the showcase grid + componentRoutes
  • Search uses CommandPalette: Client-side search powered by component registry API; works in dev mode without build step
  • BaseLayout has blocking inline script: Reads localStorage.theme synchronously to prevent dark mode FOUC
  • global.css: @custom-variant dark overrides Tailwind dark to match [data-mode="dark"]
  • HMR plugin dev-only: In development, @cloudflare/kumo imports are rewritten to source for instant HMR
  • Dual theme code blocks: Shiki uses github-light/vesper themes, switches via [data-mode] CSS
  • Installed blocks: src/components/kumo/page-header/ and resource-list/ are blocks installed via kumo add

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.