From 95c393edd4bcba53ba94da526cf5bbad274af477 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 24 Jul 2026 07:25:45 +0000 Subject: [PATCH 1/3] docs: add agent-facing build system (getting-started, cookbook, slashed-build skill) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close the "single entry point for AI agents" gaps found auditing the LLM docs: the token layer was complete, but an agent reading only llm-guide.md had no install/getting-started path, no cross-links to the class-based API, and no task-oriented recipes. - docs/getting-started.md: install, bundle choice, boilerplate, dark mode, 6-token rebrand, token-first rule. Multipliers framed as an advanced, opt-in escape hatch — not the default workflow. - docs/cookbook.md: copy-paste task recipes (page shell, stack, card grid, hero, sidebar, prose, surface, buttons, states, rebrand + dark toggle). - .claude/skills/slashed-build/SKILL.md: thin router/"brain" — mental model, build workflow, decision tree, and routing into the CI-gated docs. No duplicated token/class inventories (anti-drift). - llm-guide.md + README: cross-link the new docs and the class-based API. - check-doc-refs.js: scan the skill dir too, so SKILL.md's --sf-*/.sf-* references are drift-guarded like every other doc. check:doc-refs and check:llm-guide both pass (17 docs scanned). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Fad4UDMPgW3dBurUpkJE9d --- .claude/skills/slashed-build/SKILL.md | 112 ++++++++++++ README.md | 6 + docs/cookbook.md | 242 ++++++++++++++++++++++++++ docs/getting-started.md | 170 ++++++++++++++++++ docs/llm-guide.md | 8 + scripts/check-doc-refs.js | 2 +- 6 files changed, 539 insertions(+), 1 deletion(-) create mode 100644 .claude/skills/slashed-build/SKILL.md create mode 100644 docs/cookbook.md create mode 100644 docs/getting-started.md diff --git a/.claude/skills/slashed-build/SKILL.md b/.claude/skills/slashed-build/SKILL.md new file mode 100644 index 00000000..a96c3c8a --- /dev/null +++ b/.claude/skills/slashed-build/SKILL.md @@ -0,0 +1,112 @@ +--- +name: slashed-build +description: >- + Use when building or styling a UI, website, page, or component with the + SLASHED CSS framework (the `--sf-*` token API and `.sf-*` classes) — writing + the HTML/CSS, choosing tokens over hardcoded values, laying out with + primitives, rebranding, or wiring dark mode. Routes to the framework's + authoritative, CI-gated docs; does not duplicate token or class lists. +--- + +# Building with SLASHED + +SLASHED is a token-first, BEM-first CSS framework: the `--sf-*` design-token API +is the product, and you compose components on top of it. This skill is the +entry point — it teaches the mental model and the build workflow, then routes +you to the authoritative reference docs for the exhaustive lists. **Do not +memorise or reproduce token/class inventories from here; look them up in the +linked docs, which CI keeps in sync with the source.** + +## When to use + +Use this whenever the task involves writing or styling markup that should look +like SLASHED: new pages, components, layouts, rebrands, theming, or dark mode. +If the user's project loads a `slashed*.css` bundle or uses `--sf-*` / `.sf-*` +names, you are in scope. + +## The five principles (in priority order) + +1. **Never hardcode a visual value.** Every colour, space, radius, shadow, + font, z-index, and duration is a token. `padding: 24px` is a bug; write + `padding: var(--sf-space-m)`. Hardcoded numbers break consistency and dark + mode. +2. **BEM-first, classes where they count.** Base elements are styled classless. + Use `.sf-*` classes for layout primitives, macros, and states; build your + own BEM components on the token API for everything else. +3. **Prefer semantic tokens over primitive ones.** Reach for `var(--sf-gap)` + over `var(--sf-space-m)` in a grid — the semantic token lets one change + ripple everywhere without touching components. +4. **Dark mode is free — don't fight it.** Never write dark-mode colour CSS or + toggle CSS variables in JS. Set `data-theme` and let the framework recompute + the palette from the source tokens. +5. **Tweak by knob or `calc()`, never a new token.** For a one-off variation, + override an existing knob (`--sf-grid-gap: var(--sf-space-s)`) or compose + with `calc()`. Inventing `--my-*` tokens fragments the system and skips + dark-mode derivation. + +> **Advanced escape hatch (not the default workflow):** because everything +> flows from tokens, global multipliers such as `--sf-radius-scale: 0` or +> `--sf-motion-scale: 0` can restyle an entire site in one line. Treat these as +> a deliberate power-user switch, hidden by default — do not introduce them +> into ordinary component work. + +## Build workflow + +1. **Load the framework.** Confirm a bundle is present (or add one). Optimal is + the default; the full bundle adds `.sf-btn` / `.sf-card` + utilities. See + [getting-started.md](../../../docs/getting-started.md). +2. **Lay out with primitives, not custom CSS.** Reach for `.sf-container`, + `.sf-stack`, `.sf-grid`, `.sf-cluster`, `.sf-sidebar`, `.sf-cover`, and + friends before writing flexbox/grid by hand. → [layout.md](../../../docs/layout.md) +3. **Style with macros + tokens.** Panels → `.sf-surface`; articles → + `.sf-prose`; spacing/typography → tokens. → [macros.md](../../../docs/macros.md) +4. **Wire state through `.sf-is-*` classes + ARIA**, toggled from JS — not + inline styles. → [states.md](../../../docs/states.md) +5. **Brand via the six source colours** in the overrides space; add + `data-theme` for forced modes. → [theming.md](../../../docs/theming.md) +6. **Verify token-first.** Before finishing, scan your CSS for hardcoded + colours/px/rem and replace them with tokens. + +## Decision tree — "I want to…" + +| Goal | Reach for | Reference | +| --- | --- | --- | +| Constrain / centre page content | `.sf-container` (+ `--narrow`/`--wide`/`--prose`) | [layout.md](../../../docs/layout.md) | +| Space stacked children | `.sf-stack` | [layout.md](../../../docs/layout.md) | +| Responsive card grid (no media queries) | `.sf-grid .sf-grid--fit` + `--sf-grid-min` | [layout.md](../../../docs/layout.md) | +| Row that wraps (buttons, tags) | `.sf-cluster` | [layout.md](../../../docs/layout.md) | +| Content + collapsing sidebar | `.sf-sidebar` | [layout.md](../../../docs/layout.md) | +| A padded, elevated panel | `.sf-surface` (any bundle) / `.sf-card` (full) | [macros.md](../../../docs/macros.md) | +| Rich article typography | `.sf-prose` | [macros.md](../../../docs/macros.md) | +| Buttons | `.sf-btn` + variant (full bundle) | [classes.md](../../../docs/classes.md) | +| Loading / selected / disabled state | `.sf-is-*` + matching ARIA | [states.md](../../../docs/states.md) | +| A specific spacing / colour / radius value | a `--sf-*` token | [llm-guide.md](../../../docs/llm-guide.md) · [tokens.md](../../../docs/tokens.md) | +| Rebrand the whole site | six `--sf-color-*-source-light` tokens | [theming.md](../../../docs/theming.md) | +| Dark mode | `data-theme="dark"` on `` or a section | [theming.md](../../../docs/theming.md) | +| Look a name up programmatically | `api-index.json` / `token-index.json` | [docs/](../../../docs/) | + +## Reference map (authoritative, CI-gated) + +- **[getting-started.md](../../../docs/getting-started.md)** — install, bundle + choice, boilerplate, first rebrand. +- **[cookbook.md](../../../docs/cookbook.md)** — copy-paste recipes for common + builds (page shell, card grid, hero, sidebar, form states, rebrand). +- **[llm-guide.md](../../../docs/llm-guide.md)** — the deep token reference: + colour/type/space/layout/motion systems, tiers, best practices. +- **[layout.md](../../../docs/layout.md)** / **[macros.md](../../../docs/macros.md)** + / **[states.md](../../../docs/states.md)** — every layout primitive, macro, + and state class. +- **[theming.md](../../../docs/theming.md)** — rebrand, dark mode, multi-brand, + contrast. +- **[classes.md](../../../docs/classes.md)** / **[tokens.md](../../../docs/tokens.md)** + — the complete generated inventories. +- **`api-index.json`** / **`token-index.json`** — machine-readable indexes for + programmatic lookup. + +## Guardrails + +- Only reference `--sf-*` tokens and `.sf-*` classes that actually exist — check + the reference docs or the JSON indexes rather than guessing a name. +- Do not edit `INTERNAL` tokens (e.g. `--sf-is-dark`); they are framework-managed. +- Put your overrides in plain `:root` / your own selectors — the + `slashed.overrides` layer sits last, so you never need `!important`. diff --git a/README.md b/README.md index 2876ca4d..c10f27b4 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,8 @@ Pre-built bundles ship with every [release](https://github.com/codeslash-dev/SLA | Guide | What's inside | | --- | --- | +| [Getting started](docs/getting-started.md) | install, bundle choice, boilerplate, first rebrand — start here | +| [Cookbook](docs/cookbook.md) | copy-paste recipes for common builds (page shell, card grid, hero, sidebar, states) | | [Architecture](docs/architecture.md) | layers, file structure, class taxonomy, bundles, token contract, performance | | [Theming](docs/theming.md) | rebrand in 6 tokens, dark mode, multi-brand, contrast | | [Layout primitives](docs/layout.md) | every `.sf-*` layout class + tokens | @@ -168,6 +170,10 @@ Pre-built bundles ship with every [release](https://github.com/codeslash-dev/SLA | [LLM guide](docs/llm-guide.md) | compact API reference for AI-assisted development | | [Migration](docs/migration.md) | upgrading SLASHED + migrating from other frameworks | +Building with an AI assistant? The **`slashed-build` skill** +(`.claude/skills/slashed-build/`) turns this documentation set into a guided +build workflow — mental model, decision tree, and routing into the docs above. + ## Editor integration A generated [VS Code CSS Custom Data](https://github.com/microsoft/vscode-css-languageservice/blob/main/docs/customData.md) diff --git a/docs/cookbook.md b/docs/cookbook.md new file mode 100644 index 00000000..b938b5fa --- /dev/null +++ b/docs/cookbook.md @@ -0,0 +1,242 @@ +# SLASHED Cookbook + +Task-oriented recipes: *"I want to build X"* → the markup and the tokens that +get you there. Every recipe is copy-paste ready and works in light and dark +mode with no extra CSS. For the reasoning behind each choice, follow the links +into the [LLM guide](llm-guide.md). + +These recipes lean on the **optimal** bundle. Recipes that use `.sf-btn` or +`.sf-card` note that they need the **full** bundle. + +- [Page shell](#page-shell) +- [Vertical rhythm (stack)](#vertical-rhythm-stack) +- [Card grid](#card-grid) +- [Hero / landing section](#hero--landing-section) +- [Sidebar layout](#sidebar-layout) +- [Long-form article (prose)](#long-form-article-prose) +- [A surface / panel](#a-surface--panel) +- [Buttons and actions](#buttons-and-actions) +- [Interactive states](#interactive-states) +- [Rebrand + dark-mode toggle](#rebrand--dark-mode-toggle) +- [Local tweaks without new tokens](#local-tweaks-without-new-tokens) + +--- + +## Page shell + +Centre and constrain content with `.sf-container`; it caps line length and adds +responsive side padding. + +```html +
+
+
+``` + +Width variants: `.sf-container--narrow`, `.sf-container--wide`, +`.sf-container--full`, `.sf-container--prose` (ideal reading measure). + +--- + +## Vertical rhythm (stack) + +`.sf-stack` puts consistent space **between** children — never margins on the +children themselves. + +```html +
+

Section title

+

First paragraph.

+

Second paragraph.

+
+``` + +Tune the gap per-instance with a size modifier (`.sf-stack--s` … +`.sf-stack--2xl`) or globally with the `--sf-stack-gap` knob. See +[layout.md](layout.md). + +--- + +## Card grid + +A responsive grid that fits as many columns as will fit — no media queries. + +```html + +``` + +- `.sf-grid--fit` auto-fits columns based on `--sf-grid-min` (the minimum + column width). Set `--sf-grid-min` to change the breakpoint density. +- `.sf-card` needs the **full** bundle. On the optimal bundle, use + `.sf-surface` for the same panel look. +- Want a tighter grid? Set `--sf-grid-gap: var(--sf-space-s)` on the `