bub / website
AGENTS.md1.7k starsChanged 16 months agoApache-2.0View on GitHub
Guidelines for AI agents (Copilot, Claude Code, Cursor, etc.) working on the website/ directory. This is the Bub marketing & docs site — a static Astro site combining: Site URL: https://bub.build pnpm — always use pnpm to install packages and run scripts. Use the version pinned in package.json#packageManager; CI reads the same field. Keep the root and website .node-version pins aligned. Use Node 24.21.0 for development and deployment; package.json#engines and engineStrict enforce the dependency minimum (Node 22.19+ on the 22.x…
- Installs packages
Trending
Quiet since September.about the whole repository
Who's talking about bubbuild/bub
- A Hacker News story“Show HN: Bub – shaping interactions, not agents”Hacker News · Mar 19, 2026 · 3 points
- LodyAI/Lody“feat: add Bub as a builtin ACP provider”GitHub · Sep 11, 2026 · 1 reactions
- Gezi-lzq/bub“feat: hook-based turn admission control”GitHub · May 12, 2026 · 1 reactions
- ob-labs/powercontext-go“build(deps): bump the uv-minor-patch group across 7 directories with 16 updates”GitHub · Sep 30, 2026
- ob-labs/powercontext-go“build(deps): bump the uv-minor-patch group across 7 directories with 15 updates”GitHub · Sep 23, 2026
The biggest 5 of 21 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 21
Talked about on GitHub and Hacker News (21 times).
On GitHub · 20
- Sep 11, 2026feat: add Bub as a builtin ACP provider — LodyAI/Lody1 reaction · 4 comments
- May 12, 2026feat: hook-based turn admission control — Gezi-lzq/bub1 reaction
- Sep 30, 2026build(deps): bump the uv-minor-patch group across 7 directories with 16 updates — ob-labs/powercontext-go0 reactions
- Sep 23, 2026build(deps): bump the uv-minor-patch group across 7 directories with 15 updates — ob-labs/powercontext-go0 reactions · 1 comment
- Sep 16, 2026build(deps): bump the uv-minor-patch group across 7 directories with 16 updates — ob-labs/powercontext-go0 reactions · 1 comment
15 more on GitHub
- Sep 9, 2026build(deps): bump the uv-minor-patch group across 7 directories with 16 updates — ob-labs/powercontext-go0 reactions · 1 comment
- Sep 7, 2026build(deps): bump the uv-minor-patch group across 7 directories with 16 updates — ob-labs/powercontext-go0 reactions · 1 comment
- Jun 29, 2026[Enhancement]: use uv to maintain all the pyhthon dev — oceanbase/powercontext0 reactions
- Jun 18, 2026feat: add ACP model config option — bubbuild/bub-contrib0 reactions · 1 comment
- May 24, 2026feat(channel): support lifecycle channel — bubbuild/bub-contrib0 reactions
- May 10, 2026feat: dynamic version from VCS and release notes auto-generation — bubbuild/republic0 reactions
- May 6, 2026feat: bub-http-bridge — HTTP channel plugin for local message posting — Gezi-lzq/bub-contrib0 reactions
- May 1, 2026Implement Telegram skill following bub — linw1995/coco0 reactions · 2 comments
- Apr 14, 2026feat: Build Hero section and Navigation bar — 100gle/bub0 reactions · 1 comment
- Apr 7, 2026fix(codex): preserve streamed text when completed response has empty output — bubbuild/republic0 reactions · 1 comment
- Mar 30, 2026refactor: clean code but keep function — ob-labs/agentseek0 reactions
- Mar 27, 2026Add bub to automation — cncf/landscape0 reactions · 6 comments
- Mar 11, 2026fix(responses): handle completed metadata-only outputs — bubbuild/republic0 reactions
- Mar 7, 2026[wip] add bub agent support — vercel-labs/agent-eval0 reactions
- Feb 11, 2026Agentic — shenxiangzhuang/shenxiangzhuang.github.io0 reactions
On Hacker News · 1
- Mar 19, 2026Show HN: Bub – shaping interactions, not agents3 points · 1 comment
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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.
- AGENTS.mdAGENTS.md
- website/CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
36 rules. About 0 are common, 7 are distinctive, and 29 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
29
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
Use the version pinned in package.json#packageManager.
- Very specific: line 40
Keep the root and website .node-version pins aligned.
- Very specific: line 44
Keep dependency overrides and build-script permissions in pnpm-workspace.yaml.
- Very specific: line 51
Keep both current and wasm32 in supportedArchitectures.cpu: Starlight's HTML processors need Sätteri's WASI package when bundled for …
- Very specific: line 54
Keep session: false while the site has no server-side user state.
- Distinctive: line 57
Check the Astro migration guide and Starlight changelog when updating this stack.
- Very specific: line 71
Prefer the standard Image component from astro:assets for local raster assets used by pages and shared UI.
- Very specific: line 72
Do not replace local logo or illustration components with raw <img> just to work around Cloudflare adapter behavior.
- Very specific: line 77
If you change adapter image settings, re-verify all three paths: make docs, make docs-test, and make docs-preview.
- Very specific: line 180
Do NOT: put these strings in src/i18n/ui.ts — that's Zone 2 only.
- Very specific: line 202
Import Zod from astro/zod, using z.url() for URL fields.
- Very specific: line 252
Add the English string to ui.ts under the en object.
- Distinctive: line 253
Add the translation under the target locale.
- Very specific: line 254
Use const t = useTranslations(locale).
- Very specific: line 258
Add the English content to landing-page.ts under the en section.
- Distinctive: line 259
Add the translation under the target locale section.
- Very specific: line 264
Add the translated string to src/content/i18n/zh-CN.json (or the target locale file).
- Very specific: line 265
If the key is custom (not a built-in Starlight key), define it in the Zod extension inside content.config.ts via i18nSchema({ extend: …
- Very specific: line 270
Starlight zone: Add the locale to astro.config.mjs locales.
- Very specific: line 271
Custom page zone: Add the locale key to languages in ui.ts.
- Very specific: line 272
Blog zone: Create src/content/posts/<locale>/ with translated posts.
- Very specific: line 295
Create src/pages/[...locale]/<path>.astro with getStaticPaths() generating all locales.
- Distinctive: line 296
Import and wrap with the appropriate layout (BaseLayout, PostLayout, etc.).
- Very specific: line 298
Run pnpm build to verify.
- Very specific: line 301
Create the English file in src/content/docs/docs/<section>/<slug>.md.
- Very specific: line 302
Create the Chinese translation in src/content/docs/zh-cn/docs/<section>/<slug>.md.
- Very specific: line 311
Add data-reveal if the component should animate on scroll.
- Very specific: line 339
All icons come from Lucide via @lucide/astro.
- Very specific: line 346
Use camelCase icon names (e.g., arrowUpRight, radioTower, fileSearch).
- Very specific: line 445
When using <Code /> from astro-expressive-code outside Starlight docs, override EC's CSS custom properties in the component's scoped …
- Very specific: line 473
All pages go through BaseLayout: Never duplicate <!doctype>, <head>, NavBar, Footer, or scroll-reveal scripts.
- Distinctive: line 484
Keep line length ≤ 120 chars.
- Very specific: line 491
Check for hardcoded nav props — use getNavProps() from i18n/utils.ts.
- Very specific: line 492
Check for duplicated HTML shell — compose on BaseLayout.
- Distinctive: line 493
Ensure all user-visible strings use the correct zone:
- Distinctive: line 497
Never duplicate text across zones.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.
Files
AGENTS.md — Bub Website
Guidelines for AI agents (Copilot, Claude Code, Cursor, etc.) working on the
website/directory.
Project Overview
This is the Bub marketing & docs site — a static Astro site combining:
- Landing pages (home, 404) with custom components — i18n via
src/i18n/. - Starlight docs (
/docs/getting-started/…,/zh-cn/docs/getting-started/…) auto-generated fromsrc/content/docs/— i18n via Starlight built-in. - Blog (
/posts/…,/zh-cn/posts/…) powered by Astro content collections — i18n viasrc/i18n/.
Site URL: https://bub.build
Tech Stack
| Layer | Tool |
| Framework | Astro 7 (static output, SSR landing pages via Cloudflare) |
| Docs | @astrojs/starlight 0.42 |
| Styling | Tailwind CSS v4 via @tailwindcss/vite + @astrojs/starlight-tailwind |
| Component lib | shadcn/ui conventions (base-vega style) |
| Animations | motion (formerly Framer Motion) |
| Code blocks | astro-expressive-code |
| Fonts | Outfit Variable (sans), JetBrains Mono Variable (mono) |
| Icons | @lucide/astro — see Icon section below |
| Type checking | TypeScript strict mode |
Package Manager
pnpm — always use pnpm to install packages and run scripts.
Use the version pinned in package.json#packageManager; CI reads the same field.
Keep the root and website .node-version pins aligned. Use Node 24.21.0 for
development and deployment; package.json#engines and engineStrict enforce
the dependency minimum (Node 22.19+ on the 22.x line, or Node 24+). Older Node
versions can silently omit optional WASM dependencies before the build fails.
Keep dependency overrides and build-script permissions in pnpm-workspace.yaml.
Astro 7, @astrojs/cloudflare 14, and Starlight 0.42 use Vite 8 and the default
Sätteri Markdown processor. Upgrade these packages together and do not restore
the old Vite 7 override. astro-mermaid 2.1 supports this processor but requires
Mermaid 10/11; keep Mermaid on 11 until the integration supports a newer major.
Register Mermaid before Starlight. Preserve compressHTML: true to retain the
site's HTML-aware spacing between inline elements.
Keep both current and wasm32 in supportedArchitectures.cpu: Starlight's
HTML processors need Sätteri's WASI package when bundled for Cloudflare, while
Node prerendering uses the native binding. Keep strict peer checks enabled.
Keep session: false while the site has no server-side user state. The generated
Cloudflare configuration should contain only ASSETS, without a SESSION KV binding.
Check the Astro migration guide
and Starlight changelog
when updating this stack. Starlight 0.42's mobile menu uses .sl-menu-button and
sl-sidebar-pane:popover-open; it requires Chromium 116+, Safari 17+, or Firefox 125+.
pnpm install # install deps
pnpm dev # dev server
pnpm build # production build
pnpm preview # preview production buildImage Handling
- Prefer the standard
Imagecomponent fromastro:assetsfor local raster assets used by pages and shared UI. - Do not replace local logo or illustration components with raw
<img>just to work around Cloudflare adapter behavior. - The repository intentionally splits image handling in
astro.config.mjs:BUB_ASTRO_IMAGE_MODE=dev: Cloudflare image service, somake docsworks under Node withoutcloudflare:workersimport failures.BUB_ASTRO_IMAGE_MODE=build: compile-time optimization with passthrough runtime, somake docs-test,make docs-preview, and production serve stable built asset URLs.
Makefileis the source of truth for that mode selection.process.argvcommand detection only exists as a fallback for directpnpm dev/pnpm buildusage insidewebsite/.- If you change adapter image settings, re-verify all three paths:
make docs,make docs-test, andmake docs-preview.
Directory Structure
website/
├── astro.config.mjs # Astro + Starlight + Tailwind config (locales, sidebar translations)
├── components.json # shadcn/ui settings (base-vega style)
├── package.json
├── tsconfig.json # strict, path alias @/* → src/*
├── public/ # static assets (logos, favicon)
├── src/
│ ├── content.config.ts # Content collections: docs (Starlight), i18n (Starlight), posts (blog)
│ ├── components/ # shared Astro components
│ │ ├── ui/ # primitives (Icon, SectionHeading)
│ │ ├── NavBar.astro
│ │ ├── Footer.astro
│ │ ├── Hero.astro
│ │ ├── Features.astro
│ │ ├── HookIntro.astro
│ │ ├── TapeModel.astro
│ │ ├── Testimonials.astro
│ │ ├── Contributors.astro
│ │ ├── PostCard.astro
│ │ └── ThemeToggle.astro
│ ├── content/
│ │ ├── docs/ # [Zone 1] Starlight content collection
│ │ │ ├── docs/ # EN docs — maps to /docs/… routes
│ │ │ │ ├── getting-started/
│ │ │ │ ├── concepts/
│ │ │ │ ├── guides/
│ │ │ │ └── extending/
│ │ │ └── zh-cn/ # Chinese translations
│ │ │ └── docs/
│ │ │ ├── getting-started/
│ │ │ ├── concepts/
│ │ │ └── …
│ │ ├── i18n/ # [Zone 1] Starlight UI string overrides — BCP-47 filenames
│ │ │ └── zh-CN.json # ⚠️ ONLY for Starlight UI — never duplicate into src/i18n/
│ │ └── posts/ # [Zone 3] Blog posts
│ │ ├── en/ # English posts
│ │ └── zh-cn/ # Chinese posts
│ ├── i18n/ # [Zone 2] Custom page i18n module (NOT for Starlight docs)
│ │ ├── ui.ts # Flat-key UI strings: nav, footer, 404, posts, site meta
│ │ ├── utils.ts # getLangFromUrl, useTranslations, getNavProps, etc.
│ │ └── landing-page.ts # Single source of truth for all landing-page copy (both locales)
│ ├── layouts/
│ │ ├── BaseLayout.astro # Shared HTML shell (head, nav, footer, scripts)
│ │ ├── LandingLayout.astro
│ │ ├── PostLayout.astro
│ │ └── PostListLayout.astro
│ ├── pages/
│ │ ├── 404.astro # 404 page (custom page, uses Zone 2 i18n)
│ │ └── [...locale]/ # Dynamic locale routing — generates EN (root) + ZH-CN variants
│ │ ├── index.astro # Landing page (both locales via getStaticPaths)
│ │ └── posts/
│ │ ├── index.astro # Post list (both locales via getStaticPaths)
│ │ └── [slug].astro # Single post (both locales via getStaticPaths)
│ └── styles/
│ └── global.css # Tailwind v4 + Starlight bridge + CSS custom properties
└── DESIGN.md # Visual design guidei18n Architecture
Design reference: This architecture follows patterns from the Starlight docs site and the Astro docs site. Both use Starlight for documentation and separate systems for non-doc pages. Study those repos when in doubt.
Three zones, clear boundaries
The site has three distinct i18n zones. Each zone has its own translation mechanism. Never mix them.
| Zone | Pages | i18n mechanism | String source |
| 1 — Starlight docs | /docs/…, /zh-cn/docs/… (all under src/content/docs/) | Starlight built-in i18n | src/content/i18n/{locale}.json + sidebar translations in config |
| 2 — Custom pages | Landing (/, /zh-cn/), 404 | Project's own src/i18n/ module | src/i18n/ui.ts + src/i18n/landing-page.ts |
| 3 — Blog | /posts/…, /zh-cn/posts/… | Content collection + project src/i18n/ | Post markdown in src/content/posts/{locale}/, UI strings in ui.ts |
Zone 1 — Starlight docs i18n
Follows the exact pattern from withastro/starlight/docs.
Locale configuration — astro.config.mjs:
- English is the
rootlocale — content files live undersrc/content/docs/docs/(e.g.,docs/getting-started/run-bub-locally.mdx). - Other locales get subdirectories:
src/content/docs/zh-cn/docs/getting-started/run-bub-locally.mdx. - The inner
docs/directory creates the/docs/URL prefix — this nesting namespaces docs routes. - This keeps the URL scheme consistent:
/docs/…for docs,/posts/…for blog.
// astro.config.mjs
locales: {
root: { label: 'English', lang: 'en' }, // ← root = no prefix for EN docs
'zh-cn': { label: '简体中文', lang: 'zh-CN' },
},Starlight UI string overrides — src/content/i18n/{locale}.json:
- File names use BCP-47 language tags (e.g.,
zh-CN.json, notzh-cn.json). - Override Starlight's built-in UI strings (theme toggle, nav labels, pagination, 404 text, etc.).
- Extend with custom keys via
i18nSchema({ extend: z.object({...}) })incontent.config.ts(see Starlight docscontent.config.tsand Astro docsi18n-schema.tsfor examples). - Do NOT put these strings in
src/i18n/ui.ts— that's Zone 2 only.
Sidebar translations — inline in astro.config.mjs:
- Uses the
translationsproperty on each sidebar group/item. - Keys are BCP-47 language tags (e.g.,
'zh-CN'), NOT URL-slug locale keys. - This matches the Starlight docs pattern where sidebar labels carry translation maps inline.
sidebar: [{
label: 'Getting Started',
translations: { 'zh-CN': '快速开始' },
items: [{ autogenerate: { directory: 'docs/getting-started' } }],
}]Starlight 0.39+ requires autogenerated entries inside items. Keep the group
label and its translations on the parent; set autogenerate.collapsed explicitly
if generated subgroups should start collapsed.
Content schema — src/content.config.ts:
- Uses
docsLoader()+docsSchema()from@astrojs/starlight/loadersand@astrojs/starlight/schema. - Uses
i18nLoader()+i18nSchema()for the i18n collection. - Import Zod from
astro/zod, usingz.url()for URL fields. - Extend the i18n schema with a Zod object if custom Starlight component overrides need translated keys.
- Extend the docs schema if docs need custom frontmatter fields.
Zone 2 — Custom page i18n (src/i18n/)
For pages outside Starlight (landing page, 404). Starlight has no control over these pages.
[...locale] rest-param routing — All custom pages live under src/pages/[...locale]/. A single page file generates both locales via getStaticPaths():
// In any page under src/pages/[...locale]/
export function getStaticPaths() {
return Object.keys(languages).map((lang) => ({
params: { locale: lang === defaultLang ? undefined : lang },
props: { locale: lang as Locale },
}));
}
// → generates / (en, root)
// → generates /zh-cn/ (zh-cn)Never duplicate a page file per locale — use this pattern instead. The 404 page is the only exception (lives at src/pages/404.astro root because Astro requires it there).
| File | Purpose |
ui.ts | Flat-key UI string dictionary for shared UI: site meta, nav, footer, 404, post list, language switcher. English is source of truth; other locales override selectively. |
utils.ts | getLangFromUrl(), useTranslations(), useTranslatedPath(), getNavProps(), getAlternateLocaleHref() helpers. |
landing-page.ts | Single source of truth for all landing-page copy — both locales. Structured data (feature arrays with icons/colors, testimonials, hook stages, hero text, CTAs). |
Convention (from Astro docs pattern): Landing-page components (Hero, Features, HookIntro, TapeModel, Testimonials) are pure presentation — they receive all text/content via props from
landing-page.ts. They have no hardcoded text defaults. Non-landing UI strings (nav, footer, 404, posts) go inui.tsand are accessed viat().
Zone 3 — Blog i18n
Blog posts are a content collection (src/content/posts/{locale}/). The collection schema includes a locale field to identify the language. Blog UI strings (page titles, back-links, etc.) live in src/i18n/ui.ts (Zone 2), not in Starlight's i18n.
Boundary rules
| ✅ Do | ❌ Don't |
Put Starlight UI overrides in src/content/i18n/ | Duplicate Starlight keys into src/i18n/ui.ts |
Put nav/footer/404/post-list strings in src/i18n/ui.ts | Put custom page strings in src/content/i18n/ |
Put landing-page structured copy in src/i18n/landing-page.ts | Put landing text in ui.ts or Starlight i18n |
Use [...locale] rest-param pages for custom pages | Duplicate page files per locale (e.g., zh-cn/posts/) |
Use translations on sidebar items in astro.config.mjs | Create separate sidebar translation files for 2 locales |
Use BCP-47 tags (zh-CN) in Starlight config/i18n files | Use URL slugs (zh-cn) in Starlight i18n JSON filenames |
Use URL slugs (zh-cn) in directory paths and page routes | Use BCP-47 tags in directory/route paths |
Adding a UI string (non-landing pages)
- Add the English string to
ui.tsunder theenobject. - Add the translation under the target locale.
- Use
const t = useTranslations(locale); t('your.key')in any.astrofile.
Adding landing-page content
- Add the English content to
landing-page.tsunder theensection. - Add the translation under the target locale section.
- Pass as props from the page to the component via
getLandingPageCopy(locale).
Adding a Starlight UI string override
- Add the translated string to
src/content/i18n/zh-CN.json(or the target locale file). - If the key is custom (not a built-in Starlight key), define it in the Zod extension inside
content.config.tsviai18nSchema({ extend: z.object({ 'your.key': z.string().optional() }) }). - Reference: Starlight i18n docs.
Adding a new locale
- Starlight zone: Add the locale to
astro.config.mjslocales. Createsrc/content/docs/<locale>/docs/with translated docs. Createsrc/content/i18n/<BCP-47>.jsonfor UI overrides. - Custom page zone: Add the locale key to
languagesinui.ts. Add translations inui.tsandlanding-page.ts. The[...locale]pages auto-generate routes viagetStaticPaths(). - Blog zone: Create
src/content/posts/<locale>/with translated posts.
URL scheme
- English (default): no prefix —
/,/posts/,/docs/getting-started/, etc. - Chinese:
/zh-cn/,/zh-cn/posts/,/zh-cn/docs/getting-started/, etc. - Starlight docs have a
/docs/prefix via thedocs/content subdirectory. - Custom pages (landing, blog) use
[...locale]rest-param routing — one page file generates both/and/zh-cn/variants.
Locale key conventions
| Context | Key format | Example |
| URL paths & directory names | lowercase slug | zh-cn |
astro.config.mjs locale keys | lowercase slug | 'zh-cn': { ... } |
astro.config.mjs sidebar translations keys | BCP-47 | 'zh-CN': '快速开始' |
src/content/i18n/ filenames | BCP-47 | zh-CN.json |
HTML lang attribute | BCP-47 | zh-CN |
src/i18n/ui.ts locale keys | lowercase slug | 'zh-cn': { ... } |
Adding a new page
Custom page (landing/blog style):
- Create
src/pages/[...locale]/<path>.astrowithgetStaticPaths()generating all locales. - Import and wrap with the appropriate layout (BaseLayout, PostLayout, etc.).
- Extract text into
ui.ts(Zone 2) with appropriate flat keys. - Run
pnpm buildto verify.
Starlight doc page:
- Create the English file in
src/content/docs/docs/<section>/<slug>.md. - Create the Chinese translation in
src/content/docs/zh-cn/docs/<section>/<slug>.md. - Sidebar item is auto-generated if the parent group uses
autogenerate. Otherwise add tosidebarinastro.config.mjswithtranslations. - Run
pnpm buildto verify.
Adding a new component
- Create in
src/components/. - No hardcoded text defaults — components are pure presentation. Accept all text/content via props.
- Let the caller pass content via
getLandingPageCopy()ort()from the page level. - Add
data-revealif the component should animate on scroll.
Common mistakes
| Mistake | Fix |
Writing <!doctype html> in a page | Use BaseLayout |
| Hardcoding nav/footer props in a page | Use getNavProps() |
Adding nested objects to ui.ts | Use flat 'section.key' format |
| Using non-Lucide icon libraries | Use @lucide/astro via Icon.astro |
Adding dark:text-* for themed colors | Use semantic tokens (text-foreground) that auto-switch |
Duplicating scroll-reveal <script> | BaseLayout includes it |
Putting landing text in ui.ts | Use landing-page.ts — ui.ts is for shared UI only |
| Hardcoding English in component defaults | Components are pure presentation; all text from i18n |
| Duplicating a page file per locale | Use [...locale] rest-param routing with getStaticPaths() |
Putting custom page strings in src/content/i18n/ | Zone 1 only. Custom pages use src/i18n/ (Zone 2) |
Putting Starlight overrides in src/i18n/ui.ts | Zone 2 only. Starlight uses src/content/i18n/ (Zone 1) |
Naming i18n JSON with URL slugs (zh-cn.json) | Use BCP-47 (zh-CN.json) for Starlight i18n files |
Using BCP-47 in directory paths (docs/zh-CN/) | Use lowercase slugs (docs/zh-cn/) for directories |
Using 'zh-cn' in sidebar translations keys | Use BCP-47 ('zh-CN') |
| Adding hue/chroma to Starlight color overrides | Site is monochrome — keep oklch with 0 chroma |
Adding new --sl-color-* overrides without checking the existing unlayered block | Edit the existing :root { --sl-color-* } / .dark, [data-theme="dark"] { --sl-color-* } blocks — they override the bridge for correct monochrome contrast |
Importing @import "tailwindcss" in global.css | Use tailwindcss/theme.css + tailwindcss/utilities.css in proper layers — full import brings Preflight that breaks Starlight/EC |
Icons — @lucide/astro
All icons come from Lucide via @lucide/astro. The project wraps them in src/components/ui/Icon.astro which handles camelCase → PascalCase name mapping.
<Icon name="arrowUpRight" size={15} />
<Icon name="github" size={14} /> <!-- special-cased brand icon -->- Use camelCase icon names (e.g.,
arrowUpRight,radioTower,fileSearch). - Browse icons at https://lucide.dev/icons.
- The GitHub brand icon is manually defined inside
Icon.astro(not a Lucide built-in).
Theme System — CSS Custom Properties
The design system uses oklch color tokens defined in src/styles/global.css.
Light / Dark
- Light tokens in
:root { }. - Dark tokens in
.dark, [data-theme="dark"] { }— both selectors are needed to cover landing pages (.darkclass) and Starlight docs ([data-theme]attribute).ThemeToggle.astrosets both. - Theme toggle logic lives in
ThemeToggle.astro(inNavBar.astro), with an inline init script inBaseLayout.astro<head>to prevent FOUC. - Stored in
localStorageunder keybub-theme.
Core tokens (selection)
| Token | Usage |
--background | Page background |
--foreground | Primary text |
--primary | CTA buttons, active states |
--primary-foreground | Text on primary backgrounds |
--secondary | Hover backgrounds, cards |
--muted-foreground | Secondary text, meta info |
--border | All borders |
--card / --card-foreground | Card surfaces |
--chart-1 … --chart-5 | Accent colors for charts/tags |
Fonts
| CSS var | Font | Usage |
--font-sans | Outfit Variable | Body, headings |
--font-mono | JetBrains Mono Variable | Code, badges, labels |
Starlight + Tailwind v4 integration
Starlight ships with a blue accent (hue 224/234) and blue-tinted grays. The main site is monochrome (all oklch colors have 0 chroma). The bridge is @astrojs/starlight-tailwind — it reads --color-accent-* and --color-gray-* from the @theme block and generates --sl-color-* variables in @layer utilities. However, the bridge's mapping (e.g. --sl-color-accent ← --color-accent-600) does not produce the right contrast for a monochrome theme, so manual unlayered --sl-* overrides are still required for precise control. Unlayered CSS always beats @layer utilities.
Reference: Starlight CSS + Tailwind guide
How global.css is structured (follow this order):
1. Font imports (@import "@fontsource-variable/…")
2. Cascade layer ordering: @layer base, starlight, theme, components, utilities;
3. Starlight bridge: @import '@astrojs/starlight-tailwind';
4. Tailwind layers: @import 'tailwindcss/theme.css' layer(theme);
@import 'tailwindcss/utilities.css' layer(utilities);
5. @theme inline { … } — fonts, Starlight color scales, site design tokens, radius
6. :root { … } — raw light tokens (unlayered)
7. .dark, [data-theme="dark"] { … } — raw dark tokens (unlayered)
8. :root { --sl-font/color overrides } — unlayered to beat bridge @layer utilities
9. .dark, [data-theme="dark"] { --sl-color-* overrides }
10. @layer base { … } — Tailwind preflight + site base resets (lowest priority)Why this order matters:
| Layer | Contains | Priority |
@layer base | Site resets (* { border-border }, body bg/text, etc.) | Lowest |
@layer starlight | Starlight + expressive-code styles | Overrides base |
@layer theme | Tailwind theme variables | Overrides starlight |
@layer utilities | Tailwind utilities | Overrides theme |
| Unlayered CSS | Raw tokens, --sl-font-* / --sl-color-* overrides, @media queries | Highest |
Key rules:
- NEVER use
@import "tailwindcss"— it brings in the full Preflight reset that conflicts with Starlight and astro-expressive-code. Only importtailwindcss/theme.cssandtailwindcss/utilities.cssin their proper layers. - Define Starlight colors via
@themescales —--color-accent-50through--color-accent-950and--color-gray-50through--color-gray-950. The bridge reads these and generates--sl-color-*in@layer utilities. - Override
--sl-*colors and fonts manually (unlayered) — the bridge's auto-mapped values don't produce the right contrast for the monochrome theme. Unlayered:root/.dark, [data-theme="dark"]blocks with explicit--sl-color-*values win over the bridge's@layer utilitiesoutput. - Import
tailwindcss/preflight.cssin@layer base— restores box-sizing, link resets, and other base styles that the split Tailwind import omits. Becausebaseis the lowest layer, EC and Starlight styles still override it. - The
@layer base*reset is safe — because EC styles live in@layer starlight.components(higher priority), they always win.
Starlight color scales (in @theme):
Both scales use pure neutral oklch values (0 chroma) to match the site's monochrome identity:
| Scale | Example values | Starlight usage |
--color-accent-50 … --color-accent-950 | oklch(0.985 0 0) → oklch(0.145 0 0) | Links, highlights, active nav items |
--color-gray-50 … --color-gray-950 | oklch(0.985 0 0) → oklch(0.145 0 0) | Backgrounds, text, borders |
Do NOT add hue or chroma to these scales — the entire site identity is neutral/monochrome. Aside callout colors (orange, green, blue, purple, red) are intentionally left at Starlight defaults for semantic clarity.
How to customize Starlight appearance going forward:
- To change Starlight's gray palette → update
--color-gray-*values in@theme inline. - To change Starlight's accent color → update
--color-accent-*values in@theme inline. - To change fonts → update
--font-sans/--font-monoin@theme inlineAND--sl-font/--sl-font-monoin the unlayered:rootblock. - To add site-specific overrides that should beat Starlight → put them unlayered (outside any
@layer). - To add base resets that Starlight/EC can override → put them in
@layer base.
Overriding expressive-code on custom pages (e.g., Hero):
When using <Code /> from astro-expressive-code outside Starlight docs, override EC's CSS custom properties in the component's scoped <style> block:
.hero-terminal :global(.expressive-code) {
--ec-codeBg: var(--card);
--ec-frm-edTabBarBg: var(--secondary);
/* … etc. — see Hero.astro for the full list */
}Scoped Astro styles are unlayered, so they beat both @layer base and @layer starlight.
Radius
Radius tokens follow a scale: --radius-sm through --radius-4xl, all computed from --radius: 0.625rem.
Layout Hierarchy
BaseLayout.astro ← HTML shell, <head>, NavBar, Footer, scroll-reveal, back-to-top
├── LandingLayout.astro ← Hero + section components
├── PostLayout.astro ← Single blog post with article styles
├── PostListLayout.astro ← Blog listing page
└── (404.astro uses BaseLayout directly)All pages go through BaseLayout. Never duplicate <!doctype>, <head>, NavBar, Footer, or scroll-reveal scripts.
Coding Conventions
- Astro components for static content; avoid client-side JS unless interactive.
- Tailwind utility classes for styling; avoid custom CSS unless for animations.
class:listfor conditional classes.- Props interfaces at the top of the frontmatter.
data-revealattribute on elements that should animate on scroll.- Keep line length ≤ 120 chars.
Before Committing
pnpm build— must pass with no errors.- Check for hardcoded nav props — use
getNavProps()fromi18n/utils.ts. - Check for duplicated HTML shell — compose on
BaseLayout. - Ensure all user-visible strings use the correct zone:
- Zone 1 (Starlight docs): UI overrides in
src/content/i18n/, sidebar translations inline in config. - Zone 2 (Custom pages): Landing copy →
landing-page.ts, shared UI strings →ui.ts. - Zone 3 (Blog): Post content in
src/content/posts/{locale}/, UI strings inui.ts. - Never duplicate text across zones.
- Zone 1 (Starlight docs): UI overrides in
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
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.

