forked from bchanot/claude
feat(skills): modern-web-guidance reads the pinned guides locally
This commit is contained in:
1 parent
8a8d77f98e
commit
9bdd07d17c
5 files changed
+88
-1
No files matched your search
@@ -138,7 +138,7 @@ while read -r _ p tier effort; do
|
|||||||
done < <(echo "$RD" | grep '^phases ')
|
done < <(echo "$RD" | grep '^phases ')
|
||||||
|
|
||||||
# ── (b) tracked skills: row exists, frontmatter effort equals the row ────
|
# ── (b) tracked skills: row exists, frontmatter effort equals the row ────
|
||||||
NO_ROW_SKILLS=" find-docs graphify impeccable model-router "
|
NO_ROW_SKILLS=" find-docs graphify impeccable model-router modern-web-guidance "
|
||||||
check_skill() {
|
check_skill() {
|
||||||
local f="$1" name phase
|
local f="$1" name phase
|
||||||
name="$(basename "$(dirname "$f")")"
|
name="$(basename "$(dirname "$f")")"
|
||||||
|
|||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# lib/tests/mwg-skill.test.sh — skills/modern-web-guidance: Read is the
|
||||||
|
# only pre-approved tool, no effort pin and no routing.json row (a row
|
||||||
|
# reroutes the main loop on load), no npx or network command in a fenced
|
||||||
|
# block, the relative link into skills-external/mwg, the disclosure
|
||||||
|
# format, a description within the listing budget.
|
||||||
|
set -u
|
||||||
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
S="$ROOT/skills/modern-web-guidance"
|
||||||
|
pass=0; fail=0
|
||||||
|
check() { if [ "$2" = 1 ]; then pass=$((pass+1)); echo "PASS $1"; else fail=$((fail+1)); echo "FAIL $1"; fi; }
|
||||||
|
fm() { awk '/^---$/{n++; next} n==1' "$S/SKILL.md"; }
|
||||||
|
check exists "$([ -f "$S/SKILL.md" ] && echo 1)"
|
||||||
|
check tools "$(fm | grep -qx 'allowed-tools: Read' && echo 1)"
|
||||||
|
check no-effort "$(fm | grep -q '^effort:' || echo 1)"
|
||||||
|
desc_len="$(fm | awk '/^description:/{f=1; next} /^[a-z-]+:/{f=0} f' | tr -s ' \n' ' ' | wc -c)"
|
||||||
|
check desc-budget "$([ "$desc_len" -gt 100 ] && [ "$desc_len" -le 400 ] && echo 1)"
|
||||||
|
fenced="$(awk '/^```/{f=!f; next} f' "$S/SKILL.md" | grep -c 'npx\|pnpx\|curl\|wget')"
|
||||||
|
check no-fenced-network "$([ "$fenced" -eq 0 ] && echo 1)"
|
||||||
|
check never-run "$(grep -q 'Never run npx' "$S/SKILL.md" && echo 1)"
|
||||||
|
check read-index "$(grep -q 'Read `mwg/INDEX.md` whole' "$S/SKILL.md" && echo 1)"
|
||||||
|
check search-root "$(grep -q '~/.claude/skills/modern-web-guidance/mwg/guides/' "$S/SKILL.md" && echo 1)"
|
||||||
|
check disclosure "$(grep -q '`Modern Web Guidance: <id>, <id>`' "$S/SKILL.md" && echo 1)"
|
||||||
|
check link-mwg "$([ -L "$S/mwg" ] && [ "$(readlink "$S/mwg")" = ../../skills-external/mwg ] && echo 1)"
|
||||||
|
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)"
|
||||||
|
echo "mwg-skill: $pass pass, $fail fail"
|
||||||
|
[ "$fail" -eq 0 ]
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
name: modern-web-guidance
|
||||||
|
description: >-
|
||||||
|
Current web-platform practice from Google's Modern Web Guidance, read
|
||||||
|
from a pinned local copy. Use FIRST, before writing or changing
|
||||||
|
front-end code: HTML, CSS, client-side JS, UI components, forms,
|
||||||
|
dialogs, layout, motion, Core Web Vitals, images, accessibility. Not
|
||||||
|
for backend, infra, build tooling or tests.
|
||||||
|
allowed-tools: Read
|
||||||
|
---
|
||||||
|
|
||||||
|
# Modern Web Guidance (local, pinned)
|
||||||
|
|
||||||
|
This folder is `~/.claude/skills/modern-web-guidance/`. Its `mwg/` holds
|
||||||
|
`INDEX.md`, one line per guide (`- <id> | <category> | <summary>`), and the
|
||||||
|
guides at `mwg/guides/<category>/<id>.md`. They are a copy of
|
||||||
|
GoogleChrome/modern-web-guidance pinned in `plugins.lock.json`;
|
||||||
|
`mwg/NOTICE.md` names the commit and the licenses. Read is the only tool
|
||||||
|
needed, nothing here touches the network.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
1. Pick: Read `mwg/INDEX.md` whole (about 210 lines) and choose the
|
||||||
|
guides whose summary matches a platform feature or UI pattern the
|
||||||
|
task uses (a modal is `dialog`, an accordion animates to intrinsic
|
||||||
|
sizes, a slow first paint is LCP). No summary fits a feature: search
|
||||||
|
`~/.claude/skills/modern-web-guidance/mwg/guides/` once with the
|
||||||
|
text-search tool at hand, else go on without a guide.
|
||||||
|
2. Read each chosen guide. Read a discipline guide (the one whose id
|
||||||
|
equals its category: `html`, `css`, `js`, `forms`, `accessibility`,
|
||||||
|
`performance`, `security`, `privacy`) only when building a new
|
||||||
|
component or page, or when no specific guide matched; they are long.
|
||||||
|
3. Cross-references: a guide line `npx -y modern-web-guidance@latest
|
||||||
|
retrieve "<id>"` names another guide. Find `<id>` in `mwg/INDEX.md`
|
||||||
|
for its category and Read `mwg/guides/<category>/<id>.md`.
|
||||||
|
Never run npx, the guidance CLI or any network command for this skill.
|
||||||
|
4. Apply: follow the guide, its fallbacks and its Baseline notes, without
|
||||||
|
adding features the task did not ask for. Where a guide and a rule of
|
||||||
|
`rules/web-building.md` 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 the plan silently.
|
||||||
|
5. Disclose: the answer that delivers the front-end change (a sub-agent:
|
||||||
|
its report) ends with one line, `Modern Web Guidance: <id>, <id>`.
|
||||||
|
Guides checked and none applied: `Modern Web Guidance: checked <topics>,
|
||||||
|
none applied`. No quotes.
|
||||||
|
|
||||||
|
## Missing copy
|
||||||
|
|
||||||
|
`mwg/INDEX.md` unreadable (the link dangles on a machine that never ran
|
||||||
|
the install): say once "Modern Web Guidance not installed, run
|
||||||
|
`make update`" and continue without it.
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../skills-external/mwg
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{"id": 1, "prompt": "Add a confirmation modal before deleting an item", "expected": "Read mwg/INDEX.md, pick dialog, Read the dialog guide, build on <dialog> per the guide, end with `Modern Web Guidance: <ids>`"},
|
||||||
|
{"id": 2, "prompt": "Make this accordion open smoothly", "expected": "Pick animate-to-intrinsic-sizes from its summary, Read it, apply its technique and fallback, disclosure line"},
|
||||||
|
{"id": 3, "prompt": "Améliore le LCP de la page d'accueil", "expected": "FR trigger: pick the LCP guides, Read them, apply fetchpriority/image guidance, disclosure line"},
|
||||||
|
{"id": 4, "prompt": "Write a SQL migration for the orders table", "expected": "Does not trigger: backend task"}
|
||||||
|
]
|
||||||
Reference in new issue
Block a user