/CLAUDE.md
CLAUDE.md at /CLAUDE.md
Path: CLAUDE.md
zcss — zudo-css
CSS best practices documentation site, built with zudo-doc (Astro 5, MDX, Tailwind CSS v4).
Commands
Package manager: pnpm (Node.js >= 20).
pnpm dev # Dev server → http://css-bp.localhost:8811
pnpm build # Production build → dist/
pnpm preview # Preview built site
pnpm check # Astro type checking
pnpm b4push # Pre-push validation (typecheck + build + link check)
Content Structure
- English (default):
src/->content/ docs/ /docs/ . . . - Japanese:
src/->content/ docs- ja/ /ja/ docs/ . . . - Japanese docs should mirror the English directory structure
Bilingual rule: When creating or updating any doc page, ALWAYS update both the English (docs/) and Japanese (docs-ja/) versions in the same PR. Keep code blocks and <CssPreview> blocks identical between languages — only translate surrounding prose. If a Japanese version does not yet exist, create it.
Content Categories
Top-level directories under src/. Directories with header nav entries are mapped via categoryMatch in src/:
overview/- What is zudo-css, css-wisdom skill docslayout/- Flexbox, Grid, positioning, centering, sizing, specialized layoutstypography/- Font sizing, fonts, text controlstyling/- Color, effects, shadows and bordersresponsive/- Container queries, fluid design, media queries, responsive patternsinteractive/- Forms, scroll, selectors, states and transitionsmethodology/- Architecture (BEM, cascade layers, CSS modules), design systems
Auto-generated directories (no header nav entry):
inbox/- Draft/work-in-progress articles (skipped by css-wisdom skill)
Writing Docs
All documentation files use .mdx format with YAML frontmatter.
Frontmatter Fields
Schema defined in src/:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Page title, rendered as the page h1 |
description | string | No | Subtitle displayed below the title |
sidebar_position | number | No | Sort order within category (lower = higher). Always set this for predictable ordering |
sidebar_label | string | No | Custom text for sidebar display (overrides title) |
tags | string[] | No | Cross-category grouping tags |
draft | boolean | No | Exclude from build entirely |
unlisted | boolean | No | Built but noindexed, hidden from sidebar/nav |
hide_sidebar | boolean | No | Hide the left sidebar, center content |
hide_toc | boolean | No | Hide the right-side table of contents |
standalone | boolean | No | Hidden from sidebar nav but still indexed |
slug | string | No | Custom URL slug override |
generated | boolean | No | Build-time generated content (skip translation) |
search_exclude | boolean | No | Exclude from search results |
pagination_next | string/null | No | Override next page link (null to hide) |
pagination_prev | string/null | No | Override prev page link (null to hide) |
Content Rules
- No h1 in content: The frontmatter
titleis automatically rendered as the page h1. Start your content with## h2headings. Do not write# h1in the MDX body. - Always set
sidebar_position: Without it, pages sort alphabetically which is unpredictable. Use integers starting from 1. - Kebab-case file names: Use
my-article.mdx, notmyArticle.mdxormy_article.mdx.
Article Structure
Follow this pattern for all articles:
## The Problem— what goes wrong, common mistakes## The Solution— recommended approach with CssPreview demos- More sections with demos as needed
## When to Use— summary of when this technique applies
Linking Between Docs
Use relative file paths with the .mdx extension:
[Link text](./sibling-page.mdx)
[Link text](../other-category/page.mdx)
[Link text](../other-category/page.mdx#anchor)
The remark plugin resolves these during build. External links use standard URLs.
MDX Components
Available globally in MDX without imports:
<Note>,<Tip>,<Info>,<Warning>,<Danger>— Admonitions (each accepts optionaltitleprop)<CssPreview>— Interactive CSS preview with code display (renders in iframe)
CssPreview Demos
Always include CssPreview demos — they are the most valuable part of each article.
Key details:
- Renders inside an iframe — all CSS is fully isolated
- Viewport buttons: Mobile (320px), Tablet (768px), Full (~900-1100px)
- No JavaScript — interactions must be CSS-only (
:hover,:focus,:checked, etc.)
CSS Conventions in Demos
- Use
hsl()colors, not hex - Use descriptive BEM-ish class names (e.g.,
.card-demo__header) - Use
font-family: system-ui, sans-seriffor body text - Minimum font size: 0.75rem / 12px for labels
- Template literal indentation: Always indent
css={}andhtml={}content by at least 2 spaces. Thededent()utility strips common leading whitespace before displaying code in the panel. Content at column 0 produces unindented code display.
Navigation Structure
Navigation is filesystem-driven. Directory structure directly becomes sidebar navigation.
Sidebar Ordering
- Pages are ordered by
sidebar_position(ascending). Without it, alphabetical order is used. - Category index pages (
index.mdx) control category position via their ownsidebar_position.
Header Navigation
Defined in src/ via headerNav. Each item maps to a top-level content directory via categoryMatch:
{ label: "Layout", path: "/docs/layout", categoryMatch: "layout" }
Adding a new header nav item requires editing settings.ts.
Content Creation Workflow
Adding a New Article
- Create the English
.mdxfile in the appropriate category undersrc/content/ docs/ - Add frontmatter with at least
titleandsidebar_position - Write content starting with
## h2headings (not# h1) - Include CssPreview demos to illustrate techniques
- Create the matching Japanese file under
src/with the same pathcontent/ docs- ja/ - Keep code blocks and
<CssPreview>blocks identical — only translate prose - Run
pnpm buildto verify the site builds correctly
Adding a New Category
- Create the directory under
src/(kebab-case)content/ docs/ - Create
index.mdxwithtitle,description, andsidebar_position - Add a
headerNaventry insrc/withconfig/ settings. ts categoryMatchpointing to the directory name - Mirror the directory structure under
src/content/ docs- ja/ - Run
pnpm buildto verify
Design Token System
Uses a 16-color palette with OKLCH orange accent (oklch(55.5% 0.163 48.998)).
Color Rules
- NEVER use Tailwind default colors (
bg-gray-500,text-blue-600) - ALWAYS use project tokens:
text-fg,bg-surface,border-muted,text-accent, etc. - Use palette tokens (
p0–p15) only when no semantic token fits
Color Schemes
- Default: ZCSS Dark (warm dark theme with orange accents)
- Light: ZCSS Light (warm light theme with orange accents)
- Configured in
src/andconfig/ settings. ts src/config/ color- schemes. ts
Doc Skill (css-wisdom)
The css-wisdom skill (.) is generated by pnpm generate:css-wisdom (runs scripts/). It is gitignored — do NOT track it in git or edit it directly. To update the skill content, edit the generator script and re-run pnpm generate:css-wisdom. Add descriptions for new articles to ..
Claude Code Skills
This repo manages zcss-specific Claude Code skills in .claude/skills/:
css-wisdom— Generated topic index of all CSS articles. Symlinked to~/so it’s available globally. Supports. claude/ skills/ css- wisdom -u/--updatemode.l-writing— Writing and formatting rules for MDX articles. Before writing or editing docs, invoke/.l- writing l-handle-deep-article— Guide for converting flat articles into deep articles with sub-pages. Local to this repo.l-demo-component— Guide for CssPreview component usage anddefaultOpenprop conventions. Local to this repo.l-translate— Translate English docs to Japanese using theja-translatorsubagent. Invoke/.l- translate <path- or- category> b4push— Before-push quality checks (type check, build, link check). Invoke/.b4push
Agents
ja-translator— Subagent for translating MDX docs from English to Japanese.
Translation Workflow
After editing or creating an English doc, translate the Japanese counterpart using /. After editing a Japanese doc, update the English counterpart similarly.
Site Config
- Base path:
/pj/ zcss/ - Settings:
src/config/ settings. ts
CI/CD
- PR checks: typecheck + build + link check + Cloudflare Pages preview
- Main deploy: build + Cloudflare Pages production + IFTTT notification
- Preview deploy: branch-based Cloudflare Pages preview
- Secrets: CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKEN, IFTTT_PROD_NOTIFY
Safety Rules
rm -rf: relative paths only (.), never absolute/ path - No force push, no
--amendunless explicitly permitted - Temp files go to
__inbox/(gitignored)