diff --git a/CLAUDE.global.md b/CLAUDE.global.md index b181f52..813843a 100644 --- a/CLAUDE.global.md +++ b/CLAUDE.global.md @@ -277,7 +277,8 @@ cryptic names. - Docs post-ship → document-release (doc if gstack off); stale-doc audit → doc - Grouped all-axes sweep ("tir groupé", fix + loop until clean) → tour - Open-work inventory / "queue empty?" / stale TODO vs git → reconcile -- Design / UI (build, system, audit, polish) → "Design work" below +- Design / UI (build, system, audit, polish) → Read + `~/.claude/rules/web-building.md` § "Design work" first - Architecture review → plan-eng-review - Before /clear or /compact → capitalize; end-of-session ritual → close - superpowers skills are vendored, called by bare name; an upstream @@ -293,33 +294,11 @@ cryptic names. enable higgsfield`, then Read the skill under `~/.claude/skills/`; `higgsfield generate cost` before a paid run. Landing page "with Higgsfield", named ask → `enable higgsfield-websites`: an aid inside - Design work and the site rules, never `website create|deploy|publish`. + the Design work rules (`rules/web-building.md`), never + `website create|deploy|publish`. gstack OFF → its skills (investigate, qa, review, health, retro, office-hours…) are gone: use the fallback above, else say so. -## Design work — full toolchain (tiered by scope) -Trigger = UI work: editing a component/style file (.tsx/.vue/.svelte/.css…) -or a design/UI request, not the word "design" alone. Single source for -design routing; the design-toolchain hook reinforces it. -- Trivial (≤2 files, one cosmetic value) → /hotfix, no toolchain. -- Build UI (component, page, redesign) → impeccable (build path: init, - shape, new-work, craft floor, fresh finish reviewer) + ui-ux-pro-max + - 21st-ui-build (catalog + generation) + emil-design-eng (polish) + - design-motion-principles (motion) + design-html (static) + site-motion. - Floor: `impeccable detect ` (61 rules, exit 2). frontend-design - only for a one-off visual with no project context, not beside impeccable. -- Design system / brand → design-consultation first, then the build tools. -- Review / audit → design-review + emil-design-eng + design-motion-principles - + /impeccable audit|critique + `impeccable detect` floor. -- The vendored stack members route to `reflect` (high) through their - model-router rows (`mods/model-router`); the last rowed skill loaded - wins and an unrowed member (plugin, gstack) changes nothing. -Scope doubt → ask or default to Build, never silently skip. Gate: light -skills run `~/.claude/lib/design-gate.md`, orchestrators plugin-check. 21st = -CLI (`npm i -g @21st-dev/cli`, `21st login`), no MCP, no key; search free, -`21st get`/`generate` metered → generation, not micro-tweaks. 21st-ai / -ui-explore / ui-review are `max`-profile only. - ## graphify Threshold: graphify from 200 tracked code files, never below (banner line diff --git a/hooks/design-toolchain-reminder.sh b/hooks/design-toolchain-reminder.sh index 0c23fbd..165b822 100755 --- a/hooks/design-toolchain-reminder.sh +++ b/hooks/design-toolchain-reminder.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash # design-toolchain-reminder.sh # -# UserPromptSubmit hook. When the prompt carries a UI/design signal, inject a -# reminder to mobilize the full design toolchain (tiered by scope, per CLAUDE.global.md -# "Design work — full toolchain"). A UserPromptSubmit hook's stdout is appended -# to the model's context, so the cat block below becomes additional guidance. +# UserPromptSubmit hook. When the prompt carries a UI/design signal, point the +# model at the design toolchain section (tiered by scope). Since BDR-125 +# phase 1 it lives in rules/web-building.md § "Design work — full toolchain", +# not in CLAUDE.global.md: it loads by itself on a UI file Read, and a +# chat-only design request needs this pointer. A UserPromptSubmit hook's +# stdout is appended to the model's context. # # This is a soft nudge: the tiered rule itself says trivial work uses NO # toolchain, so a false positive (e.g. "API design") costs only a reminder the @@ -25,10 +27,11 @@ prompt="$(printf '%s' "$input" \ 2>/dev/null || true)" [ -z "$prompt" ] && prompt="$input" -# Harness-generated turns (subagent/task notifications) are not user -# requests — never fire on them (CLAUDE.global.md trigger = a design/UI *request*). +# Harness-generated turns (task notifications, sub-agent hand-backs: 857 of +# 2,779 logged fires on 2026-10-28) are not user requests — never fire on +# them (the Design work trigger = a design/UI *request*). case "$prompt" in - ''*) exit 0 ;; + ''*|'> "$logf" 2>/dev/null || true cat <<'EOF' -Design work detected → apply global CLAUDE.md section "Design work — full toolchain" (already in context). Trivial (≤2 files, cosmetic) → /hotfix. +Design work detected → Read ~/.claude/rules/web-building.md § "Design work — full toolchain" first. Trivial (≤2 files, cosmetic) → /hotfix. EOF fi diff --git a/lib/design-gate.md b/lib/design-gate.md index c515db2..40d3b0a 100644 --- a/lib/design-gate.md +++ b/lib/design-gate.md @@ -45,8 +45,9 @@ design-review, design-consultation, the `21st` CLI and `21st-ui-build` — the canary for the whole 21st skill pack). The profile also bundles browser/plan/shotgun tooling and graphify for convenience; those never trip the gate. Motion (`design-motion-principles`) and static-HTML (`design-html`) are -already in the core set — checked regardless; their CLAUDE.md "+motion / -+static" notes say which tool you'll lean on, not a separate activation step. +already in the core set — checked regardless; the Design work section +(`rules/web-building.md`) names them as the motion and static tools, not a +separate activation step. `site-motion` (personal skill, site-level scroll/page choreography) rides the same Build chain but isn't on the GATE-BLOCK list: it ships with the repo, nothing to install or verify. diff --git a/lib/tests/design-toolchain-reminder.test.sh b/lib/tests/design-toolchain-reminder.test.sh index 53977cb..69df979 100644 --- a/lib/tests/design-toolchain-reminder.test.sh +++ b/lib/tests/design-toolchain-reminder.test.sh @@ -2,6 +2,12 @@ # lib/tests/design-toolchain-reminder.test.sh set -u H="$(cd "$(dirname "$0")/../.." && pwd)/hooks/design-toolchain-reminder.sh" +# Every hook call runs under a throwaway HOME (the fire log is +# $HOME/.claude/logs/design-toolchain-fires.log): the suite never writes the +# real one (1,770 of 2,779 logged fires were this suite's prompts, 2026-10-28). +T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT +export HOME="$T" +LINE='Design work detected → Read ~/.claude/rules/web-building.md § "Design work — full toolchain" first. Trivial (≤2 files, cosmetic) → /hotfix.' pass=0; fail=0 check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1)); printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; } @@ -23,6 +29,7 @@ check D8-dash-file "$(fire 'ecc_dashboard.py')" quiet check D9-tasknotif "$(fire ' x add css header fonts')" quiet check D10-notif-file "$(fire ' design-motion-principles keyframe done')" quiet check D11-bare-ux "$(fire 'changement ux vu de tes trouvailles')" quiet +check D12-agent-msg "$(fire ' [Subagent hand-back] add css header fonts')" quiet # --- Real UI signals must still FIRE --- check F1-button "$(fire 'add a button')" fire @@ -35,6 +42,12 @@ check F7-admin-dash "$(fire 'admin dashboard screen')" fire check F8-animation "$(fire 'add an animation')" fire check F9-designsys "$(fire 'our design system')" fire check F10-bare-ui "$(fire 'revois l'\''ui du panneau admin')" fire +check F11-pasted "$(fire ' add a button')" fire + +# --- The one-liner is a contract (LRN-104): exact text --- +check O1-exact-line "$(printf '{"prompt":"add a button"}' | bash "$H")" "$LINE" +# the fires above landed in the throwaway HOME, positively (not a global count) +check G1-fires-in-temp-home "$([ -s "$T/.claude/logs/design-toolchain-fires.log" ] && echo yes)" yes # --- Fire is logged (time + token + excerpt) --- tmp="$(mktemp -d)" diff --git a/lib/tests/effort-routing.test.sh b/lib/tests/effort-routing.test.sh index 4743217..902865f 100755 --- a/lib/tests/effort-routing.test.sh +++ b/lib/tests/effort-routing.test.sh @@ -210,7 +210,7 @@ has "agents/client-handover-writer.md" 'ROUTING: follow $HOME/.claude/lib/effort # ── (f) doctrine includes ──────────────────────────────────────────────── has "lib/model-gate.md" 'mcp__model-router__route' has "lib/effort-shift.md" 'ToolSearch' -has "CLAUDE.global.md" 'route to `reflect` (high) through their' +has "rules/web-building.md" 'route to `reflect` (high) through their' # ── (g) session default and hooks (unchanged locks) ────────────────────── has "settings.json" '"effortLevel": "high"' diff --git a/rules/web-building.md b/rules/web-building.md index 809a0b4..76cfcdc 100644 --- a/rules/web-building.md +++ b/rules/web-building.md @@ -43,3 +43,26 @@ compressed images. Report the missing items to the user instead of inventing them. Internal tools and dashboards: only the relevant items apply. Deep audits stay with /seo, /harden, /web-validate. + +## Design work — full toolchain (tiered by scope) +Trigger = UI work: editing a component/style file (.tsx/.vue/.svelte/.css…) +or a design/UI request, not the word "design" alone. Single source for +design routing; the design-toolchain hook reinforces it. +- Trivial (≤2 files, one cosmetic value) → /hotfix, no toolchain. +- Build UI (component, page, redesign) → impeccable (build path: init, + shape, new-work, craft floor, fresh finish reviewer) + ui-ux-pro-max + + 21st-ui-build (catalog + generation) + emil-design-eng (polish) + + design-motion-principles (motion) + design-html (static) + site-motion. + Floor: `impeccable detect ` (61 rules, exit 2). frontend-design + only for a one-off visual with no project context, not beside impeccable. +- Design system / brand → design-consultation first, then the build tools. +- Review / audit → design-review + emil-design-eng + design-motion-principles + + /impeccable audit|critique + `impeccable detect` floor. +- The vendored stack members route to `reflect` (high) through their + model-router rows (`mods/model-router`); the last rowed skill loaded + wins and an unrowed member (plugin, gstack) changes nothing. +Scope doubt → ask or default to Build, never silently skip. Gate: light +skills run `~/.claude/lib/design-gate.md`, orchestrators plugin-check. 21st = +CLI (`npm i -g @21st-dev/cli`, `21st login`), no MCP, no key; search free, +`21st get`/`generate` metered → generation, not micro-tweaks. 21st-ai / +ui-explore / ui-review are `max`-profile only.