diff --git a/lib/tests/mwg-skill.test.sh b/lib/tests/mwg-skill.test.sh index 7fbc889..9967432 100755 --- a/lib/tests/mwg-skill.test.sh +++ b/lib/tests/mwg-skill.test.sh @@ -25,5 +25,19 @@ check link-mwg "$([ -L "$S/mwg" ] && [ "$(readlink "$S/mwg")" = ../../skills-ext check tracked-link "$([ "$(cd "$ROOT" && git ls-files skills/modern-web-guidance/mwg | wc -l)" -eq 1 ] && echo 1)" check no-routing-row "$(grep -q '"modern-web-guidance"\|"chrome-extensions"' "$ROOT/mods/model-router/routing.json" || echo 1)" check prompts "$(python3 -c "import json,sys;d=json.load(open(sys.argv[1]));sys.exit(0 if len(d)>=3 else 1)" "$S/test-prompts.json" && echo 1)" +W="$ROOT/rules/web-building.md" +check rule-section "$(grep -qx '## Modern Web Guidance first' "$W" && echo 1)" +check rule-before-design "$([ "$(grep -n '^## Modern Web Guidance first' "$W" | cut -d: -f1)" -lt "$(grep -n '^## Design work' "$W" | cut -d: -f1)" ] && echo 1)" +check rule-subagent-path "$(grep -qF 'Read `~/.claude/skills/modern-web-guidance/SKILL.md` and follow it.' "$W" && echo 1)" +check rule-plan-time "$(grep -qF 'Planning front-end work runs it before the plan closes.' "$W" && echo 1)" +check rule-guide-wins "$(grep -qF 'the platform, the guide wins.' "$W" && echo 1)" +check rule-no-silent "$(grep -qF 'reports it as an open choice, never overrides it silently.' "$W" && echo 1)" +check rule-disclosure-scope "$(grep -qF 'An answer that delivers a front-end change ends with' "$W" && echo 1)" +check motion-line "$(grep -q '^- Motion: transform and opacity for continuous or scroll-linked motion,$' "$W" && echo 1)" +check motion-old-gone "$(grep -q 'transform and opacity only' "$W" || echo 1)" +check design-build "$(awk '/^## Design work/{p=1; next} /^## /{p=0} p' "$W" | grep -qF '`modern-web-guidance` first for the platform features it uses.' && echo 1)" +check design-heading "$(grep -qx '## Design work — full toolchain (tiered by scope)' "$W" && echo 1)" +check locked-line "$(grep -qxF -- '- The vendored stack members route to `reflect` (high) through their' "$W" && echo 1)" +check site-motion "$(grep -q '`modern-web-guidance`' "$ROOT/skills/pack-design/skills/site-motion/SKILL.md" && echo 1)" echo "mwg-skill: $pass pass, $fail fail" [ "$fail" -eq 0 ] diff --git a/rules/web-building.md b/rules/web-building.md index bf9dd6a..9e868e1 100644 --- a/rules/web-building.md +++ b/rules/web-building.md @@ -4,6 +4,18 @@ paths: ["**/*.html", "**/*.astro", "**/*.css", "**/*.scss", "**/*.tsx", "**/*.js # Web building — no default reflexes + done checklist +## Modern Web Guidance first +Before writing or changing front-end code (markup, styles, client-side +JS, components), run the `modern-web-guidance` skill: it reads Google's +pinned guides locally. No Skill tool (a sub-agent): +Read `~/.claude/skills/modern-web-guidance/SKILL.md` and follow it. +Planning front-end work runs it before the plan closes. +Where a guide and a line below disagree on how to use +the platform, the guide wins. An executor whose closed plan contradicts a guide +reports it as an open choice, never overrides it silently. +An answer that delivers a front-end change ends with +the skill's one-line disclosure. + ## Avoid unless the user asks for them - Purple gradient, purple/black, neon, washed-out pastels, rainbow. - Drop shadow on everything; the same border-radius on every element. @@ -24,9 +36,11 @@ paths: ["**/*.html", "**/*.astro", "**/*.css", "**/*.scss", "**/*.tsx", "**/*.js - Numbers: `tabular-nums`. Headings `text-wrap: balance`, body `pretty`. Long labels: truncate or line-clamp, never overflow. - One z-index scale from tokens, no arbitrary values. -- Motion: transform and opacity only; feedback under 200 ms, ease-out on - entrances, never from scale(0); `will-change` only during an active - animation; pause loops off-screen; honor `prefers-reduced-motion`. +- Motion: transform and opacity for continuous or scroll-linked motion, + other transitions per the Modern Web Guidance guides; feedback under + 200 ms, ease-out on entrances, never from scale(0); `will-change` only + during an active animation; pause loops off-screen; honor + `prefers-reduced-motion`. - Touch targets 44 px minimum; keyboard and focus per `rules/a11y.md`; status never by color alone, add text or an icon. - Errors next to the field; empty state = one clear action; destructive @@ -55,6 +69,8 @@ design routing. 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. +- Every Build, polish, motion and scroll step above consults + `modern-web-guidance` first for the platform features it uses. - 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. diff --git a/skills/pack-design/skills/site-motion/SKILL.md b/skills/pack-design/skills/site-motion/SKILL.md index be243bd..1d69582 100644 --- a/skills/pack-design/skills/site-motion/SKILL.md +++ b/skills/pack-design/skills/site-motion/SKILL.md @@ -28,6 +28,10 @@ scroll library the project already runs (LRN-141). Defaults follow `rules/web-building.md`; this skill only adds the site-level layer on top of it. +Platform features (scroll-driven animation, view transitions, animating to +intrinsic sizes, reduced motion) come from the `modern-web-guidance` skill +first: read its guide before choosing a library or a technique. + ## When to use this, not the component skills - One component's hover, tap feedback, or enter/exit → the target feels