@usesketchbook/opencode-plugin 0.0.0-stage → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -2
  3. package/dist/generated/baseline-manifest.d.ts +2 -0
  4. package/dist/generated/baseline-manifest.js +1590 -0
  5. package/dist/generated/catalog-baseline.d.ts +2 -0
  6. package/dist/generated/catalog-baseline.js +255 -0
  7. package/dist/gui-experimental.cjs +111 -0
  8. package/dist/gui.d.ts +22 -0
  9. package/dist/gui.js +34 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +20 -0
  12. package/dist/rpc.d.ts +1173 -0
  13. package/dist/rpc.js +212 -0
  14. package/dist/server/catalog.d.ts +9 -0
  15. package/dist/server/catalog.js +74 -0
  16. package/dist/server/decision-guard-hooks.d.ts +2 -0
  17. package/dist/server/decision-guard-hooks.js +57 -0
  18. package/dist/server/decision-guards.d.ts +11 -0
  19. package/dist/server/decision-guards.js +36 -0
  20. package/dist/server/engine.d.ts +6 -0
  21. package/dist/server/engine.js +38 -0
  22. package/dist/server/guard-hooks.d.ts +3 -0
  23. package/dist/server/guard-hooks.js +35 -0
  24. package/dist/server/guards.d.ts +13 -0
  25. package/dist/server/guards.js +42 -0
  26. package/dist/server/operations.d.ts +93 -0
  27. package/dist/server/operations.js +300 -0
  28. package/dist/server/permissions.d.ts +29 -0
  29. package/dist/server/permissions.js +97 -0
  30. package/dist/server/rpc.d.ts +126 -0
  31. package/dist/server/rpc.js +308 -0
  32. package/dist/server/runner.d.ts +27 -0
  33. package/dist/server/runner.js +136 -0
  34. package/dist/server/schema.d.ts +4 -0
  35. package/dist/server/schema.js +66 -0
  36. package/dist/server/tools.d.ts +2 -0
  37. package/dist/server/tools.js +176 -0
  38. package/dist/server/tui.d.ts +70 -0
  39. package/dist/server/tui.js +172 -0
  40. package/dist/shared/catalog.d.ts +52 -0
  41. package/dist/shared/catalog.js +84 -0
  42. package/dist/shared/envelope.d.ts +24 -0
  43. package/dist/shared/envelope.js +28 -0
  44. package/dist/shared/manifest.d.ts +53 -0
  45. package/dist/shared/manifest.js +135 -0
  46. package/dist/test/baseline.test.d.ts +1 -0
  47. package/dist/test/baseline.test.js +11 -0
  48. package/dist/test/catalog.test.d.ts +1 -0
  49. package/dist/test/catalog.test.js +232 -0
  50. package/dist/test/decision-guards.test.d.ts +1 -0
  51. package/dist/test/decision-guards.test.js +30 -0
  52. package/dist/test/engine.test.d.ts +1 -0
  53. package/dist/test/engine.test.js +23 -0
  54. package/dist/test/fixtures.d.ts +12 -0
  55. package/dist/test/fixtures.js +55 -0
  56. package/dist/test/guard-hooks.integration.test.d.ts +1 -0
  57. package/dist/test/guard-hooks.integration.test.js +321 -0
  58. package/dist/test/guard-hooks.test.d.ts +1 -0
  59. package/dist/test/guard-hooks.test.js +14 -0
  60. package/dist/test/guards.test.d.ts +1 -0
  61. package/dist/test/guards.test.js +24 -0
  62. package/dist/test/gui.test.d.ts +1 -0
  63. package/dist/test/gui.test.js +61 -0
  64. package/dist/test/manifest.test.d.ts +1 -0
  65. package/dist/test/manifest.test.js +86 -0
  66. package/dist/test/operations.test.d.ts +1 -0
  67. package/dist/test/operations.test.js +263 -0
  68. package/dist/test/parity.test.d.ts +1 -0
  69. package/dist/test/parity.test.js +56 -0
  70. package/dist/test/permissions.integration.test.d.ts +1 -0
  71. package/dist/test/permissions.integration.test.js +535 -0
  72. package/dist/test/permissions.test.d.ts +1 -0
  73. package/dist/test/permissions.test.js +42 -0
  74. package/dist/test/rpc.test.d.ts +1 -0
  75. package/dist/test/rpc.test.js +389 -0
  76. package/dist/test/runner.test.d.ts +1 -0
  77. package/dist/test/runner.test.js +47 -0
  78. package/dist/test/schema.test.d.ts +1 -0
  79. package/dist/test/schema.test.js +51 -0
  80. package/dist/test/tui.test.d.ts +1 -0
  81. package/dist/test/tui.test.js +226 -0
  82. package/dist/tprobe.d.ts +1 -0
  83. package/dist/tprobe.js +2 -0
  84. package/dist/tui.d.ts +10 -0
  85. package/dist/tui.js +21 -0
  86. package/dist/views/operations.d.ts +50 -0
  87. package/dist/views/operations.js +80 -0
  88. package/package.json +71 -4
@@ -0,0 +1,2 @@
1
+ import type { CatalogBaseline } from "../shared/catalog.js";
2
+ export declare const CATALOG_BASELINE: CatalogBaseline;
@@ -0,0 +1,255 @@
1
+ export const CATALOG_BASELINE = {
2
+ "source": "harness/templates/agent-catalog",
3
+ "skills": [
4
+ {
5
+ "name": "a11y-checker",
6
+ "description": "Checks Sketchbook's Lit Web Components against WCAG 2.2 AA in POUR order: native controls before ARIA, findings by user impact, axe via Storybook and the behavior specs, a live keyboard pass for composite widgets; owns the a11y-auditor brief. Trigger: writing or reviewing an interactive component, fixing an a11y finding, or auditing before stable.",
7
+ "autoinvoke": true,
8
+ "content": "# Accessibility Checker (WCAG 2.2)\n\n## When to use\n\nUse this skill when:\n\n- Writing a new interactive component (buttons, dialogs, menus, form controls).\n- Reviewing or refactoring `src/components/` code for accessibility.\n- Auditing a component against WCAG 2.2 Level A + AA before it moves to\n stable (launch [`agents/a11y-auditor.md`](agents/a11y-auditor.md)).\n- Fixing an issue flagged by axe (Storybook addon or a behavior spec), QA,\n review-rangers or a parity audit.\n\nDo not use this skill for:\n\n- Token compliance (literal colors or spacing in component CSS): that is\n the `spec-is-source` rule and checks T2/T5.\n- Contrast pairs of the theme: check T6 and the `foundations` skill own them.\n- Web Component composition or performance: use `web-components-best-practices`.\n- The document's `lang` attribute: an app-shell concern (Storybook's\n shell or the consuming app), not something a component controls.\n\nA component's `accessibility` object in\n`spec/components/<name>/contract.json` (schema:\n`spec/schemas/contract.schema.json`) is authoritative for that component:\nread it before auditing (contract-first). Form controls also follow\nthe catalog rule `rule:form-associated-controls`.\n\n---\n\n## Critical patterns\n\nThe standard is **WCAG 2.2, Level AA** (all A + AA criteria) and the\nWAI-ARIA Authoring Practices pattern the contract names.\n\n### Pattern 1: Audit in POUR order\n\n1. **Perceivable**: text alternatives, structure, contrast.\n2. **Operable**: keyboard, focus, target size, predictable interaction.\n3. **Understandable**: labels, errors, clear behavior.\n4. **Robust**: roles, names, states and relationships in the accessibility tree.\n\n### Pattern 2: Native controls first\n\nUse native elements before ARIA-built widgets; it holds inside a shadow\ntemplate as much as in light DOM.\n\n```html\n<!-- ❌ custom widget with manual ARIA -->\n<div role=\"button\" tabindex=\"0\" class=\"save-action\">Save</div>\n\n<!-- ✅ native element in the shadow template: keyboard, focus and semantics are free -->\n<button type=\"button\" part=\"button\">Save</button>\n```\n\nIf a custom widget is unavoidable, define its **role**, **keyboard\nbehavior**, **accessible name**, **state** (`aria-expanded`,\n`aria-selected`…) and **relationships** (`aria-controls`, `aria-owns`).\nNever remove a focus indicator without a visible replacement.\n\n### Pattern 3: Prioritize by user impact\n\n| Priority | Category | Examples |\n| ---------- | ----------------------------------------- | ---------------------------------------------------------------------------- |\n| **HIGH** | Blocks screen reader or keyboard entirely | Non-focusable interactive elements, missing accessible names, keyboard traps |\n| **MEDIUM** | Degrades keyboard or AT experience | Missing labels on inputs, insufficient contrast, no focus-visible style |\n| **LOW** | Best practice / informational | Non-sequential headings, missing alt on decorative images |\n\nAxe impacts map as `critical`/`serious` → HIGH, `moderate` → MEDIUM, `minor` → LOW.\n\n### Pattern 4: One finding format\n\n```text\n[SC {number}] {Finding title} — {HIGH | MEDIUM | LOW}\nLocation: {file path}:{line, if known}\nIssue: {What is wrong and why it fails WCAG}\nFix: {Specific recommended change}\n```\n\n```text\n[SC 2.1.1] Non-interactive div used as clickable element — HIGH\nLocation: src/components/card/Card.ts:34\nIssue: A <div> in the shadow template has a click listener but no role,\ntabindex or keydown handler; it can't be reached or used by keyboard.\nFix: Render a <button part=\"card\">, or add role=\"button\", tabindex=\"0\"\nand Enter/Space handling.\n```\n\n### Pattern 5: ARIA ID references don't cross a shadow boundary\n\nAn ID inside one tree (a shadow root, or light DOM) can't be referenced by\n`aria-labelledby`/`aria-describedby`/`aria-owns` from another tree\n(SB-0009 records what crosses). Forward the host's values onto the inner\ncontrol, or use the component's own `label`/`description` props.\n\n```ts\n// ❌ aria-labelledby stays on the host; the inner <button> never gets a name\n// ✅ forward on every render, so the reference resolves where it lives\nfor (const attr of ['aria-label', 'aria-labelledby', 'aria-describedby']) {\n const value = this.getAttribute(attr);\n if (value === null) this.internalButton.removeAttribute(attr);\n else this.internalButton.setAttribute(attr, value);\n}\n```\n\nWhen the label and the component are both in light DOM (a `<label>` for a\nslotted control) this doesn't apply.\n\n### Pattern 6: Composite widgets need a live keyboard pass\n\nA composite widget (tabs, toggle group, radio group, accordion, list,\nmenu, select, combobox, grid: anything composing several focusable or\nselectable parts) can't be verified for keyboard access by reading its\ntemplate or by axe. Both stay clean while the widget is unreachable: a\nknown failure is a `tabindex=\"-1\"` on the composed control, with a comment\nclaiming it stayed Tab-reachable, that left every row unreachable; only a\nperson tabbing into the live story found it.\n\nThe gate, in the real Storybook story, before the work is called done:\n\n1. Tab in from outside: focus lands on it.\n2. Keep tabbing through every interactive part: nothing skipped, no trap.\n3. With rows or options: Arrow keys (Home/End where the APG pattern has\n them) move real focus. Never trust a `tabindex` value or a comment\n about it without checking live.\n4. Enter/Space activate; Escape closes anything that opened and returns\n focus somewhere sensible, never to an element that just hid.\n\nThe behavior spec then encodes each step (`playwright-worker`).\n[`references/self-validation-checklist.md`](references/self-validation-checklist.md)\n§4 repeats it as a mandatory section.\n\n---\n\n## Decision tree\n\n```text\n<img>? → alt (1.1.1); decorative → alt=\"\" role=\"presentation\"\nIcon-only control? → aria-label on the wrapping button (1.1.1)\n<input>/<select>/<textarea>? → <label for> or the component's label prop (1.3.1)\nValidation? → aria-invalid + described error text (3.3.1)\nInteractive? → native element possible? yes: use it (Pattern 2)\n no: role + tabindex + keys + aria states (2.1.1, 4.1.2)\nClickable <div>/<span>? → <button> (2.1.1)\nOpens a popup or dialog? → aria-expanded + aria-haspopup (4.1.2)\nHost reflects aria-* into a shadow control? → forward them (Pattern 5)\nCSS removes :focus outline? → visible :focus-visible style (2.4.7)\nTarget < 24×24 CSS px? → at least 24px (2.5.8)\nHeadings out of sequence? → fix (1.3.1)\nText contrast < 4.5:1 (large < 3:1)? → fix through tokens (1.4.3)\nUI parts / focus ring < 3:1? → fix through tokens (1.4.11)\nContract stricter than WCAG? → the contract wins\nComposite widget? → live keyboard pass (Pattern 6), then spec it\nMoving to stable? → launch agents/a11y-auditor.md (Audit mode)\n```\n\n---\n\n## POUR reference\n\n### P — Perceivable\n\n**1.1 Text alternatives (1.1.1, A).** Meaningful images get `alt`;\ndecorative ones `alt=\"\"`; icon-only controls are a labeled `<button>` with\nthe icon `aria-hidden=\"true\"`.\n\n**1.3 Info and relationships (1.3.1, A).** Headings are real headings in\nsequence; every input has an associated label.\n\n**1.4 Distinguishable (1.4.3, 1.4.11, AA).**\n\n| Element | Ratio |\n| --------------------------------------------- | ------- |\n| Normal text (< 18pt or < 14pt bold) | ≥ 4.5:1 |\n| Large text (≥ 18pt or ≥ 14pt bold) | ≥ 3:1 |\n| UI components & graphical objects (SC 1.4.11) | ≥ 3:1 |\n\nComponent CSS uses its component tokens only; the semantic pairs behind\nthem are verified by check T6 (`spec/tokens/contrast.json`) in light and\ndark. Nothing may rely on color alone; handle `prefers-reduced-motion`\nand `forced-colors`.\n\n### O — Operable\n\n**2.1 Keyboard (2.1.1, 2.1.2, A).** Everything works by keyboard as the\nAPG pattern says; a non-native widget handles Enter and Space itself.\nDialogs trap focus while open and return it to the trigger on close.\n\n**2.4 Focus visible (2.4.7, AA).** Never `outline: none` without a\n`:focus-visible` replacement on the real inner control (Sketchbook\ncomponents sync `:state(focus-visible)` through `NativeControl`).\n\n**2.5 Target size (2.5.8, AA).** At least 24×24 CSS px; the contract may\nask for more.\n\n### U — Understandable\n\n**3.2 Predictable (3.2.1, 3.2.2, A).** No navigation or context change on\nfocus or on `change`; act on an explicit user action.\n\n**3.3 Input assistance (3.3.1, 3.3.2, AA).** Errors are identified in\ntext, exposed (`aria-invalid` + description), and say how to fix them.\n\n### R — Robust\n\n**4.1 Name, role, value (4.1.2, A).** Roles, states and properties stay in\nsync from JS whenever the component's state changes.\n\n| Widget | Role | Key attributes |\n| --------------- | ------------------------------ | ------------------------------------------------- |\n| Dropdown/Select | `combobox` + `listbox` | `aria-expanded`, `aria-haspopup`, `aria-selected` |\n| Modal/Dialog | `dialog` | `aria-modal`, `aria-labelledby` |\n| Tabs | `tablist` + `tab` + `tabpanel` | `aria-selected`, `aria-controls` |\n| Accordion | `button` (header) | `aria-expanded`, `aria-controls` |\n| Tooltip | `tooltip` | `aria-describedby` on trigger |\n| Alert/Toast | `alert` or `status` | `aria-live=\"assertive\"` or `\"polite\"` |\n| Progress | `progressbar` | `aria-valuenow`, `aria-valuemin`, `aria-valuemax` |\n\nVerify in Chromium's accessibility tree, across shadow roots\n(`ariaSnapshot()`, or `axNodes()` in `playwright/helpers/a11y.ts`).\n\n---\n\n## Scanning: the Storybook addon and the spec helper, no custom scanner\n\nMarkup lives in Lit `html` templates and most accessibility is dynamic\n(aria set from JS, focus, computed contrast), so a static scanner over\n`.ts` sees little. Axe on the rendered shadow DOM is the scanner; don't\nwrite another one.\n\n1. **Storybook**: `@storybook/addon-a11y` is on in `.storybook/main.ts`,\n and `.storybook/preview.ts` sets `a11y: { test: 'error' }`. Open a\n story's Accessibility panel; map each violation with Pattern 3 and file\n it with Pattern 4.\n2. **Behavior specs**: `axeViolations(page, tagName, exclude?)` in\n `playwright/helpers/a11y.ts` runs the same axe on the component's own\n subtree (composed Sketchbook components excluded by tag). Every spec\n asserts `[]` on the default story and on the stories that change\n structure, so a violation fails `npm run test:component`.\n3. Axe can't see keyboard behavior (tab order, traps, Space/Enter on\n custom widgets): verify it by hand (Pattern 6) and in the spec.\n4. **Screen reader**: stored views of Chrome's accessibility tree (names,\n roles, states, descriptions, focus, the active item), plus check S1.\n Every story has a view; a component whose keys change what is announced\n has a `screen-reader view` test in its behavior spec\n (`expectScreenReaderView`). Read a changed view before updating it.\n Limits (SB-0113): no speech, Chromium only, no position in set.\n\n---\n\n## Audit mode (before stable)\n\nGive the [audit brief](agents/a11y-auditor.md), component name, and date to\nan independent person or an authorized reviewer with fresh context. If\nneither is available, use the brief as a self-check and leave the independent\naudit pending. The reviewer may read and run tests; it never edits source,\ncontracts, tests or tokens.\nIt writes `docs/a11y-audits/<name>-<YYYY-MM-DD>.md` ending in\n`Verdict: ready` or `Verdict: not ready`. Check R1 reads that line; a\nperson who reviewed the component adds `Approved-by: <name>` below it\nbefore the status moves to stable.\n\n---\n\n## Commands\n\n```bash\nnpm run storybook # addon panel per story\nnpm run test:component -- tests/<name> # behavior spec, axe and screen-reader views included\nnpm run check # T6 contrast, R1 audit verdict\n```\n\n---\n\n## Resources\n\n- [`agents/a11y-auditor.md`](agents/a11y-auditor.md): fresh-context audit before stable.\n- [`references/wcag-checklist.md`](references/wcag-checklist.md): full Level A + AA checklist.\n- [`references/self-validation-checklist.md`](references/self-validation-checklist.md):\n area-organized self-check; §4 is the mandatory keyboard pass.\n- `playwright/helpers/a11y.ts`: `axeViolations`, `axNodes`, `expectScreenReaderView`.\n- `.storybook/main.ts`, `.storybook/preview.ts`: the a11y addon and its `test: 'error'` mode.\n- `spec/decisions/DECISIONS.md` SB-0009: what crosses shadow boundaries.\n- `rule:form-associated-controls`: form control semantics.\n",
9
+ "source": "harness/templates/agent-catalog/a11y-checker/SKILL.md",
10
+ "briefs": [
11
+ {
12
+ "name": "a11y-auditor",
13
+ "description": "Fresh-context accessibility audit of one component before it moves to stable. Reads the contract and code, runs the behavior spec and axe, probes keyboard and screen-reader semantics in Chromium, and writes a report. Never edits source.",
14
+ "tools": "",
15
+ "content": "You audit one component of this design system for WCAG 2.2 AA and the WAI-ARIA Authoring Practices pattern its contract names. You have no prior context: read the [accessibility skill](../SKILL.md), the project’s instructions, `spec/decisions/DECISIONS.md` (SB-0009 explains what crosses shadow-DOM boundaries), `spec/components/<name>/contract.json` and `contract.md`, `src/components/<name>/*`, and `playwright/tests/<name>/*`.\n\nCheck, in this order (POUR):\n1. Perceivable: contrast pairs in the contract pass in light and dark (`npm run check` T6); non-text indicators (focus ring, borders that identify a control, selected states) reach 3:1; nothing relies on color alone; `prefers-reduced-motion` and `forced-colors` are handled.\n2. Operable: every interaction works with the keyboard as the APG pattern says (Tab order, arrows, Home/End, Enter/Space, Escape where relevant); focus is always visible; target size at least 24×24px; no keyboard trap; implicit form submission where a native control would have it. For a composite widget, drive the live story with real key presses (the skill's Pattern 6); a clean template and a clean axe run don't count.\n3. Understandable: labels, descriptions and errors are exposed and announced; errors say how to fix them; behavior is predictable on focus and input.\n4. Robust: roles, names, states and relationships are correct in Chromium's accessibility tree (use Playwright `ariaSnapshot()` or CDP `Accessibility.getFullAXTree`), including across shadow roots; ID references never cross a shadow boundary; axe reports nothing (`playwright/helpers/a11y.ts`).\n\nRun: `npm run check`, `npx playwright test -c playwright/playwright.config.ts tests/<name>`, and throwaway probes under /tmp only. Never modify source, contracts, tests or tokens.\n\nWrite `docs/a11y-audits/<name>-<YYYY-MM-DD>.md`: a table of criteria (pass / fail / not applicable with evidence), then failures ranked by user impact (high, medium, low) with file:line, the criterion, how you verified it, and the fix. End with one line `Verdict: ready` or `Verdict: not ready`, then why. Check R1 reads that line; a person who reviewed the component adds `Approved-by: <name>` below it before the status moves to stable.\n",
16
+ "source": "harness/templates/agent-catalog/a11y-checker/agents/a11y-auditor.md"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "name": "component-builder",
22
+ "description": "Implement a Sketchbook Web Component from its approved contract. Use after contract authoring to follow the project's planning, test-first, token, accessibility, and parity requirements.",
23
+ "autoinvoke": true,
24
+ "content": "# Build a Sketchbook component\n\n1. **Validate the inputs.** Read `harness.config.json`, the component's contract pair and `plan.md`, the API vocabulary and relevant decisions. If the contract is missing or has blocking questions, use `contract-author` and stop. If `features.planningGate` is on, verify the approval before writing tests, stories or implementation: `npm run check -- --only=C4` must pass and the plan's frontmatter must have a `stage` past `plan`. Do not infer approval. Resume from the frontmatter's `stage`, `next` and `blocker`. Use existing components, helpers and tests as examples; ask before expanding scope into shared infrastructure or adding dependencies.\n2. **Write the story and behavior spec from the contract.** When `features.testFirst` is on, run `sketchbook evidence red <name>` before implementing. Confirm failure for the intended behavior, not a broken fixture. Cover relevant props, variants, states, events, keyboard behavior, focus, accessible names and form behavior. Use the project's Playwright helpers and axe checks; check the screen-reader view for composite keyboard interactions. Don't rewrite passing criteria simply to match implementation.\n3. **Implement the approved contract.** Follow the configured Web Component conventions: use native controls and the existing form mixins or focus controllers where applicable. Use one custom element per TypeScript file, declare compound parts in the contract, and use component tokens in SCSS. Alias component tokens to semantic tokens; add approved missing semantic tokens at the proper layer and declare applicable contrast pairs. Rebuild generated styles and exports with `npm run generate`; never edit generated outputs. Log any accessibility-driven deviation in the contract instead of silently changing the API or behavior.\n4. **Verify.** With test-first on, record `sketchbook evidence green <name>` using the same spec and test setup as red. Never write `evidence.json` yourself. Run `npm run check`, typechecking, lint and the relevant browser specs. Run broader gates when the change calls for them and report blocked or skipped checks. If the contract is wrong, fix it first and get approval for any material scope change.\n5. **Review before beta.** Compare implementation to the contract: files, tags, props, events, parts, slots, states, tokens, keyboard/accessibility behavior and spec coverage. Use the [parity review brief](agents/parity-auditor.md) with a separate reviewer when available and authorized; otherwise report the parity review as pending and identify any self-checks performed. With test-first on, run `sketchbook evidence ready <name>` after review. Record coverage and drift under web realizations; promote only after the required checks and review pass. Keep contract and registry statuses in sync. Stable requires the separate accessibility audit. In the Sketchbook source checkout, verify the catalog, public demos and configured design outputs using the maintainer workflow; installed projects follow their own documentation and design configuration.\n\nFor form controls, use `src/mixins/form-associated.ts` and `src/mixins/native-control.ts` with an existing input as a reference. Verify implicit submission, reset and validity; an error prop must set `customError` validity, and ARIA ID references do not cross shadow roots. For roving keyboard focus, start with `src/controllers/roving-focus.ts`. For stories, use the contract helpers in `src/stories/contract.ts` where applicable. Check `spec/decisions/DECISIONS.md` for the rationale and project-specific exceptions.\n\n## Shared task board (opt-in pilot)\n\nWhen the person asks for a shared task board for a new composite component or substantial edit, use the [task board template](assets/task-board.md). Keep it outside the tracked component files and leave the existing workflow unchanged. The board tracks ownership, blockers and evidence links. It does not prove approval, test results, or readiness. Skip the board for routine work.\n\nReport the checks actually run, any observed test-first failure, drift, token changes, review status and remaining work. Do not commit or publish unless asked.\n",
25
+ "source": "harness/templates/agent-catalog/component-builder/SKILL.md",
26
+ "briefs": [
27
+ {
28
+ "name": "parity-auditor",
29
+ "description": "Audits a component's Web Component implementation against its canonical contract, producing a structured aspect-by-aspect diff and action plan. Use when a component exists in code and you need to verify it still matches spec/components/<name>/contract.md.",
30
+ "tools": "",
31
+ "content": "# Parity auditor\n\nAudits a component's implementation against its **contract** — the\ncontract is the reference point, not a re-reading of what the component\n\"looks like it should do\" from the code alone. It never edits source: it\nreads, runs read-only commands, and writes only the report.\n\n## When invoked\n\n1. Read `spec/components/<name>/contract.md` (and its `contract.json`) —\n this is the reference. Its platform-neutral body is what the component\n must satisfy; its `## Realizations → Web` section (`realizations.web`\n in JSON) says how this implementation maps to it and which drift is\n already known.\n2. Read the implementation under audit: `src/components/<name>/`\n (`<Name>.ts`, `<Name>.scss`, `<Name>.stories.ts`), plus the behavior\n spec `playwright/tests/<name>/<name>.behavior.spec.ts` if present.\n3. Build a comparison table, one row per aspect the contract defines (props,\n anatomy, states, dimensions, typography, tokens, accessibility, events),\n marked ✅ matches / ⚠️ partial / ❌ diverges / ➖ not applicable.\n4. For every ⚠️/❌, write a \"Differences and action plan\" entry: what's\n wrong, and whether the fix belongs in code or in the contract — don't\n silently \"fix\" a mismatch by picking one; flag it and let a human decide\n which side is outdated. The contract is the source, so by default the\n realization is the one to fix: record it as a `realizations.web.drift`\n entry (`aspect`, `contract`, `realization`). If a divergence is actually\n intentional (e.g. a behavior that only makes sense on another platform\n the component doesn't implement), record it in the contract as a\n documented exclusion rather than treating it as a defect.\n5. Write the report as `docs/parity-audits/<name>-<YYYY-MM-DD>.md` (create\n the directory if it doesn't exist): the comparison table, then the\n differences/action plan list, then an overall verdict (matches contract\n / needs contract update / needs code fix).\n\n## Don't\n\n- Don't edit source, the contract or tests; the report is your only output.\n- Don't silently fix contract mismatches — flag them. The default is\n drift in the realization (step 4); a human decides only the ambiguous\n cases, where the contract itself may be the outdated side.\n- Don't treat this as a substitute for the `a11y-checker` skill or\n `web-components-best-practices` — this brief checks contract compliance,\n not general code quality or accessibility.\n",
32
+ "source": "harness/templates/agent-catalog/component-builder/agents/parity-auditor.md"
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "name": "contract-author",
38
+ "description": "Draft, resync, or validate a Sketchbook component contract. Use when a component has no contract or when its reference, anatomy, variant matrix, accessibility, or API has changed.",
39
+ "autoinvoke": true,
40
+ "content": "# Author a Sketchbook component contract\n\nProduce `spec/components/<name>/contract.json` and `contract.md`. This skill drafts or updates a contract; it does not implement the component.\n\n1. **Find the scope.** Read `harness.config.json`, the component registry, the contract schema in `spec/schemas/contract.schema.json`, and relevant decisions in `spec/decisions/DECISIONS.md`. Use an installed contract as a format example. Before adding a component, check whether an existing component covers the requested behavior. If it is genuinely new and the person asked you to draft it, add one `planned` entry to `spec/registry.json` if it is missing. Registration is not approval. Preview `npx sketchbook add \"<name>\" --blank --dry-run` using the registry's display name (for example, `\"Status Dot\"`), then scaffold it. For a prose-only correction, edit the existing contract and validate it without rerunning research.\n2. **Extract evidence.** Use the project's configured design reference, existing code or supplied requirements as appropriate. For the default shadcn/ui reference, consult its docs and registry for anatomy, visual behavior and variants; do not import its implementation. Use the WAI-ARIA Authoring Practices Guide for applicable keyboard and ARIA patterns. A synced design file is an output, not the contract source. Distinguish observed behavior from assumptions.\n3. **Draft both files.** Specify the API, anatomy, variants, content, states, events, interaction, accessibility, usage and realizations at the level the component needs. Use `spec/api.json` to choose canonical names; register a justified alias or extension if needed. Component tokens alias existing semantic tokens, not foundation tokens or literal values. Mark unsupported claims as proposals in prose and with `proposal: true` where the schema supports it. Record missing evidence, tokens or decisions as open questions rather than inventing values.\n4. **Validate.** Check that the JSON and Markdown agree and run `npm run check`. Review the result against the sources. Where the client supports authorized delegation, use the [extractor](agents/extractor.md), [drafter](agents/drafter.md), and [validator](agents/validator.md) briefs in order, passing evidence between phases. Otherwise do the phases in order and describe validation as a self-check.\n5. **Respect the gate.** For a new or redesigned component, if `features.planningGate` is enabled, complete `plan.md` with scope, file order, test plan, accessibility deviations and open questions with recommendations. Ask for explicit approval before any tests or implementation. Only the person records it, with `sketchbook approve <name> --by <name>` (or by telling you to run it with their name); never write the approval fields by hand. When C4 reports an approval that no longer holds, `sketchbook approve <name> --diff` classifies the change: mechanical carries by itself, editorial goes to the [change-triage](agents/change-triage.md) brief (a small model is enough), material goes to the person.\n\nReport the changed contract files, sources, unresolved proposals and check results. If an approval is needed, end with that request.\n",
41
+ "source": "harness/templates/agent-catalog/contract-author/SKILL.md",
42
+ "briefs": [
43
+ {
44
+ "name": "change-triage",
45
+ "description": "Decides whether a change the CLI classifies as editorial leaves the approved scope as it was, then carries the approval or escalates it to the person.",
46
+ "tools": "",
47
+ "content": "# Change triage\n\nPart of the [`contract-author`](../SKILL.md) skill. Run it when check C4 reports `approval does not hold` with an editorial change. It is a small reading task: if your client lets you choose, use its smallest capable model and low effort.\n\n## Input\n\nThe component name. Nothing from the conversation that started it.\n\n## Steps\n\n1. Run `npx sketchbook approve <name> --diff --json`. The CLI has already classified the change:\n - `none` or `mechanical`: stop. The approval holds or carries without you.\n - `material`: stop and escalate. Only a person approves it.\n - `editorial`: continue.\n2. `data.contractKeys` and `data.planSections` list names, not values. Compare those entries in `spec/components/<name>/approved.json` with the current `contract.json` and `plan.md`. Could a reader now expect different behavior, API, accessibility, files or tests? Answer from the changes, not from intent.\n3. If no: run `npx sketchbook approve <name> --carry --reason \"<what changed, and why the scope is unchanged>\"`. If the client blocks the command, give it to the person to run; do not change permissions. If the CLI refuses the carry, report why.\n4. If yes, or unsure: do not carry. Escalate.\n\n## Output\n\nOne line: `carried: <reason>` or `escalate: <one-sentence summary of what the person must decide>`. Do not edit the contract, the plan or their frontmatter, and never run `sketchbook approve <name> --by`.\n",
48
+ "source": "harness/templates/agent-catalog/contract-author/agents/change-triage.md"
49
+ },
50
+ {
51
+ "name": "drafter",
52
+ "description": "Writes contract.md and contract.json from the extractor's findings.",
53
+ "tools": "",
54
+ "content": "# Drafter\n\nPart of the [`contract-author`](../SKILL.md) skill. Turns `extractor.md`'s\nfindings into the actual contract files.\n\n## Input\n\n`extractor.md`'s structured findings block, plus one existing contract read\nas a template (`spec/components/button/contract.md` and `contract.json`).\n\n## What to write\n\n1. **`spec/components/<name>/contract.md`** (kebab-case `<name>`, e.g.\n `icon-button` not `icon_button`):\n - Frontmatter: `component`, `status`, `version`, `platforms`,\n `dependsOn`, `last_updated`, `source`.\n - Then `# Name` with a blockquote summary, followed by these headings in\n order: `## 1. Purpose`, `## 2. Anatomy`, `## 3. Props / API`,\n `## 4. Variant matrix`, `## 5. Roles and color`, `## 6. States`,\n `## 7. Dimensions and layout`, `## 8. Typography`,\n `## 9. Accessibility`, `## 10. Usage` (with `### Behavior`,\n `### Composition`, `### Choosing the props`, `### Do / Don't`),\n `## Realizations` (with `### Figma`, `### Web`, `### Coverage`,\n `### Known drift`), `## Open questions`, `## Spec for agents`.\n Mark every unconfirmed decision inline with `` `PROPOSAL` ``.\n - Everything before Realizations is platform-neutral: each rule gives\n its own reason, props use the contract's names, states are described\n as behavior. Design-tool properties and layers, and web mechanisms\n (shadow DOM, `::part`, custom states, mixins, CSS, file paths), go only\n into `## Realizations`, mirrored by `contract.json`'s `realizations`.\n The `### Figma` subsection stays a stub (\"not realized yet\") unless the\n component has been synced to Figma.\n - Usage carries the extractor's usage findings in full: behavior,\n composition, every use case with its examples, how to choose each\n variant or size value, and every don't with its reason and\n alternative. Never compress them into a summary. Write them as the\n contract's own guidance, platform-neutral: no \"per shadcn\", no CSS or\n file paths.\n - Closing `## Spec for agents` section — a short pointer to\n `contract.json`, never an embedded copy.\n2. **`spec/components/<name>/contract.json`** — the sole source of the\n structured spec. Top-level fields: `component`, `tag` (`sb-` prefix),\n `status`, `version`, `platforms`, `summary`, `dependsOn`, `props`,\n `anatomy`, `variantMatrix`, `content`, `events`, `states`,\n `accessibility`, `tokens`, `aiHints`, `realizations`, `openQuestions`,\n `decisions`. Populate `anatomy`, `variantMatrix` and `aiHints` whenever\n the corresponding prose section (Anatomy, Variant matrix, Usage\n Do/Don't) is written, in the same pass. `aiHints.useCases` mirrors the\n Usage section's choices, `aiHints.antiPatterns` its don'ts. `tokens`\n aliases semantic tokens only. Mark unconfirmed sub-trees with\n `\"proposal\": true`.\n3. **Open questions are only what needs an answer from someone else**\n (a missing token, a dependency without a contract, a value the owner\n must confirm). A decision the DS owner\n already took is a `PROPOSAL` in the prose, with the discarded\n alternative in one clause, never an `openQuestions` entry. Don't draft a question asking for a manual\n screen-reader pass: state in the contract what the screen-reader view must\n show (roles, names, states, the active item) instead (SB-0113).\n\n## Output\n\nThe written `contract.md` + `contract.json` files, handed to `validator.md`\ntogether with `extractor.md`'s source quotes, passed through verbatim.\n\n## Don't\n\n- Don't duplicate `contract.json`'s data back into `contract.md` — the\n \"Spec for agents\" section is a pointer, not a copy.\n- Don't leave `anatomy`/`variantMatrix`/`aiHints` out of `contract.json`\n when the matching prose section exists.\n- Don't record a decision as an open question to keep the alternative\n visible — the `PROPOSAL` clause in the prose is where the alternative\n lives.\n",
55
+ "source": "harness/templates/agent-catalog/contract-author/agents/drafter.md"
56
+ },
57
+ {
58
+ "name": "extractor",
59
+ "description": "Gathers a component's real data from shadcn/ui, the APG, the registry and existing code into structured findings; writes no contract files.",
60
+ "tools": "",
61
+ "content": "# Extractor\n\nPart of the [`contract-author`](../SKILL.md) skill. Gathers the component's\nreal data — nothing in this phase writes `contract.md`/`contract.json`\ndirectly; it produces structured findings for `drafter.md` to consume.\n\n## Input\n\n- The component name and its shadcn/ui slug, plus optionally an existing\n `.ts` implementation to infer from, or a plain description.\n- `spec/schemas/contract.schema.json` (read first, so you know the shape\n you're gathering data _for_).\n\n## Where to gather from\n\n- **shadcn/ui docs page** (`https://ui.shadcn.com/docs/components/<slug>`)\n and **registry JSON** (`https://ui.shadcn.com/r/styles/new-york-v4/<slug>.json`)\n for UI, API and visuals. Reference only; take names, variants, parts and\n look, not Tailwind/React/Radix implementation.\n- **WAI-ARIA APG** for keyboard interaction and ARIA roles/states.\n- **`spec/registry.json`** entry for the component.\n- **`spec/tokens/semantic/*.tokens.json`** for existing semantic tokens.\n- **Existing code**: read the `.ts` implementation and infer\n props/states/tokens — mark every inferred field `PROPOSAL`, matching the\n convention in `spec/components/button/contract.md`.\n- Figma is not a source.\n\n## What to gather\n\n- **props** — name, type (`text`/`boolean`/`variant`/`instanceSwap`/`slot`/`fixed`/`number`), `values`, `default`, `attribute`, `reflect`, `required`, `note`, `proposal`.\n- **content** — what the component holds and its user provides (a label, icons, nested components, free content): one entry per piece. A slot or instance-swap is a realization of a content entry, not a prop.\n- **anatomy** — the part tree: each part's `name`, `role`, `parent` (the containing part's name, or `null` for the root), `part` (the `::part` name if exposed), `optional`, `controlledBy` which prop, and the DS `component` it instances if it's a slot for another contract.\n- **variantMatrix** candidates — which props form the combinatorial grid (usually the `variant`-typed props), and any structurally invalid combination as `excludedCombinations` with a reason.\n- **events** — name, `bubbles`, `composed`, `cancelable`, `native`, `detail`.\n- **states** — name, trigger, tokens.\n- **accessibility** — `role`, `native`, `accessibleNameSource`, `formAssociation`, `targetSize`, `focusRingVisible`, `missingNameWarning`, `keyboard`, `aria`, `announcements`, `contrast` pairs, `wcag` criteria.\n- **tokens** — component layer `\"<component>.<part>\": \"{semantic.token}\"`, aliasing semantic tokens only.\n- **aiHints** candidates — a `category` (`atom`/`molecule`/`organism`, by structural complexity), `keywords` a developer might search for, and `antiPatterns` — but **only** ones grounded in the shadcn/ui docs, the APG, or something the user explicitly said. Never invent a plausible-sounding anti-pattern; if none is confirmed, leave the list empty and note it as an open question instead.\n- **usage** — behavior and composition notes, every use case with its examples, the criteria for choosing each variant or size value, the order to choose props in, and every don't with its reason and alternative. Copy it whole, not summarized; it feeds the Usage section and `aiHints.useCases`/`antiPatterns`.\n- **realizations** — kept apart from the neutral findings: the web-implementation mechanism (shadow DOM, `::part`, custom states, mixins), test coverage, and any place the existing code doesn't match the contract (`drift`: `aspect`, `contract`, `realization`). The design realization is filled only when an adapter produces it. These feed only the Realizations section.\n- **dependsOn** — other components this one instances.\n- **openQuestions** — anything that still needs an answer from someone else (a missing token, a dependency without a contract, a value the owner must confirm); don't silently guess to fill a gap. A decision the user already took during extraction is a `PROPOSAL`, not an open question.\n\n## Output\n\nA structured findings block (not prose) covering every field above, with\n`PROPOSAL`/unconfirmed items clearly flagged, handed to `drafter.md`. Keep\nthe source quotes (docs text, registry excerpts, APG pattern name) so the\nvalidator can check the contract against them.\n\n## Don't\n\n- Don't write any contract files — that's `drafter.md`'s job.\n- Don't invent token values, hex codes, or anti-patterns — leave as an open\n question if unconfirmed.\n",
62
+ "source": "harness/templates/agent-catalog/contract-author/agents/extractor.md"
63
+ },
64
+ {
65
+ "name": "validator",
66
+ "description": "Runs npm run check on the drafted contract, fixes violations and checks it against the extractor's source quotes.",
67
+ "tools": "",
68
+ "content": "# Validator\n\nPart of the [`contract-author`](../SKILL.md) skill. Confirms `drafter.md`'s\noutput is actually valid — the last gate before the contract is considered\ndone for this pass.\n\n## Input\n\nThe `contract.md` + `contract.json` files `drafter.md` just wrote (or\nedited), plus `extractor.md`'s source quotes (shadcn/ui docs text, registry\nexcerpts, APG pattern) that `drafter.md` hands forward unchanged.\n\n## Steps\n\n1. Run `npm run check` from the repo root (deterministic checks T1–T6,\n C1–C3, R1, G1).\n2. If it reports violations, fix `contract.json` (or `contract.md`)\n directly and re-run until it passes — don't hand back a failing\n contract.\n3. If `contract.md` is missing next to `contract.json`, that's a\n `drafter.md` gap — go back a step rather than silencing the warning.\n4. Check the contract against the extractor's source quotes: every\n behavior, composition, use-case and don't bullet is covered (cite\n where) and none is contradicted. Hand any missing or contradicted bullet\n back to `drafter.md`.\n5. Check the body before `## Realizations` is platform-neutral: no\n sentence justified by a design tool or code, no design-tool property\n names, no web mechanism (shadow DOM, `::part`, custom states, mixins,\n CSS selectors, file paths).\n6. Check `tokens` aliases semantic tokens only, and unconfirmed items carry\n `\"proposal\": true` / `PROPOSAL`.\n7. Report back: final validation status, the coverage table, and any\n `openQuestions` still outstanding. Then stop at the planning gate: the\n next artifact is `plan.md`, awaiting approval.\n\n## Don't\n\n- Don't mark `status: stable` unless the contract has actually been\n verified end-to-end against its implementation and tests, not just\n schema-valid.\n- Don't silently \"fix\" an open question by guessing an answer to make\n validation pass — schema validity and having no unresolved ambiguity are\n different things; only the former is this brief's job to enforce.\n",
69
+ "source": "harness/templates/agent-catalog/contract-author/agents/validator.md"
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "name": "design-figma",
75
+ "description": "Sync the design system to the Figma file (variables and modes for Mode, Shape and Density, text and effect styles, doc pages, library components) and read it back; needs the Figma MCP. Trigger: \"sync to Figma\", \"push tokens to the design file\", \"is Figma up to date\", \"check the design file\", or after tokens or contracts change.",
76
+ "autoinvoke": true,
77
+ "content": "# design-figma\n\nThe design file is an output: it is generated from `spec/` and never edited by hand. This skill runs the scripts `sketchbook sync` writes into the Figma file named in `harness.config.json` (`adapters.design.file`) and reads the file back to verify. What a doc looks like is specified once in `docs/design-docs/` and `spec/design-docs.json`; how variables, collections and modes are laid out, and the rules that keep bindings intact, are in `docs/design-docs/tool-mapping.md` (read it before the first sync).\n\n---\n\n## When to use\n\nUse this skill when:\n\n- Asked to \"sync to Figma\", \"push tokens or variables to the design file\", \"check the design file\" or \"is Figma up to date\".\n- Tokens, contracts or `spec/design-docs.json` changed and the design file must follow.\n- Asked to show or prove that the look switches (Mode, Shape, Density).\n\nDo not use this skill for:\n\n- Editing variables, styles or docs in Figma by hand: change the spec and sync.\n- Reading a Figma design into code (that is design-to-code, not this sync).\n\n---\n\n## Critical patterns\n\n### 1. Requirements (check first; explain plainly if one is missing)\n\n- The Figma MCP with `use_figma`. Load the `figma:figma-use` skill (and `figma:figma-generate-library` for library work) before the first `use_figma` call; call `create_session` with the file key once per task.\n- A file key: `SKETCHBOOK_FIGMA_FILE`, else `adapters.design.file`. The repository ships none; without one, `sketchbook sync` points to the example file to import first. Never write a key into a tracked file on the person's behalf.\n- The file must belong to a paid plan: `Semantic - Shape` has 4 modes and `Semantic - Density` 3. A Starter team allows one mode per collection; if `addMode` fails, say so and stop (`docs/research/figma-plans.md`).\n- The calls take at most 50,000 characters of code and return at most 48,000 bytes: scripts are generated to fit, verify returns digests.\n- Never write to any file other than `adapters.design.file`.\n\n### 2. One script per call, in order, never in parallel\n\n`sketchbook sync tokens` writes `generated/design/figma/variables/NN-<collection>.js` and `styles.js`, only what changed since the last `sync stamp tokens` (`--full` for everything). Pass each file's content verbatim as the `use_figma` code, in file order (later parts alias earlier ones); `sync stamp tokens` after all ran clean. `sketchbook sync pages` writes `pages.js` (page structure from the spec; creates and renames, never deletes). Each returns a report: `errors` must be empty and `extraModes` should be; stop and report on anything else. Never edit a generated script to make it pass: fix the spec or the adapter and regenerate. Library scripts (`sync library`) carry a checksum of their data and refuse to run if a paste differs by one character: copy each file exactly, build scripts first, then `finish`, then `verify` (read-only); do not hand the pasting to a sub-agent, which cannot copy 15 KB reliably. Axis and property names come from the API vocabulary (`spec/api.json`), never from contract text. How a component is built (state axes, optional parts, helper components, nesting, descriptions) follows `spec/figma-practices.json` (`sketchbook api practices`): every drawn 0 is bound to a zero token (SB-0083), and an underlined label is a second text layer on the `-underline` twin style with its own text property, never a decoration on the shared label (SB-0084), and a nested library instance with properties is exposed under its component's title and index (SB-0085), and a content region registered in `spec/api.json` `regions` is a native slot named after it (SB-0086). A component's Figma description is generated from `contract.md`, `contract.json` and the registry (`harness/lib/design/description.mjs`): `finish` sets it, `sketchbook sync describe [components]` rewrites it on sets already drawn, and `verify` compares it. Never write a description in the file; fix the contract and regenerate.\n\n### 3. Upsert only\n\nThe scripts create missing collections, modes and variables and update values in place. They never delete. A variable whose type changed is reported, not recreated (deleting unbinds every node that used it). Removing or renaming something in the file is a separate, confirmed step: ask first, name exactly what goes, then do it. Renames go through `sketchbook tokens rename`.\n\n### 4. Ask before structural changes\n\nPages, page order and deleting nodes are the person's file: say what will change and why, and wait for a yes. Work in small batches, show a screenshot of each result, and keep `docs/design-docs/progress.md` current (`sketchbook sync stamp`, `sketchbook sync progress`).\n\n### 5. Good output is the method, not our file\n\nThe person may bring their own file or start from an empty one, so never treat the reference Figma file as the target. A good output is built from the spec through the adapter and proven by read-back: generate, paste exactly, verify, screenshot, stamp. Every review remark is fixed at its source (spec, recipe or runtime), written in the ASCII spec, guarded by a test, regenerated, then applied, and the whole defect class is checked across the file. Read [the working method](references/working-method.md) before the first Figma job of a session. Patterns and components also follow `rule:figma-fidelity` (Storybook is the reference; compare before stamping `checked`).\n\n---\n\n## Decision tree\n\n```text\nRequest\n |-- page structure ---------------> sketchbook sync pages --> run pages.js\n |-- tokens changed / first sync? --> sketchbook sync tokens --> run variables/*.js in order, then styles.js\n | --> sketchbook sync stamp tokens --> verify\n |-- \"is it up to date?\" ----------> sketchbook status (offline stamp), then verify\n |-- verify -----------------------> sketchbook sync verify --> run verify.js (read-only) --> save its JSON\n | --> sketchbook sync verify --ingest <file> --> sketchbook check (D1)\n |-- library sets -----------------> sketchbook sync library <names> --> build, finish, verify --> sync layout\n |-- docs -------------------------> sketchbook sync foundations|guide|theme-matrix|components <batch>\n | --> run in order --> its verify --> screenshot --> stamp doc\n |-- review remark ----------------> references/working-method.md section 4 (fix at the source, guard, regenerate, apply)\n```\n\n---\n\n## Commands\n\n```bash\nsketchbook sync pages # writes generated/design/figma/pages.js\nsketchbook sync tokens [--full] # writes variables/*.js (changed only, or all) and styles.js; prints coverage\nsketchbook sync stamp tokens # after every script ran without errors\nsketchbook sync verify # writes generated/design/figma/verify.js (read-only)\nsketchbook sync verify --ingest <file.json> # compares every mode combination with the spec (D1)\nsketchbook sync icons # writes generated/design/figma/icons/*.js (a first script with one icon to check by eye, then batches)\nsketchbook sync library <components> # writes <name>.build-N.js, <name>.finish.js, <name>.verify.js (names come from spec/api.json); an element set is <component>/<element> (spec/api.json sets), files <component>--<element>.*\nsketchbook sync describe [components] # descriptions-N.js: sets the generated description on sets already on the Library page\nsketchbook sync verify-library [components] # verify-all.js: read-only; every variant's nodes (bindings, styles, visibility, property wiring) against the contract tokens\nsketchbook sync verify-library --ingest <file.json> # records what verify-all.js returned per set (generated/design/library-verify.json)\nsketchbook sync realize [components] # writes realizations.design: sets, coverage, complete only if read back clean and every styled token is drawn or in drift (D4)\nsketchbook sync library <name> --detail \"<variant>\" # its verify script also lists the differing nodes and fields of that variant\nsketchbook api figma <component> # axes, properties, tokens drawn and tokens the styles use that are not drawn yet\nsketchbook docs <component> [--json] # the component doc, tool-neutral (text, or the blueprint every renderer reads; docs/design-docs/components.md)\nsketchbook sync components <batch> # components-<batch>-N.js (docs on the batch's Components page, checksum-guarded) + components-<batch>-verify.js (read-only); then sync stamp doc\nsketchbook sync stamp library|doc|checked <components>\nsketchbook sync progress # writes docs/design-docs/progress.md\nsketchbook check\n```\n\n---\n\n## Resources\n\n- `references/working-method.md`: how to build in Figma from the agnostic framework, the quality bar and worked review rounds.\n- `references/screenshots/`: the approved output, one image per page plus close-ups of a doc's sections; its README says what to look for.\n- `docs/design-docs/tool-mapping.md`: Figma collections, modes, scopes, code syntax and the rules.\n- `docs/research/figma-plans.md`: what works on each Figma plan; `docs/research/figma-variables-import.md`: Figma's own export.\n- `docs/design-docs/` (README, anatomy, pages, foundations, components, themes): the doc shell.\n- `harness/adapters/design/figma/variables.mts`: the variables model and the scripts.\n- `harness/lib/design/`: tool-neutral payload, blueprints, stamp, verify and progress.\n- `spec/decisions/DECISIONS.md`: SB-0074 (doc shell), SB-0075 (Figma), SB-0076 (file organization).\n",
78
+ "source": "harness/templates/agent-catalog/design-figma/SKILL.md",
79
+ "briefs": []
80
+ },
81
+ {
82
+ "name": "forge-me-a-skill",
83
+ "description": "Create a skill, or bring an existing one in line with this repo's single skill standard: one folder per skill, the same frontmatter, the same body skeleton, and any delegated roles as briefs in the skill's own agents/ folder. Trigger: creating a new skill or agent role, porting one from another repo, or auditing a shared skill catalog for consistency.",
84
+ "autoinvoke": false,
85
+ "content": "# Forge Me a Skill\n\n## When to use\n\nUse this skill when:\n\n- A pattern recurs and an agent needs guidance to do it the same way every\n time (authoring a contract, auditing a component, roasting foundations).\n- This repo's convention differs from generic practice for a technology\n (how _we_ write a Lit component, not Lit in general).\n- A workflow has enough steps or decisions that improvising gives\n different results across sessions.\n- A skill is ported from another repo, or an existing one drifted from\n this standard.\n\nDo not use this skill for:\n\n- Something a doc or contract already covers: link it from `references/`\n or the skill's Resources, don't copy it.\n- A one-off or self-explanatory task.\n- A persistent rule with no workflow: write a separate rule.\n\n---\n\n## Critical patterns\n\n### 1. Skills own their agents\n\nA role (a fresh-context critic, an auditor, a phase of a pipeline) is a\nbrief in the skill’s `agents/` folder. A person can use the brief directly,\nor an authorized client can delegate it with the named inputs.\n\n```text\nfoundations/agents/foundations-critic.md # roast mode\ncontract-author/agents/drafter.md # phase 2 of 3\n```\n\nA brief has `name` and `description`. State its inputs, allowed actions,\nevidence and output in its body. Do not choose a model, name a client's\ntools, or assume that writing a brief grants any permissions.\n\n```markdown\n---\nname: token-mapper\ndescription: Maps imported token names onto the semantic interface; writes a proposal only.\n---\n\nYou map ... Never edit spec/ or brand.config.json.\n```\n\n### 2. One folder, one source of truth\n\n```text\n{skill-name}/\n├── SKILL.md # required: frontmatter + body, the only metadata file\n├── agents/ # role briefs this skill launches (see pattern 1)\n├── assets/ # templates, schemas, example configs\n├── references/ # local docs the skill reads on demand, never web URLs\n└── scripts/ # executable helpers\n```\n\nPut client integration code outside the portable skill. Keep discovery\nmetadata in the skill and installation relationships in the catalog.\n\n### 3. Frontmatter\n\n| Field | Required | Format | Content |\n| ------------------------ | -------- | ------------------- | --------------------------------------------------------------------------------------------- |\n| `name` | yes | `lowercase-hyphens` | The folder name. |\n| `description` | yes | string, ≤ 400 chars | What the skill does, then `Trigger: …`, specific enough not to fire on unrelated work. It is in context in every session (SB-0114). |\n\nPreserve provenance and notices for ported material.\nShipped skills are white-label: no company or product names (check W1).\n\n### 4. Body skeleton\n\nEvery `SKILL.md` body has these sections, in this order:\n\n1. `# {Title}`\n2. `## When to use`: use when / do not use for.\n3. `## Critical patterns`: the rules that matter most, first.\n4. `## Decision tree`: how to pick a path or mode.\n5. Optional extra sections the skill needs (modes, protocols, formats).\n6. `## Commands`: copy-paste commands, or a line saying there are none.\n7. `## Resources`: the files in the skill's folders and the docs it reads.\n\nStart from [`assets/SKILL-TEMPLATE.md`](assets/SKILL-TEMPLATE.md).\n\n---\n\n## Decision tree\n\n```text\nTemplate, schema or example config? -> assets/\nExecutable helper? -> scripts/\nA client-specific hook? -> a separate opt-in adapter\nLong local reference read on demand? -> references/\nA role another agent runs (fresh context, phase)? -> agents/<role>.md\nPersistent rule with no workflow? -> a catalog rule\nAlready covered by a doc or contract? -> link it, don't copy it\n```\n\nNaming:\n\n| Kind | Pattern | Examples |\n| -------------- | ------------------- | ----------------------------------- |\n| Technology | `{technology}` | `web-components-best-practices` |\n| Workflow | `{action}-{target}` | `forge-me-a-skill`, `contract-author` |\n| Tester/auditor | `{target}-{role}` | `a11y-checker`, `playwright-worker` |\n| Studio/area | `{area}` | `foundations`, `kits` |\n\n### Checklist before you finish\n\n- [ ] No catalog skill already covers it.\n- [ ] Folder name follows the naming table; `name` matches it.\n- [ ] `description` ends with a `Trigger:` clause and is at most 400 characters.\n- [ ] Body sections are present and in order.\n- [ ] Briefs define what to read, write, and return. Independent review is never claimed without separate reviewers.\n- [ ] Rules have a clear scope. Adapters don’t inject instructions on every prompt or grant permissions.\n- [ ] Any Sketchbook CLI command it names exists in `sketchbook help`.\n\n---\n\n## Commands\n\n```bash\nnpm run test:harness # in the Sketchbook source checkout\nnpm run check\n```\n\n---\n\n## Resources\n\n- [`assets/SKILL-TEMPLATE.md`](assets/SKILL-TEMPLATE.md): the starting file.\n- `agent:contract-author/drafter`: a multi-phase pipeline brief.\n- `agent:foundations/foundations-critic`: a fresh-context review brief.\n",
86
+ "source": "harness/templates/agent-catalog/forge-me-a-skill/SKILL.md",
87
+ "briefs": []
88
+ },
89
+ {
90
+ "name": "foundations",
91
+ "description": "The Foundations studio: create, change, import, restart or roast foundations (color, type, spacing, radius, elevation, motion, density, grid, icons, z-index, contrast, naming) via brand.config.json and `sketchbook tokens`. Trigger: \"pick a brand color\", \"change the type scale\", \"make it denser\", \"import our tokens\", \"roast our foundations\", a T6 or F1 failure, or \"why is this value like this\".",
92
+ "autoinvoke": true,
93
+ "content": "# Foundations\n\nFoundations are the raw decisions every component inherits. Here a team makes them its own: the default (a neutral, 4px-based system) is a starting point to edit or redo, never a requirement.\n\n## When to use\n\nUse this skill when:\n\n- The person wants to create, change, import, restart or roast foundations: color, typography, spacing and baseline grid, radius, elevation, motion, density, layout grid and breakpoints, icons, z-index, opacity, border width, contrast, semantic naming.\n- A contrast (T6) or foundations (F1) check fails.\n- The person asks why a value is what it is, or wants help choosing or comparing token names.\n\nDo not use this skill for:\n\n- Component behavior or API (use `contract-author` or `component-builder`).\n- Pages and blocks built from components (use `kits`).\n- Syncing the design file (use `design-figma`).\n- Hand-editing `spec/tokens/foundation/*` or `generated/**`.\n\n---\n\n## Critical patterns\n\n### 1. The model (say it in these words to beginners)\n\n- **brand.config.json** holds the decisions. Each foundation is either `{ \"preset\": \"<id>\" }` from the standards catalog, `{ \"custom\": … }`, or a preset plus small overrides. Its shape is `spec/schemas/brand-config.schema.json`.\n- **Foundation tokens** (`spec/tokens/foundation/*`) are generated from it. Never edit them by hand: an edit there is kept, but as a flagged *override* (see Overrides), not as a decision.\n- **Brand links** (`spec/tokens/brand-links.json`) say which semantic tokens follow which foundation (for example `color.primary` follows the brand ramp). They are applied on every regenerate.\n- **Semantic tokens** (`spec/tokens/semantic/*`) are the meaning layer (`color.primary`, `space.control.gap`, `motion.duration.fast`). They belong to the team. Components only ever see this layer, so the set of semantic tokens components depend on is the **interface** (`spec/tokens/interface.json`): change values freely, but rename only with `sketchbook tokens rename`.\n- Rule: `rule:tokens-through-the-harness`.\n\n### 2. Before any mode\n\n1. `sketchbook status` and read `brand.config.json`: what is installed and which presets are in use.\n2. `git status`: if there are uncommitted changes, suggest a commit first (git is the undo button).\n3. `sketchbook tokens overrides list`: if overrides exist, mention them; they will survive the change.\n4. `sketchbook tokens presets <area>`: the catalog's current ids, labels and sources. The references' Options tables use these ids written as `family: id` (`spacing: grid-8`); the command takes the foundation and the id separately (`sketchbook tokens preset spacing grid-8`). Ids marked \"not implemented\" are catalogued but refused, and a reference's \"Not in the catalog yet\" ideas have no id at all: express them with `custom` or `sketchbook tokens set`. The catalog wins over any reference; a guard test (`harness/test/preset-docs.test.mts`) keeps them aligned.\n\nCommands may still be landing; when unsure of an option, run `sketchbook help <cmd>` to confirm it. Every mutating command accepts `--dry-run`: use it first and show the person what will change. The dry run runs the same token checks as the real run, so a dry run that fails means the real run would be refused (and a refused real run writes nothing).\n\nEach mutating `sketchbook tokens` call that changes a file proposes its own SB decision record in `spec/decisions/DECISIONS.md` unless you pass `--no-record` (a call that changes nothing proposes none). A brand-linked semantic token edited by hand makes every token command stop until you choose: delete its entry in `spec/tokens/brand-links.json` to own the value, or re-run with `--yes` to let the link win.\n\n### 3. Roles run from this skill's agents/ folder\n\nThe `foundations-critic` and `token-mapper` briefs live in `agents/`. Use them directly or give them and the specified inputs to a separate reviewer with authorization. Follow the brief’s limits regardless of what tools are available. Disclose when a critique is not independent.\n\n### 4. Overrides (the generator keeps hand edits)\n\nA hand edit to a generated foundation token is not lost: the generator keeps it, records it in `spec/tokens/overrides.json`, and `npm run check` exits 2 (\"pass with overrides\") until it is resolved. Overrides survive later brand changes, which is exactly why they are dangerous: a value that no longer matches its preset. Resolve each one by moving it into brand.config (a `custom` value or a preset change) and then `sketchbook tokens overrides reset <path>`, or keep it deliberately and say why in a decision record. `sketchbook tokens overrides reset --all` drops them all (it asks first).\n\n### 5. Explaining a value\n\n`sketchbook explain <token | --css-var>` traces any value to its foundation, preset and source; translate the answer into plain words.\n\n### 6. Choosing token names\n\nRead [semantic naming](references/semantic-naming.md) for the workflow and the [token naming glossary](references/token-naming-glossary.md) for vocabulary. Start with one real use and offer the shipped name and one or two alternatives; explain where they would mean different things. Follow the team's established vocabulary when it expresses the same intent. If the person only wants advice, compare names without writing anything or running the change workflow.\n\n---\n\n## Decision tree\n\nPick the mode. Ask only if it is unclear; otherwise infer and say which mode you are in.\n\n| Mode | For | Signal |\n| --- | --- | --- |\n| `guided` | Beginners; anyone unsure | \"help me\", \"where do I start\", no values given |\n| `preset` | Pick standards fast | \"use an 8px grid\", \"perfect-fourth scale\", a preset id |\n| `expert` | Direct values | hex codes, px lists, cubic-beziers |\n| `import` | Tokens that already exist | a DTCG / Tokens Studio / CSS file |\n| `scratch` | Start the foundations from zero | \"start over\", \"blank\", \"redo from scratch\" |\n| `roast` | Challenge the current setup | \"roast\", \"review\", \"critique\", \"is this good?\" |\n\nAreas and their references (read the one you need, not all):\n\n| Area | Reference | Storybook page |\n| --- | --- | --- |\n| color | [references/color.md](references/color.md) | `Foundations/Color` |\n| typography | [references/typography.md](references/typography.md) | `Foundations/Typography` |\n| spacing and baseline grid | [references/spacing-grid.md](references/spacing-grid.md) | `Foundations/Spacing` |\n| radius | [references/radius.md](references/radius.md) | `Foundations/Radius` |\n| elevation | [references/elevation.md](references/elevation.md) | `Foundations/Elevation` |\n| motion | [references/motion.md](references/motion.md) | `Foundations/Motion` |\n| density | [references/density.md](references/density.md) | `Foundations/Density` |\n| layout grid and breakpoints | [references/layout-grid.md](references/layout-grid.md) | `Foundations/Layout grid` |\n| icons | [references/iconography.md](references/iconography.md) | `Foundations/Icons` |\n| z-index | [references/z-index.md](references/z-index.md) | `Foundations/Z-index` |\n| opacity | [references/opacity.md](references/opacity.md) | `Foundations/Opacity` |\n| border width | [references/border-width.md](references/border-width.md) | `Foundations/Border width` |\n| contrast | [references/contrast.md](references/contrast.md) | `Foundations/Color` (pairs and ratios) |\n| semantic naming | [semantic naming](references/semantic-naming.md) and [token naming glossary](references/token-naming-glossary.md) | every page (semantic tables) |\n\n---\n\n## Modes\n\n### guided\n\nFor beginners. One question at a time; never a form.\n\n1. Each question names the decision, gives a **recommended answer and why** in one or two plain sentences, and two or three alternatives. Take the questions from the area's reference (\"Decisions to make\"), in its order.\n2. Default order for a full pass: color → typography → spacing → radius → density → elevation → motion; then offer the rest (layout grid, icons, z-index, opacity, border width) as optional.\n3. After each answer, apply it with `--dry-run`, show what changes (in words: \"buttons get 4px taller\"), then apply for real with `--no-record` (one record per step would bury the session).\n4. If a check fails, explain the pair or rule in one sentence and offer the fix the check suggests. Never move on with a failing T6.\n5. Ask \"anything else?\" after each area; stop when the person is done, then write one summary decision record for the whole session (step 5 of \"Every session ends with\").\n\n### preset\n\n1. `sketchbook tokens presets <area>`; show a short table (id, what it is, when to pick it, source link).\n2. Recommend one for their product and say why (from the reference's \"Options\").\n3. `sketchbook tokens preset <area> <id> --dry-run`, then without `--dry-run`.\n\n### expert\n\n1. Take the values as given; check them against the reference's accessibility limits before applying, and say plainly if one breaks a limit (do not refuse; record the risk).\n2. `sketchbook tokens set <key> <value>` for single values (`sketchbook tokens set color.primary \"#0F766E\"`), or edit `brand.config.json` `{ \"custom\": … }` for a whole scale, then `npm run tokens`.\n3. For semantic-only changes (a token's value in one mode), edit `spec/tokens/semantic/<mode>.tokens.json` (team-owned) or use `sketchbook tokens add|remove`.\n\n### import\n\nBring tokens that already exist: DTCG JSON (a file or a folder of sets) or Tokens Studio export, or a CSS file with custom properties.\n\n1. Use the existing `generated/import/<name>.proposal.json` if setup already created it. Otherwise run `sketchbook tokens import <file> --from dtcg|css` to write the parsed tokens and a proposed mapping onto the semantic interface. Nothing else changes.\n2. When mappings are missing or unclear, follow the [token-mapper brief](agents/token-mapper.md) using the proposal path. It writes only an advisory `.mapping.json` under `generated/import/`. Use the glossary to compare meanings, not to substitute words.\n3. Review with the person: missing interface matches (the import would not supply a value), ambiguous candidates (ask about real usage), imported tokens with no home (offer `sketchbook tokens add` or skip), contrast of mapped color pairs, and raw values that may belong on a scale.\n4. After they agree, reflect the reviewed choices in the original `.proposal.json`; set `\"apply\": false` for unresolved entries. The CLI does not read `.mapping.json`. Run `sketchbook tokens import apply generated/import/<name>.proposal.json --dry-run`, show the preview and get approval before applying for real.\n5. If they also want their vocabulary in the interface, use the separate [rename workflow](references/semantic-naming.md). Importing a value does not rename a token.\n\n### scratch\n\nStart the foundations from zero while keeping every component working.\n\n1. Say what is kept: the semantic interface (`spec/tokens/interface.json`) — every token components and links depend on. What resets: every foundation decision in `brand.config.json`.\n2. `sketchbook tokens scratch --dry-run`, then for real. The config is now a blank questionnaire.\n3. Run `guided` (or `expert` if they bring values) over every area; T7 fails until every interface token resolves again, which is the to-do list.\n4. Renaming interface tokens is a separate, explicit step: `sketchbook tokens rename <old> <new>` (it updates semantic files, contracts, stories, specs and `.storybook`).\n\n### roast\n\nChallenge the current foundations against the standards, with evidence, risks and a recommendation.\n\n1. Follow the [foundations-critic brief](agents/foundations-critic.md) with the area (or \"all\") and today's date. For an independent critique, pass only those inputs to the reviewer. Read brand.config, the semantic tokens, the references and the checks, then write `docs/foundations-reviews/<YYYY-MM-DD>.md`.\n2. While it runs, do not form your own verdict; when it returns, read the report.\n3. Present the top findings to the person: what, evidence (file, value, the standard and its source), risk (who gets hurt and how), recommendation (a command). Separate \"breaks accessibility\" from \"a taste call\".\n4. Offer to fix the ones they accept through `guided`/`preset`/`expert`. Disagreeing with a finding is fine: record why in the decision record.\n\nThe roast questions in each reference are the prompts; ask them as questions, not as accusations.\n\n### Every session ends with\n\n1. `sketchbook tokens diff` — the CSS change per mode, in plain words.\n2. `sketchbook tokens impact <token>` for each changed semantic token — which components, contracts, stories and specs use it.\n3. `sketchbook check` — tokens (T1–T7), foundations follow their standard (F1), generated files fresh (G1). Exit 2 means passing with overrides: list them.\n4. The Storybook page: `npm run storybook`, then `Foundations/<Page>` for each area changed (light and dark).\n5. A proposed decision record in `spec/decisions/DECISIONS.md` (next free `SB-NNNN`, X1 format, listed in the index under Theme), for example:\n ```\n ### SB-NNNN · YYYY-MM-DD · Spacing moves to an 8px grid\n **Status:** proposed\n **Context:** what prompted the change (roast finding, brand, product need).\n **Decision:** the preset or values chosen, and the command that applied them.\n **Why:** the trade-off accepted, with the standard's source link.\n **Watch out:** impact (components, specs) and any accessibility limit close to the edge.\n ```\n The person changes the status to accepted.\n6. Offer to sync the design file: `/sync tokens` (and `sketchbook sync foundations` for the foundations boards), only if Figma is the configured design tool.\n\n---\n\n## Commands\n\n```bash\nsketchbook status # what is installed, presets in use\nsketchbook tokens overrides list # hand edits the generator kept\nsketchbook tokens presets <area> # catalog ids, labels, sources\nsketchbook tokens preset <area> <id> --dry-run # apply a preset (drop --dry-run for real)\nsketchbook tokens set <key> <value> # one value, e.g. color.primary \"#0F766E\"\nsketchbook tokens add|remove # semantic tokens\nsketchbook tokens rename <old> <new> # the only way to rename an interface token\nsketchbook tokens import <file> --from dtcg|css\nsketchbook tokens import apply generated/import/<name>.proposal.json --dry-run\nsketchbook tokens scratch --dry-run # reset every foundation decision\nsketchbook tokens overrides reset <path> # or --all (asks first)\nsketchbook tokens diff # CSS change per mode\nsketchbook tokens impact <token> # who uses a semantic token\nsketchbook check # T1-T7, F1, G1; exit 2 = pass with overrides\nsketchbook explain <token | --css-var> # trace a value to its source\nsketchbook sync foundations # foundations boards (planned)\nsketchbook help <cmd> # confirm options\nnpm run tokens # rebuild after editing brand.config.json\nnpm run storybook # Foundations/<Page>\n```\n\n---\n\n## Resources\n\n- `agents/foundations-critic.md`: fresh-context, read-only roast; launched by roast mode and `/roast-foundations`.\n- `agents/token-mapper.md`: maps imported names onto the semantic interface and writes a proposal only; launched by import mode and `/import-tokens`.\n- `references/*.md`: one per area (table under Decision tree); read the one you need.\n- `rule:tokens-through-the-harness`: the rule behind every mode.\n- `spec/schemas/brand-config.schema.json`: shape of `brand.config.json`.\n",
94
+ "source": "harness/templates/agent-catalog/foundations/SKILL.md",
95
+ "briefs": [
96
+ {
97
+ "name": "foundations-critic",
98
+ "description": "Fresh-context, read-only roast of the design system's foundations. Grades brand.config.json and the semantic tokens against the standards catalog, internal consistency and accessibility, then writes ranked findings with evidence to docs/foundations-reviews/<date>.md. Never edits tokens or config. Launched by the foundations skill (roast mode) and /roast-foundations.",
99
+ "tools": "",
100
+ "content": "You review one design system's foundations with no prior context and no stake in the current choices. You are told an area (`color`, `typography`, `spacing`, `radius`, `elevation`, `motion`, `density`, `layout-grid`, `icons`, `z-index`, `contrast`, `semantic-naming`, or `all`) and today's date. Do not ask the person anything; do not propose edits by writing files other than your report. Stay within the tools declared above. You never edit tokens, `brand.config.json`, `spec/` or `src/`; the only file you write is your report.\n\n## Read\n1. Project instructions, `brand.config.json`, `spec/schemas/brand-config.schema.json`.\n2. `spec/tokens/semantic/*.tokens.json`, `spec/tokens/brand-links.json`, `spec/tokens/interface.json`, `spec/tokens/contrast.json`, `spec/tokens/overrides.json` (whichever exist).\n3. The standards: `harness/standards/*.json` if present, else `docs/research/standards-draft.json`; and `docs/research/foundations-standards.md`.\n4. The area's reference in [`../references/`](../references/) (its \"Accessibility limits\" and \"Roast questions\" are your checklist).\n5. `spec/decisions/DECISIONS.md`: a choice already justified there is not a finding unless the justification is wrong or stale; cite the record.\n\n## Run (read-only commands only)\n- `npm run check -- --json` (or `node harness/checks/run.mjs --json`): T1–T7, F1, G1 results are evidence.\n- `sketchbook status`, `sketchbook tokens presets <area>`, `sketchbook tokens impact <token>`, `sketchbook explain <token>` where they exist (run `sketchbook help <cmd>` if unsure; skip a command that does not exist and say so).\n- Never run a command that writes (`tokens set|preset|add|remove|rename|import|scratch`, `init`, `sync`, `npm run tokens`, `npm run generate`), never edit a file outside `docs/foundations-reviews/`.\n\n## Grade each area\nFor each area in scope, answer the reference's roast questions with evidence, then grade:\n- **Standard fit**: which preset it follows (or how a custom value departs from the nearest one), and whether the departure is explained.\n- **Consistency**: values on the declared grid, monotonic scales, no near-duplicate semantic tokens, links resolve, overrides (each one is a finding).\n- **Accessibility**: the area's limits (contrast pairs in every mode, target size, body size and line height, reduced motion, focus visibility).\n- **Fit for the product**: only if the config or decisions say what the product is; otherwise say it is unknown.\n\n## Report\nWrite `docs/foundations-reviews/<YYYY-MM-DD>.md` (append `-2`, `-3` if it exists):\n1. One-paragraph verdict and a grade per area (A sound / B minor issues / C real risks / D breaks accessibility).\n2. **Findings, ranked** (accessibility failures first, then risks, then taste). Each finding: title; **Evidence** (file and token path or value, check id and message, the standard with its source link); **Risk** (who is hurt and how); **Recommendation** (the exact `sketchbook tokens …` command or config change, and its expected impact); **Confidence** (high/medium/low). Label taste calls as taste.\n3. What is good and should stay (short).\n4. Questions only the owner can answer.\nUse our own words; cite other systems as links, never copy their text. End with `Verdict: sound | needs work | at risk` on its own line.\n\nReturn to the caller: the report path, the verdict, and the top three findings in one line each.\n",
101
+ "source": "harness/templates/agent-catalog/foundations/agents/foundations-critic.md"
102
+ },
103
+ {
104
+ "name": "token-mapper",
105
+ "description": "Maps imported token names (DTCG / Tokens Studio, CSS custom properties) onto Sketchbook's semantic interface by meaning, and writes the result only as a proposal file under generated/import/. Never applies it and never edits spec/ or brand.config.json. Launched by the foundations skill (import mode) and /import-tokens.",
106
+ "tools": "",
107
+ "content": "You map a team's existing tokens onto this design system's semantic interface. You are given an import proposal (`generated/import/<name>.proposal.json`, written by `sketchbook tokens import`) or, if it does not exist yet, the source file and its format. You have no prior context. Stay within the tools declared above.\n\n## Read\n1. `spec/tokens/interface.json` (the semantic tokens components and links depend on; if missing, take every token path in `spec/tokens/semantic/*.tokens.json`).\n2. `spec/tokens/semantic/*.tokens.json` (`$description` explains each role), `spec/tokens/contrast.json`.\n3. The [semantic naming reference](../references/semantic-naming.md) for the workflow and the [token naming glossary](../references/token-naming-glossary.md) for vocabulary. Alternatives in the glossary are clues, not replacement rules.\n4. The proposal (or the source file). Note its modes or themes (light/dark, brands). If the proposal lacks usage context, read the original input named in `source.file` when available: the proposal does not carry source token descriptions. If the source still doesn't explain the role, ask how the token is used.\n\n## Map\nFor every interface token, find the imported token that carries the same **meaning** (how it is used, its name, its description, its place in a theme), not merely a similar value:\n- `match`: one clear source; give it.\n- `candidates`: one or more plausible but unconfirmed sources; rank them when there are several and ask what would decide. If `active` is plausible but you can't tell if it means pressed, selected, or current, do not mark it as a match.\n- `missing`: nothing fits; suggest the foundation step or preset that would supply it.\nFor every imported token with no interface home:\n- raw scale (`blue-500`, `spacing-4`, `radius-md`) → `foundation-candidate` with the brand.config field it informs (a preset id from `harness/standards/` or a custom scale);\n- a role the interface lacks → `new-semantic` with a proposed name consistent with the destination project's vocabulary and a contrast pair where applicable (to be added with `sketchbook tokens add`);\n- noise or one-off → `drop`, with why.\nFor color pairs you map, compute or estimate the contrast per mode when values are concrete, and flag any that would fail.\n\n## Write (the only file you write)\n`generated/import/<name>.mapping.json`:\n```json\n{\n \"source\": \"<file>\", \"format\": \"dtcg|css\", \"modes\": [\"light\", \"dark\"],\n \"interface\": { \"color.primary\": { \"status\": \"match\", \"from\": \"brand.primary\", \"confidence\": \"high\", \"why\": \"used as the main button fill\" } },\n \"imported\": { \"blue-500\": { \"status\": \"foundation-candidate\", \"field\": \"color.primary\", \"why\": \"…\" } },\n \"contrast\": [{ \"pair\": \"color.primary-foreground/color.primary\", \"mode\": \"light\", \"ratio\": 4.8, \"ok\": true }],\n \"questions\": [\"…\"]\n}\n```\nNever write to `spec/`, `brand.config.json`, `src/` or anywhere outside `generated/import/`. Don't change the original `.proposal.json`; the Foundations workflow records the user's reviewed decisions there. Your `.mapping.json` is advisory and not accepted by `import apply`. Never apply or rename tokens yourself.\n\nReturn to the caller: the mapping path, counts (matched, candidates, missing, new, dropped), contrast failures, and the open questions.\n",
108
+ "source": "harness/templates/agent-catalog/foundations/agents/token-mapper.md"
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "name": "hammock",
114
+ "description": "\"Apply a decision ladder before non-trivial changes, review a diff for over-engineering, or audit simplicity debt. Trigger: decision ladder, complexity review, or simplicity audit.\"",
115
+ "autoinvoke": false,
116
+ "content": "# Hammock\n\n## When to use\n\nUse before a non-trivial change, when reviewing complexity, or when logging a deliberate simplification. The workflow is advisory; never edit files merely because an audit reports a smell.\n\n## Critical patterns\n\nBefore writing code, read [the decision ladder](assets/DECISION-LADDER.md) and stop at the first step that answers the design question. State what you can reuse and what you’re deliberately not building. Never trade away validation, security, accessibility, or contract requirements.\n\n## Decision tree\n\n- **Lite / full / ultra:** apply the ladder to the proposed work. Full applies it throughout the task. Ultra also questions speculative requirements; it does not override explicit user requirements. Default to full unless the user asks for another mode.\n- **Review:** inspect the actual diff, including uncommitted changes when they are in scope. Report avoidable abstractions, duplicated helpers, dead options, and unnecessary dependencies. Name the file, skipped ladder step, and smallest fix. Don’t make review changes without approval.\n- **Audit:** run the bundled `scripts/audit-simplicity.sh` with Bash from the design-system root. Treat the script’s findings as leads, not failures.\n- **Debt / gain:** use the [debt-log template](assets/DEBT-LOG-TEMPLATE.md) if asked to record a simplification; give a short recap if asked what the work avoided.\n- **Off:** skip the ladder, not required checks.\n\nUse the mode requested in the conversation, otherwise read `.sketchbook/hammock.json` if present and use its `defaultMode`. The installed file starts with `null`, which means no project override: use `full` unless the client supplies a legacy default. Installing the Hammock module keeps existing settings and does not activate hooks.\n\n## Commands\n\nFrom the design-system root, run `bash .agents/skills/hammock/scripts/audit-simplicity.sh` (or run the same script beside the skill if using a native client projection). For changed files relative to the default branch and local edits, add `--diff`.\n\n## Resources\n\n- [Decision ladder](assets/DECISION-LADDER.md)\n- [Advisory audit script](scripts/audit-simplicity.sh)\n- [Debt log template](assets/DEBT-LOG-TEMPLATE.md)\n",
117
+ "source": "harness/templates/agent-catalog/hammock/SKILL.md",
118
+ "briefs": []
119
+ },
120
+ {
121
+ "name": "kits",
122
+ "description": "Add and adapt template kits: whole pages and blocks (sign-in, settings, data table, dashboard, profile, article, empty states, form states gallery) built only from Sketchbook components and semantic tokens. Trigger: \"add a sign-in page\", \"I need a settings screen\", \"what templates are there\", \"adapt the dashboard kit\", \"remove a kit\", or after onboarding with the library+kits starter.",
123
+ "autoinvoke": true,
124
+ "content": "# Kits\n\nA kit is a page or block in `src/patterns/<kit>/`, composed only of `sb-*` components and semantic tokens. Each has stories, behavior and axe specs, a light contract `pattern.json` (which components and slots it uses, accessibility notes) and Figma boards. The catalog is `harness/kits/index.json`. Once added, a kit's files belong to the team: adapt them freely, the way you would copied-in code.\n\n## When to use\n\nUse this skill when:\n\n- The person wants a page or block: sign-in, settings, data table, dashboard, profile, article, empty states, form states gallery.\n- The person asks what templates exist, wants to adapt a kit, or wants to remove one.\n- Onboarding finished with the `library+kits` starter.\n\nDo not use this skill for:\n\n- A single component (use `sketchbook add <name>`, or `/add <Name>` for a new one).\n- A value no token expresses (use `foundations`).\n- Syncing the design file by itself (use `design-figma`).\n\n---\n\n## Critical patterns\n\n### 1. Kits use only installed components and semantic tokens\n\nUse only installed `sb-*` components and semantic tokens (`var(--sb-…)` from the semantic layer); no literal colors, sizes or z-index. A value no token expresses is a foundations question: `/foundations`. If the kit needs a component that is not installed: `sketchbook add <name>`. If no component does the job, that is a new component: `/add <Name>` (planning gate), not a one-off inside the kit.\n\n### 2. Kits are code, so the repo rules apply\n\n`test-first`, `spec-is-source`, and the `hammock` ladder. Change the kit's behavior spec first and see it fail, then change the composition.\n\n### 3. Accessibility floor for every kit\n\nLandmarks and one `h1` per page template, a logical heading order, labels on every field, error messages tied to their fields, focus order that follows reading order, and it reflows at 320px.\n\n---\n\n## Decision tree\n\n```text\nWhich kit, or what is it for? -> Add a kit\nChange an added kit? -> Adapt a kit\nDrop a kit? -> Remove a kit\nJust added or adapted one? -> Design file (offer /sync components)\n```\n\n### Add a kit\n\n1. `sketchbook kits list` (or read `harness/kits/index.json`): show each kit with what it is for and the components it needs. Recommend one for what the person is building, and why.\n2. `sketchbook kits add <kit> --dry-run`: show the files and any components it will install, then without `--dry-run`. Missing components are installed from the catalog (`sketchbook add <name>`), because a kit only uses what is installed.\n3. `sketchbook check` (patterns use only installed components and semantic tokens), then `npm run storybook` and open the kit's story in light and dark.\n\nRun `sketchbook help kits` to confirm options; if the kits commands are not built yet, `sketchbook init --start library+kits` installs all of them.\n\n### Adapt a kit\n\n1. Read the kit's `pattern.json` and its story; say what will change (copy, layout, which components, which states).\n2. Behavior first: change the kit's behavior spec (`playwright/tests/patterns/<kit>/` or the path in `pattern.json`) for the new behavior and see it fail.\n3. Change the composition in `src/patterns/<kit>/` (see Critical patterns 1).\n4. If the kit now needs a component that is not installed, or no component does the job: see Critical patterns 1.\n5. Update `pattern.json` (components, slots, accessibility notes), then `sketchbook check` and the kit's specs (`npm run test:component -- patterns/<kit>`).\n6. Accessibility: see Critical patterns 3.\n\n### Remove a kit\n\n`sketchbook kits remove <kit> --dry-run`, then for real. Components it installed stay (other things may use them); remove them separately with `sketchbook remove <name>` if wanted.\n\n### Design file\n\nKits have Figma boards; after adding or adapting, offer `/sync components` for the components it uses (the `design-figma` skill says how).\n\n### Initial kits (from the research in `docs/research/starting-points.md`)\n\nSign in / sign up, settings, data table list, dashboard overview, profile, content article, empty states and onboarding, form states gallery. Each lists its components in `harness/kits/index.json`.\n\n---\n\n## Commands\n\n```bash\nsketchbook kits list # kits and the components they need\nsketchbook kits add <kit> --dry-run # preview files and component installs\nsketchbook kits add <kit> # add the kit\nsketchbook kits remove <kit> --dry-run # preview removal (then for real)\nsketchbook add <name> # install a missing component\nsketchbook remove <name> # drop a component\nsketchbook help kits # confirm options\nsketchbook init --start library+kits # installs all kits\nsketchbook check # patterns use only installed components and semantic tokens\nnpm run storybook # open the kit's story, light and dark\nnpm run test:component -- patterns/<kit> # the kit's specs\n```\n\n---\n\n## Resources\n\n- `harness/kits/index.json`: the kit catalog and each kit's components.\n- `src/patterns/<kit>/pattern.json`: a kit's light contract.\n- `docs/research/starting-points.md`: research behind the initial kits.\n- `design-figma` skill: syncing a kit's Figma boards.\n- `foundations` skill: values no token expresses.\n",
125
+ "source": "harness/templates/agent-catalog/kits/SKILL.md",
126
+ "briefs": []
127
+ },
128
+ {
129
+ "name": "onboarding",
130
+ "description": "Welcome someone to Sketchbook and get them to a starting point: who they are, where they start, a starter via `sketchbook init --start …`, then a handoff to foundations or components. Trigger: the person is new (\"where do I start\", \"what is a token\"), runs /start or /init the first time, or asks what commands exist or what to run next (\"I'm lost\").",
131
+ "autoinvoke": true,
132
+ "content": "# Onboarding\n\nSketchbook is the first draft of a design system: every team brings its own brand and way of working, and the default is something to edit or redo, not to obey. Explain as you go, in plain words, one question at a time, each with a recommended answer and why. Assume no design-system background unless the person shows otherwise.\n\n## When to use\n\nUse this skill when:\n\n- The person is new: \"how does this work\", \"where do I start\", \"set up my design system\", \"what is a token\".\n- The person runs `/start` or `/init` for the first time, or runs `/tour`.\n- The person asks what a part of the repo is for.\n- The person asks what commands exist, what a command does, or what to run next.\n\nDo not use this skill for:\n\n- Changing foundations once a starter exists (use `foundations`).\n- Adding or designing a component (use `sketchbook add <name>` or `/add <Name>`).\n- Adding pages and blocks (use `kits`).\n\n---\n\n## Critical patterns\n\n### 1. The model in four sentences\n\n1. You describe the system in files: `brand.config.json` (foundations: color, type, spacing …), `spec/tokens/semantic/*` (what each value means, per light/dark mode) and `spec/components/<name>/contract.*` (each component's API, look and accessibility). Everything else is generated from them.\n2. Tokens come in three layers: foundation (raw values from brand.config), semantic (meaning, like `color.primary`) and component (each component's own knobs). Components only see the semantic layer, so you can redo every foundation without touching a component.\n3. Components are accessible Web Components, built test-first and documented from their contracts; template kits are whole pages built from them.\n4. `sketchbook check` proves it all fits together (contrast, layers, contracts vs code, generated files); the design file (Figma) is synced from the same source.\n\n### 2. One question at a time\n\nAsk who they are first, then where they start. Each question carries a recommendation and its reason.\n\n### 3. Explaining things\n\n- `sketchbook explain <thing>` for any token, CSS variable, component, tag or decision; translate the answer into plain words.\n- Point to files instead of repeating them: `AGENTS.md` and the project work instructions are the map; `docs/getting-started.md` is the short walkthrough.\n\n### 5. The command tour\n\nTwo surfaces: named workflows (`sketchbook harness list`, optionally invoked through a client's slash commands) and the `sketchbook` CLI. Whenever someone asks what commands exist, explain the purpose beside every name in plain words. Use the examples below and `sketchbook help <cmd>` for current options.\n\n| Slash command | What it does |\n| --- | --- |\n| `/start` | Choose a starting point and set it up |\n| `/init` | Set up or rebrand (starting point, brand, font, radius, density, prefix) |\n| `/tour` | This tour |\n| `/foundations` | Change color, type, spacing, radius, density and the rest (studio) |\n| `/add` | Install a component from the catalog, or design a new one (planning gate first) |\n| `/kits` | Add, adapt or remove page templates and blocks |\n| `/import-tokens` | Bring existing tokens in as a reviewed proposal |\n| `/check` | Run the checks and explain any failure |\n| `/explain` | Say where a token, component or decision comes from |\n| `/roast-foundations` | Critique the foundations against the standards (read-only) |\n| `/sync` | Sync variables, styles and docs to the Figma file |\n| `/swap` | Swap a token builder or design tool without touching the spec |\n\n| CLI group | What it is for |\n| --- | --- |\n| `init`, `doctor`, `status`, `upgrade` | Set up, health, what is installed, update harness files |\n| `add`, `remove`, `list`, `kits`, `brand`, `presets` | Components, template kits, brands, presets |\n| `tokens`, `generate`, `prefix`, `swap` | Foundations, rebuild generated files, rename the prefix, swap an adapter |\n| `check`, `selftest` | Deterministic checks; prove the checks can reject |\n| `explain`, `docs`, `api`, `audit-css`, `icons` | Explain a value, write docs, API standard, audit CSS, icon set |\n| `sync` | Sync to the design file |\n| `help` | Options for any command: `sketchbook help <cmd>` |\n\nCommands are read in full from `sketchbook help <cmd>`; `docs/cli.md` is the same text in one file. Do not invent commands: anything not in these tables is not a command.\n\n### 6. Changing things safely\n\n- Foundations: the `foundations` skill (`/foundations`), never by editing `spec/tokens/foundation/*` or `generated/` (rule `tokens-through-the-harness`).\n- Components: `sketchbook add <name>` from the catalog, `/add <Name>` for a new one (planning gate, then tests first), `sketchbook remove <name>` to drop one.\n- A decision changes: add a new entry to `spec/decisions/DECISIONS.md` that supersedes the old one.\n- Health: `sketchbook doctor` (starter, versions, overrides, drift); updates from a newer Sketchbook: `sketchbook upgrade --dry-run` (harness files only; team files are reported, never overwritten).\n\n---\n\n## Decision tree\n\n### 1. Who are you? (one question)\n\nAsk: \"What best describes you?\" — designer, developer, design-system lead, product person, or new to design systems. Use the answer to set the depth of explanations (designers: show Storybook and Figma early; developers: show the CLI and files; new: explain each term the first time).\n\n### 2. Where do you start? (one question, with a recommendation)\n\n| If they… | Starter | What they get |\n| --- | --- | --- |\n| want a working library now, to rebrand later | `library` (default) | All reference components, default foundations |\n| want pages to start from too | `library+kits` | The library plus template kits (sign-in, settings, data table, dashboard …) |\n| only need some components | `pick` | The chosen components and what they depend on |\n| want to settle foundations before any component | `foundations` | Foundations, their Storybook pages and Figma variables; no components yet |\n| want to design everything from zero | `blank` | A foundations questionnaire; components added one at a time |\n| already have tokens (DTCG / Tokens Studio, CSS variables) | `import` | A library and kits, plus a proposal to map their token values when they provide a file |\n| already have a product | `from-codebase` | A token proposal clustered from their CSS (colors, sizes, radii, shadows) |\n\nRecommendation logic (say it as a sentence with the reason):\n\n- They have tokens or a product → recommend the matching import starter: their decisions are already made; Sketchbook should learn them, not replace them.\n- New to design systems, no assets → `library`: they see a working system at once, and every foundation change shows on real components.\n- Design-system lead building their own → `foundations`: decide the system's raw material first, then add components deliberately.\n- Product team that needs screens fast → `library+kits`.\n- They name a few components → `pick`.\n- Only `blank` when they explicitly want to build every component themselves.\n\n### 3. Start\n\n1. Commit or stash first if the repo has changes (git is the undo button).\n2. `sketchbook init --start <starter> --dry-run`, explain what it will add, then `sketchbook init --start <starter>`. Other `init` flags (`--name`, `--primary`, `--font`, `--radius`, `--density`, `--design figma|none`, `--prefix`) can go on the same call when they already know them; otherwise leave them to the foundations studio. Run `sketchbook help init` to confirm the options for a starter (for example how `pick` takes component names, or which file `import` reads).\n3. Read the check results with them; for a contrast failure, name the pair in plain words and offer the suggested step.\n4. `sketchbook status` to show what is installed.\n\n### 4. Offer help with token names (optional)\n\nAfter setup, before the first Foundations session, offer one choice if they have not already made it: “Keep Sketchbook’s token names, bring your team’s names, or explore alternatives?” Recommend keeping the names if they’re unsure. Let them skip without delaying their next step. If they already chose the `import` starter to bring their tokens, go straight to review instead of asking again.\n\n- **Keep Sketchbook’s names:** give one concrete next step for the starter. Nothing changes, and there’s no need to ask another naming question.\n- **Bring your team’s names:** ask for a token file if they have one and take them to Foundations import review. If `init --start import --from <file>` already wrote a proposal, use it rather than running import again. Import maps values; it does not rename tokens. If they want Sketchbook to adopt their vocabulary, review an explicit rename with the Foundations skill. If they have names but no file, compare names using the next option.\n- **Explore alternatives:** use [Choosing token names](https://sketchbook-docs.vercel.app/guides/choosing-token-names/) to compare names on one component. For content on the primary button fill, Sketchbook ships `color.primary-foreground`; `color.on-primary` is a possible replacement, not a second token or a built-in alias. Do not ask people to settle a system-wide format or change anything without approval.\n\n### 5. Hand off\n\n| Starter | Next |\n| --- | --- |\n| `blank`, `foundations` | `foundations` skill, `guided` mode, all areas (color first) |\n| `library`, `library+kits` | `foundations` skill, `guided` mode for the brand (color, typography, radius, density), then `npm run storybook` |\n| `pick` | `sketchbook add <name>` for anything missing (or `/add <Name>` to design a new one), then `foundations` guided |\n| `import` | Foundations import review: open the proposal, or ask for a file to create one |\n| `from-codebase` | Review the CSS audit with Foundations, then preview any chosen values with `sketchbook tokens set`; the audit is not an import proposal |\n\nThen, when they want pages: the `kits` skill. Several brands from one system: `sketchbook brand add <name>` (run `sketchbook help brand`).\n\n---\n\n## Commands\n\n```bash\nsketchbook init --start <starter> --dry-run # preview a starter (blank|foundations|library|library+kits|pick|import|from-codebase)\nsketchbook init --start <starter> # set it up\nsketchbook help init # confirm options (pick, import, flags)\nsketchbook status # what is installed\nsketchbook explain <thing> # token, CSS variable, component, tag or decision\nsketchbook add <name> # install a component from the catalog\nsketchbook remove <name> # drop a component\nsketchbook brand add <name> # several brands from one system\nsketchbook doctor # starter, versions, overrides, drift\nsketchbook upgrade --dry-run # harness files only; team files never overwritten\nsketchbook check # prove it all fits together\nnpm run storybook # see the components\n```\n\n---\n\n## Resources\n\n- `AGENTS.md` or the project’s instructions: the map of the repo.\n- `docs/getting-started.md`: the short walkthrough.\n- `foundations` skill: next step for most starters.\n- `kits` skill: pages and blocks once components exist.\n- `design-figma` skill: syncing the Figma file.\n",
133
+ "source": "harness/templates/agent-catalog/onboarding/SKILL.md",
134
+ "briefs": []
135
+ },
136
+ {
137
+ "name": "playwright-worker",
138
+ "description": "Real-browser behavior tests for Sketchbook Web Components with Playwright against the built Storybook: keyboard, hover/focus/disabled states, events and attributes across the shadow DOM. No visual regression. Trigger: creating, updating or running Playwright tests for a component, or browser QA of its rendered states.",
139
+ "autoinvoke": true,
140
+ "content": "# Playwright Worker\n\n> **Setup:** the infrastructure lives under `playwright/` at the repo root:\n> the Playwright config, `fixtures.ts`, `helpers/` and\n> `tests/<name>/<name>.behavior.spec.ts`. Specs run against the built\n> Storybook (`npm run test:component`). There is no coverage tooling and no\n> visual regression (see \"Visual regression\" below).\n\n---\n\n## When to use\n\nUse this skill when:\n\n- Testing browser-level behavior code review can't catch: hover states,\n keyboard navigation, focus, disabled/loading states, attribute\n reflection, click/event dispatch across the shadow DOM boundary.\n- Validating a component's behavior across its Storybook story variants.\n- Doing interactive browser QA of a component's rendered states.\n\nDo not use this skill for:\n\n- Contract or schema validation (use `npm run check`).\n- Accessibility auditing as the primary method (use `a11y-checker` first;\n Playwright supplements it with real keyboard/focus behavior, it doesn't\n replace the WCAG audit).\n- Logic/unit testing: this repo has no unit test runner; don't invent one\n here as a side effect of this skill.\n\nPrerequisites:\n\n- Built Storybook: `npm run build-storybook` (the behavior specs run against\n the build; `npm run test:component` is the entry point), or `npm run\n storybook` (port 6006) for interactive work.\n- `@playwright/test` is a dev dependency (see `package.json`).\n- Chromium installed: `npx playwright install chromium` (first-time only).\n\n---\n\n## Critical patterns\n\n### 1. Story URL Construction\n\nAll tests navigate to Storybook iframe URLs via a `gotoStory()` helper —\nit navigates and waits for the target custom element to be defined and\nupgraded before assertions run (the Web Components equivalent of waiting\nfor a framework's render cycle to settle):\n\n```typescript\nimport { expect, test } from '../../fixtures';\nimport { gotoStory } from '../../helpers/storybook';\n\nawait gotoStory(page, 'components-button--default', 'sb-button');\n```\n\n`test` and `expect` come from `playwright/fixtures.ts`, not `@playwright/test`.\n\nStory ID convention: title `Components/Button` + story export `Default` →\n`components-button--default`. Multi-word story names kebab-case (`export\nconst WithIcon` with `name: \"With icon\"` → `components-button--with-icon`).\n\n### 2. Test File Naming\n\n```text\nplaywright/tests/<name>/\n└── <name>.behavior.spec.ts # click, keyboard, attribute assertions\n```\n\nOne folder per component. Component tests are TDD (`features.testFirst`):\nwrite the behavior spec first, watch it fail, then implement. Story IDs as string literals, not extracted into\nshared constants across files — each spec should read standalone.\n\nHelpers are the exception: a helper used by more than one spec, or more\nthan once in the same spec, lives in `playwright/helpers/`, parametrized\nby tag name or role instead of hard-coding one component. Check there\nbefore writing one inline:\n\n- `storybook.ts`: `gotoStory(page, storyId, tagName)`\n- `events.ts`: `countHostChanges(page, tagName)` counts bubbling,\n composed `change` events from that tag\n- `a11y.ts`: `axNodes(cdp, role)` returns `{ name, description }` for\n every node with that role in Chromium's accessibility tree;\n `axeViolations(page, tagName, exclude?)` runs axe-core on the component's\n subtree (other DS components it composes go in `exclude`: they have\n their own specs). Every new spec asserts it returns `[]` on the default\n story and on each story that changes the structure (loading, empty);\n existing specs adopt it as their component gets touched\n- `a11y.ts` also has `expectScreenReaderView(page, name)`: see pattern 7\n- `forms.ts`: `mountForm(page, markup)`, `formEntries(page)` and\n `recordEntriesOnChange(page)` (the `FormData` seen by each `change`\n listener) for form-association tests\n\n### 3. Behavior Test Structure (Given-When-Then)\n\nAssert against the real rendered shadow DOM per story. For an interactive\ncomponent like `sb-button` the structure covers focus/keyboard/click; for a\nnon-interactive one it covers attribute reflection and rendered output.\n\n```typescript\ntest.describe('Button — behavior', () => {\n test('does not fire click while disabled', async ({ page }) => {\n // Given\n await gotoStory(page, 'components-button--disabled', 'sb-button');\n // When\n await page.locator('sb-button').click({ force: true });\n // Then\n await expect(page.locator('sb-button')).toHaveAttribute('disabled', '');\n });\n});\n```\n\n### 4. Locators Pierce the Shadow DOM\n\nsketchbook Web Components render their internal markup inside an open\nshadow root (see `src/components/button/Button.ts`). Playwright's locator\nengine pierces open shadow DOM automatically — chain locators through the\nhost element rather than trying to reach into `shadowRoot` manually:\n\n```typescript\n// Host-level state (reflected attributes)\nawait expect(page.locator('sb-button')).toHaveAttribute('variant', 'primary');\n\n// Internal control state\nawait expect(page.locator('sb-button').locator('button')).toBeEnabled();\n```\n\n### 5. Click/Event Assertions Across the Shadow Boundary\n\nNative DOM events are `composed: true` by default and retarget to the host\nelement when crossing a shadow boundary, so a listener attached to the\ncustom element (not its internal markup) will still fire:\n\n```typescript\nconst clicked = page.evaluate((tag) => {\n return new Promise<boolean>((resolve) => {\n document.querySelector(tag)!.addEventListener('click', () => resolve(true), { once: true });\n });\n}, 'sb-button');\nawait page.locator('sb-button').click();\nawait expect(clicked).resolves.toBe(true);\n```\n\n### 6. Playwright MCP — Exploratory QA\n\nThe repo's `.mcp.json` configures a Playwright MCP server named\n`playwright` (`npx @playwright/mcp@<pinned>`). Use it for exploratory,\nchat-driven browser QA (navigate to a story at `http://localhost:6006`,\ninspect rendered states, take a screenshot). Anything worth keeping must be\nturned into a committed spec file under `playwright/tests/`; MCP sessions\nare not a substitute for tests.\n\n### 7. Screen-reader views\n\n`expectScreenReaderView(page, '<name>-<state>')` reads Chrome's computed\naccessibility tree (roles, names, descriptions, states, focus, the active\nitem) as text, fails on an unnamed control, and compares it with a stored\nview. Add a `screen-reader view: ...` test to the behavior spec when the\ncontract binds keys beyond Tab and Enter: press the keys, wait for the UI\nto settle, then call it once per state that changes what is announced.\n\n```typescript\nawait page.keyboard.press('ArrowDown');\nawait expectScreenReaderView(page, 'command-arrow-down');\n```\n\nViews live in `playwright/tests/<name>/__screen-reader__/<name>-<state>.txt`.\nStory views (every story of every component and kit) are written by\n`tests/screen-reader/stories.spec.ts` into `__screen-reader__/stories/`.\nA new view is written and fails once, so someone reads it.\n\n```bash\nnpm run test:component -- tests/screen-reader --update-snapshots\nnpm run test:component -- tests/<name> -g \"screen-reader view\" --update-snapshots\n```\n\nRead the view diff before updating: a changed view is a review item, not\na pass (SB-0113). Check S1 fails if a shipped component has no story views.\n\n---\n\n## Decision tree\n\n```text\nTesting rendered DOM / attribute reflection? → .behavior.spec.ts + toHaveText/toHaveAttribute\nTesting keyboard/focus/click (interactive)? → .behavior.spec.ts + keyboard/click assertions\nKeys that change what is announced? → add a screen-reader view test, see pattern 7\nTesting visual appearance? → not set up (see \"Visual regression\" below)\nWant interactive chat-driven QA? → Playwright MCP, see pattern 6\n```\n\n---\n\n## Visual regression — not set up\n\nThere is no visual regression in this repo: no `toHaveScreenshot()` specs\nand no tracked screenshot baselines. Pixel baselines are\nrendering-environment-specific (antialiasing, font hinting), so they only\nhelp when generated and diffed in one consistent environment. Don't add\nscreenshot specs as a side effect of this skill.\n\n---\n\n## Relationship to other skills\n\n| Skill | Relationship |\n| ------------------------------- | --------------------------------------------------------------------------------------------------- |\n| `web-components-best-practices` | Upstream — the composition/performance patterns Playwright verifies actually hold at runtime |\n| `a11y-checker` | Sequential — WCAG audit first, then Playwright for real keyboard/focus/ARIA validation in a browser |\n| `figma-worker` | Upstream — design states/variants inform what a component's stories should cover |\n\nPosition in the component-verification chain: after implementation and\n`a11y-checker`, as the last check that exercises the component in a real\nbrowser rather than reading its source.\n\n---\n\n## Commands\n\n```bash\n# Run the Playwright tests (runs against the built Storybook).\nnpm run test:component\n\n# Interactive Playwright UI — step-through debugging\nnpm run test:component -- --ui\n\n# Run with a visible browser — good for initial debugging\nnpm run test:component -- --headed\n\n# Open the HTML test report after a run\nnpx playwright show-report\n\n# Run tests for a single component (arguments pass through to Playwright)\nnpm run test:component -- tests/button/\n\n# Install the Chromium browser (first-time setup)\nnpx playwright install chromium\n```\n\n---\n\n## Resources\n\n- Config: the Playwright config under `playwright/`\n- Shared helpers: `playwright/helpers/` (see Critical patterns, 2: Test File Naming)\n- Storybook: `http://localhost:6006`\n- Tests: `playwright/tests/<name>/<name>.behavior.spec.ts`\n",
141
+ "source": "harness/templates/agent-catalog/playwright-worker/SKILL.md",
142
+ "briefs": []
143
+ },
144
+ {
145
+ "name": "review-rangers",
146
+ "description": "Multi-perspective review by a committee of independent lenses (security, performance, maintainability, testability, Web Components, contract/tokens, accessibility, architecture) plus a safety guard with veto, sized by risk; HIGH/MEDIUM/LOW/VETO verdict and a human-checked fix loop. Trigger: a structured review of code, contracts, architecture decisions or pull requests.",
147
+ "autoinvoke": true,
148
+ "content": "# Review Rangers\n\n## When to use\n\nUse this skill when:\n\n- A code change, contract change, architecture decision, or artifact carries\n meaningful risk.\n- A single reviewer perspective is likely to miss domain-specific edge cases.\n- You need a structured verdict, not an opinion.\n- Pull requests, contract designs, security decisions, or architecture\n changes require adversarial scrutiny.\n- A skill restructure, agent change, or spec needs cross-domain validation\n before committing.\n\nDo not use this skill for:\n\n- Trivial single-file edits with no systemic impact.\n- Tasks already covered by a domain-specific automated linter or test suite.\n- Reviews where committee overhead exceeds the risk of getting it wrong.\n\n---\n\n## Critical patterns\n\n### 1. Core workflow\n\n1. Identify the target (code, contract, decision, artifact) and its domain.\n Only use independent reviewers if the client supports delegation and the\n user and applicable project policy authorize it. People can also run the\n briefs independently. Otherwise use the lenses yourself and report a\n single-reviewer advisory: **independent verdict not assessed**. Do not\n claim an independent vote, safety guard, or approval.\n2. Determine committee size by risk: 2 members for a routine change in one\n component, contract or skill; 3 for a new component or a change across\n components; 5 only for high-risk or cross-domain targets (security, form\n association, the harness itself). Every member is a full agent with its own\n uncached context, so size is the main cost lever.\n3. Assign each member a distinct evaluation lens from the lens catalog below.\n Run them independently — no member sees another's output.\n4. Determine the expert domain for the safety guard.\n5. Spawn 1 safety guard. It evaluates the target from an authoritative\n expert position.\n6. Run the committee and safety guard in parallel: each is a general-purpose\n independent reviewer, given a brief filled from\n `assets/committee-member-template.md` or `assets/safety-guard-template.md`.\n7. Collect all outputs.\n8. Synthesize a structured verdict following the Synthesis Rules.\n9. Emit the verdict with confidence tier, top findings, and recommended\n action.\n10. **If the tier is below HIGH**, enter the **Remediation Loop (The\n Mender)** — see that section. The committee/safety guard remain\n read-only judges; the Mender executes fixes; the committee re-reviews\n after each round. The loop is bounded and escalates critical findings to\n a human.\n11. Emit the **final report** once the committee returns HIGH, or once the\n loop hits a critical stop / bound and control returns to the human.\n\n---\n\n## Decision tree\n\n```text\nIs there a safety guard blocker?\n YES -> VETO — hard block regardless of committee output\n\nDoes the safety guard pass?\n YES -> evaluate committee output\n\nDo 3+ of 5 committee members (2+ of 3, or both of 2) flag a risk?\n YES -> LOW — block and require remediation\n NO -> continue\n\nDoes any committee member flag a security or accessibility risk?\n YES -> LOW at minimum — escalate to safety guard if not already covered\n\nDoes committee majority agree the target is sound?\n YES and safety guard passes -> HIGH or MEDIUM depending on split\n (with 2 members, one flag and one pass is a split: MEDIUM)\n NO -> LOW\n```\n\n---\n\n## Committee Protocol\n\n### Size\n\n| Target Risk | Committee Size |\n| ------------------------- | -------------- |\n| Routine (one component, contract or skill) | 2 members |\n| New component, or a change across components | 3 members |\n| High-risk or cross-domain (security, form association, the harness) | 5 members |\n\n### Lens Catalog\n\nAssign lenses based on what is being reviewed. Never assign the same lens to\ntwo committee members.\n\n| Lens | What It Evaluates |\n| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **Security** | XSS vectors, injection risks, token/credential exposure, authentication, unsafe HTML rendering |\n| **Performance** | Attribute-driven re-render cost, `attributeChangedCallback`/`#render()` batching, bundle size, lazy loading |\n| **Maintainability** | Component cohesion, code clarity, naming conventions, modularity, duplication |\n| **Testability** | Behavior-spec coverage of states and edge cases (Playwright against Storybook; there is no coverage tooling), whether a Playwright behavior spec exists for the changed surface |\n| **Platform Patterns** | Attribute/slot design, composition over configuration-attribute proliferation (see `web-components-best-practices`) |\n| **Contract Compliance** | Whether the component's props/tokens/behavior match `spec/components/<name>/contract.md` + `contract.json` and validate against `spec/schemas/contract.schema.json` (`npm run check`) — not hard-coded values that drift from the contract |\n| **Accessibility** | WCAG 2.2 Level AA — keyboard access, focus indicators, ARIA roles/semantics, contrast, target size, Shadow DOM boundary concerns (see `a11y-checker`) |\n| **Motion** | GPU-safe properties, easing/duration standards, interruptibility, `prefers-reduced-motion`/hover gating, reuse-by-copy consistency across sibling components (see `motion`'s `review` mode, optional, if installed) |\n| **Architecture** | Contract integrity, repo layout, skill/agent cohesion, naming consistency (`sb-` tag prefix) |\n\n### Independence Rules\n\n- Run committee members in parallel.\n- Pass only the target artifact and the member's assigned lens as context.\n Name the target by path and line range; never paste file contents into the\n prompt.\n- Define the evidence and scope each reviewer needs. Do not select or assume a\n model; use the available, authorized review capabilities.\n- Ask each member for at most 8 findings in the template's format (about\n 1.5k tokens); synthesis needs ranked findings, not narration.\n- Do not share intermediate findings between members before synthesis.\n\n---\n\n## Safety Guard Protocol\n\n### Domain Resolution\n\n```text\nTarget is under src/components/**? -> Domain: \"Web Components + TypeScript conformance for sketchbook\"\nTarget is under spec/components/<name>/**? -> Domain: \"Component-contract schema conformance (contract-first)\"\nTarget is a skill or agent brief? -> Domain: \"sketchbook skill/agent architecture (forge-me-a-skill conventions)\"\nTarget is an architecture decision? -> Domain: \"sketchbook repo structure and conventions\"\nTarget is unclear? -> Ask before spawning\n```\n\n### Specialization\n\nThe safety guard:\n\n- Operates as an authoritative expert, not a peer reviewer.\n- Evaluates the target for correctness, safety, and conformance to domain\n standards.\n- Raises blockers, not suggestions. A structural flaw from the safety guard\n is a hard finding.\n- Runs in parallel with the committee, not after it.\n\n---\n\n## Synthesis Rules\n\n### Confidence Tiers\n\n| Tier | Condition | Recommended Action |\n| ---------- | -------------------------------------------------------------- | ------------------------------------------- |\n| **HIGH** | Safety guard passes + committee majority agrees | Approve with noted caveats |\n| **MEDIUM** | Safety guard passes + committee is split (2 members: one flags, one passes) | Approve after addressing split findings |\n| **LOW** | Safety guard raises a blocker OR committee majority flags risk | Block — require remediation before approval |\n| **VETO** | Safety guard raises a structural flaw | Hard block — do not proceed |\n\n### Contradiction Handling\n\n- Safety guard findings override committee findings on correctness and\n safety.\n- When committee members contradict each other, count lenses: majority\n rules unless a minority finding is a security or data-integrity concern.\n- A single security or accessibility finding from any voice is sufficient\n for LOW or VETO tier.\n\n### Verdict Structure\n\nEmit exactly this structure:\n\n```text\nCONFIDENCE: {HIGH | MEDIUM | LOW | VETO}\n\nSUMMARY:\n{1–2 sentences on the overall state of the target}\n\nTOP FINDINGS:\n1. [{Lens / Safety Guard}] {Finding} — {Severity: Info | Warning | Blocker}\n2. [{Lens / Safety Guard}] {Finding} — {Severity: Info | Warning | Blocker}\n...\n\nRECOMMENDED ACTION:\n{Approve | Approve with caveats | Block — remediate before resubmit | Hard block}\n```\n\n---\n\n## Remediation Loop — The Mender\n\nThe committee and safety guard **judge**; they never fix. **The Mender** is\nthe remediation worker that **executes** the fixes for findings below HIGH\nconfidence, in a controlled loop with the conversation orchestrator. The\nMender never declares confidence — the committee re-judges after every\nround. This makes the review _act_ on its own findings (deep autonomous\niteration) while keeping the human in the loop only for what is critical or\nunresolvable.\n\n### Roles (do not blur them)\n\n| Role | Reads | Writes | Decides confidence |\n| --------------------------- | ----- | --------------- | --------------------------------- |\n| Committee (Rangers) | ✅ | ❌ | contributes lens findings |\n| Safety Guard (expert) | ✅ | ❌ | VETO authority |\n| **The Mender** (worker) | ✅ | ✅ (Edit/Write) | **never** — only executes |\n| Orchestrator (conversation) | — | — | runs the loop, emits final report |\n\n### HITL Checkpoint (before The Mender acts)\n\nAfter the verdict is emitted and the tier is below HIGH, the orchestrator\nMUST pause at a **human-in-the-loop checkpoint**: present the findings and\nask the person to approve firing The Mender. A request for review is not\npermission to change files.\n\n### Loop Protocol\n\n```text\n1. Committee + Safety Guard emit tier (HIGH | MEDIUM | LOW | VETO).\n2. If HIGH → emit final report. Done.\n3. If a CRITICAL-STOP condition applies → STOP, escalate to human (no auto-fix). Done.\n4. HITL checkpoint: approve firing The Mender?\n5. The Mender remediates the open findings, then leaves the tree GREEN (see its contract below).\n6. Orchestrator re-invokes the committee + safety guard on the changed target.\n7. Tier improved to HIGH? → final report.\n Not yet, and within bounds? → back to step 3 (next round).\n Bound exhausted / stagnation? → STOP, escalate to human.\n```\n\nThe orchestrator MAY re-invoke individual committee members or the safety\nguard mid-round to help The Mender reason about a complex or ambiguous\nfinding before it acts.\n\n### The Mender's Contract (\"done\" means)\n\n- Remediates the specific findings handed to it — nothing out of scope.\n- **Leaves the working tree green** for whatever validation applies to the\n changed surface:\n - Web Components under `src/components/`: `npm run typecheck` passes.\n - Contract or spec changes under `spec/`: `npm run check` passes.\n - Behavior changes: `npm run test:component` passes.\n It does NOT return code it knows is broken for the committee to discover.\n- If it touched **testable code**, the fix carries or updates the\n component's Playwright behavior spec (`playwright/tests/<name>/<name>.behavior.spec.ts`);\n per `features.testFirst`, the spec is written first and must fail before\n the fix. Non-code findings route to their fitting verification instead\n of a behavior spec.\n- **Never declares confidence** and never edits the committee's verdict —\n it reports _what it changed_, the committee reports _whether it's now\n HIGH_.\n- Returns a structured change summary (files touched, finding→fix mapping,\n validation status).\n\n### Critical Stop — escalate to human (never auto-resolve)\n\nIf any of these holds, the loop STOPS and hands control to a human with a\nclear report — The Mender does NOT auto-resolve it:\n\n| Condition | Why it needs a human |\n| -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |\n| **VETO persists** after a remediation round | A structural flaw the AI could not clear |\n| **Security or accessibility finding at Severity: Blocker** | High user/safety impact — needs human sign-off |\n| **Breaking change to a published package's public API** | Consumer impact — requires human decision |\n| **Contract change with cascade impact** (e.g. a `spec/schemas/contract.schema.json` change affecting every component) | Affects every consumer of the contract |\n\n### Loop Bounds (termination safeguard)\n\nIndependent of the critical-stop table, the loop MUST terminate:\n\n- **Max 3 remediation rounds.** On the 3rd unresolved round → escalate to\n human.\n- **Stagnation detection:** if the same finding survives **2 consecutive\n rounds** with no progress → escalate to human (the Mender is stuck; a\n person decides).\n\n### Recursion Cut (do not nest flows)\n\n- The Mender's \"green\" is satisfied by the validation commands above and\n the targeted behavior specs — it does **not** spawn a nested review or a separate\n verification flow inside the loop.\n- Re-review is done by the **committee itself**, not by invoking this skill\n again or delegating to another review flow. This prevents an unbounded\n `review-rangers → Mender → review-rangers → …` recursion.\n\n---\n\n## Flagging Non-Obvious Findings\n\n`spec/decisions/DECISIONS.md` is this repo's standing decision log for\nthe design system — after emitting the verdict, append an entry (newest\nfirst; Context/Decision/Why/Watch out, following the log's own format)\nfor any finding that's worth remembering beyond this single review:\n\n- Confidence tier is `LOW` or `VETO`.\n- Any finding carries `Severity: Blocker`.\n- A committee member or safety guard identified a non-obvious pitfall that\n is likely to recur in future work (e.g. a subtle API misuse, a Web\n Components constraint, a contract-schema violation, a\n design-to-CSS translation gotcha).\n\nAlso call these out explicitly in the response to the user rather than\nletting them get buried in the verdict table. Not every finding belongs in\nthe log — a one-off, component-specific fix stays in that component's\n`contract.md`/code comments; the log is for patterns likely to recur\n_across_ components. If a finding instead belongs in `hammock`'s\n`docs/simplicity-debt.md` or a follow-up task, that's the user's call to\nmake, not this skill's to decide unprompted.\n\n---\n\n## Commands\n\nNo commands of its own; the Mender uses `npm run typecheck`, `npm run check` and `npm run test:component` (see The Mender's Contract).\n\n---\n\n## Resources\n\n- Committee member prompt template : [assets/committee-member-template.md](assets/committee-member-template.md)\n- Safety guard prompt template: [assets/safety-guard-template.md](assets/safety-guard-template.md)\n- The Mender (remediation worker) prompt template: [assets/mender-template.md](assets/mender-template.md)\n",
149
+ "source": "harness/templates/agent-catalog/review-rangers/SKILL.md",
150
+ "briefs": []
151
+ },
152
+ {
153
+ "name": "security-guardian",
154
+ "description": "Advisory repository-security checks (secrets, npm audit, lockfile integrity, sensitive files) with a GO / REVIEW NEEDED report; never blocks. Trigger: before committing or pushing, adding or upgrading a dependency, a PR touching package files, `.env*`, CI, git hooks or agent settings, or \"is this safe to commit / merge / publish?\".",
155
+ "autoinvoke": true,
156
+ "content": "# Security Guardian\n\n## When to use\n\nUse this skill when:\n\n- Doing an advisory security dry-run before `git commit` or `git push`.\n- Adding, upgrading, or reviewing a dependency in `package.json` or\n `package-lock.json`.\n- Reviewing a PR that touches dependency manifests, `.env*` files, CI\n config, git hooks, or agent skill, hook, or permission changes.\n- Someone asks \"is this safe to commit / merge / publish?\"\n\nDo NOT use this skill for:\n\n- Fixing the flagged issue yourself without saying so: report first, then\n ask before removing secrets from history, rotating keys, or bumping deps.\n- Blocking a commit or push autonomously. `.githooks/pre-commit` and\n `pre-push` run `sketchbook check`, not this skill; it is report-only.\n- Code-level review of XSS, injection or unsafe HTML rendering in\n components: that is the Security lens of `review-rangers`.\n- Full SCA/SBOM generation, license-compliance auditing, or penetration\n testing: flag the need, don't attempt to build that here.\n\n---\n\n## Critical patterns\n\n### 1. Advisory-only contract\n\nThis skill **never** blocks a commit or push and **never** exits non-zero\nin a way meant to halt anything. It always finishes with a report so a\nhuman decides. A real blocking gate (a git hook or CI job) is a separate,\nexplicit decision, not something this skill introduces on its own.\n\n### 2. Dependency audit\n\n```bash\nnpm audit\n```\n\n### 3. Secret scanning: dedicated tool first, grep fallback always\n\n```bash\n# Preferred, if installed:\ngitleaks detect --no-banner --source . --redact\n# or\ntrufflehog filesystem . --only-verified\n\n# Fallback (always run it too, since dedicated tools aren't installed\n# everywhere): a pattern scan over the diff, not the whole tree.\ngit diff --cached -U0 | grep -nEi \\\n '(api[_-]?key|secret|token|password|private[_-]?key|BEGIN (RSA|EC|OPENSSH) PRIVATE KEY)\\s*[:=]\\s*[\"\\x27]?[A-Za-z0-9/+_=-]{12,}'\n```\n\nNever print the matched secret value itself in the report: quote only the\nfile path, line number, and the variable name or pattern that matched.\n\n### 4. Scope detection\n\n```bash\n# Default branch (origin/HEAD, falling back to main)\nBASE=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@'); BASE=${BASE:-main}\n\n# Pre-commit (staged files only)\ngit diff --cached --name-only --diff-filter=ACMR\n\n# Pre-push / PR review (full branch changes vs. the default branch)\ngit diff --name-only --diff-filter=AM \"$BASE\"...HEAD\n```\n\nClassify each changed path:\n\n| File pattern | Gate bucket |\n| --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |\n| `package.json`, `package-lock.json` | js-deps |\n| `.env*`, `.npmrc`, `**/*.pem`, `**/*.key`, and agent or tool configuration that can contain credentials | secrets-sensitive |\n| CI, Git hooks, or agent instructions, skills, and configuration (for example `.agents/`, `.claude/`, `.codex/`, `.opencode/`, and `.github/hooks/`) | ci-config |\n| everything else | secret-scan only |\n\nIf bucket `js-deps` is empty, skip the dependency audit gate and report\n\"no dependency manifest changes: audit skipped.\"\n\n### 5. Gate ordering\n\nAlways run in this order, and never abort early; collect every result\nbefore reporting:\n\n```\nsecret scan → dependency audit → lockfile integrity → sensitive-file review\n```\n\n---\n\n## Decision tree\n\n```text\nUser invokes security-guardian\n |\nStep 0: Detect scope\n |-- pre-commit? --> git diff --cached\n +-- pre-push / PR? --> git diff <default-branch>...HEAD\n\n |\nClassify changed files (table above)\n\n |\nStep 1: Secret scan (always runs, every mode)\n |-- dedicated tool installed? --> run it\n +-- not installed? --> run grep fallback, note the tool is missing\n\n |\nStep 2: js-deps changed? --> npm audit\nStep 3: lockfile out of sync with the manifest? --> flag drift\nStep 4: secrets-sensitive or ci-config files touched? --> manual-review checklist\n\n |\nProduce the GO / REVIEW NEEDED report (see Report structure)\n```\n\n---\n\n## Content guidelines\n\n### Report structure\n\n1. **Header**: scope (staged/branch), mode (pre-commit/pre-push/PR review/dry-run).\n2. **Gate summary table**: one row per gate, PASS / FLAGGED / SKIPPED, notes.\n3. **Verdict**: one line, `GO` or `REVIEW NEEDED` (never \"blocked\": this\n is advisory).\n4. **Findings**: one block per flagged item (see Finding block format).\n5. **Recommended next steps**: ordered, concrete, most urgent first.\n\n### Finding block format\n\n```\n## Finding: {short title}\n\n### Location\n[path/to/file:line, or \"package.json (dependency: <name>@<version>)\"]\n\n### Risk\n[1–2 sentences, plain language: what could go wrong, not just \"this is bad\"]\n\n### Suggested Fix\n[Exact command, or exact line to remove/change, never just \"fix this\"]\n\n### Severity\nlow | medium | high | critical\n```\n\nNever reprint the actual secret or token value in a finding: describe it\n(e.g. \"AWS-style access key pattern\") and point at the location instead.\n\n### GO / REVIEW NEEDED criteria\n\n| Gate | Blocks verdict? |\n| -------------------------------------------------------- | ---------------------------------------------------------------- |\n| Secret scan | YES: any match is `REVIEW NEEDED` |\n| Dependency audit (`npm audit`), critical/high advisories | YES |\n| Dependency audit, moderate/low advisories | NO (list, don't block) |\n| Lockfile drift | YES: an out-of-sync lockfile means installs aren't reproducible |\n| Sensitive/CI-config file touched | NO (surfaces a manual-review checklist, doesn't fail the gate) |\n\n---\n\n## Commands\n\n```bash\n# Scope detection\ngit diff --cached --name-only --diff-filter=ACMR # staged\ngit diff --name-only --diff-filter=AM main...HEAD # branch vs. default branch\n\n# Gate 1: Secret scan\ngitleaks detect --no-banner --source . --redact # if installed\ngit diff --cached -U0 | grep -nEi '(api[_-]?key|secret|token|password|private[_-]?key)\\s*[:=]'\n\n# Gate 2: Dependency audit\nnpm audit\nnpm audit --json # precise severity parsing\n\n# Gate 3: Lockfile integrity\nnpm ci --dry-run # fails if the lockfile is stale\ngit diff --stat package-lock.json # size of any lockfile diff\n\n# Helper script (gates 1-4 end-to-end, advisory, always exits 0)\nbash .agents/skills/security-guardian/scripts/security-scan.sh # staged\nbash .agents/skills/security-guardian/scripts/security-scan.sh --branch # branch vs. default\n```\n\n---\n\n## Resources\n\n- [`assets/SECURE-CONTRIBUTING-CHECKLIST.md`](assets/SECURE-CONTRIBUTING-CHECKLIST.md): the short contributor and reviewer checklist this skill enforces (dependencies, secrets, rendering, reviews). Point people at it; a checklist nobody reads protects no one.\n- [`scripts/security-scan.sh`](scripts/security-scan.sh): advisory, exit-0 script running gates 1–4. For a native projection, run the script beside the skill from the project root instead.\n- `review-rangers`: code-level security review (XSS, unsafe HTML, credential exposure in components).\n",
157
+ "source": "harness/templates/agent-catalog/security-guardian/SKILL.md",
158
+ "briefs": []
159
+ },
160
+ {
161
+ "name": "web-components-best-practices",
162
+ "description": "Composition and performance guidance for native Web Components: slots over boolean props, shared controllers, re-render and bundle cost by impact. Trigger: before writing a new custom element, reviewing or refactoring Web Components code, or a question about Shadow DOM composition, slotting or shared state.",
163
+ "autoinvoke": true,
164
+ "content": "# Web Components Best Practices\n\nPractical, prioritized guidance for writing native Web Components that stay\nfast and easy to change as they grow. This skill does not replace\njudgment — it gives you a ranked checklist so effort goes where it actually\nmatters (a waterfall fix beats a micro-optimization every time).\n\n---\n\n## When to use\n\nUse this skill when:\n\n- Writing a new custom element\n- Reviewing or refactoring an existing custom element's source\n- Designing a custom element's public API (attributes, properties, slots)\n- Investigating a reported performance issue in a page using these components\n\nDo not use this skill for:\n\n- Replacing the `contract-first` rule: a new component still needs its contract before implementation (see Critical patterns, 2).\n- Micro-optimizing before the higher-priority issues in the Priority index are fixed.\n\n---\n\n## Critical patterns\n\n### 1. Stack: Lit, not vanilla custom elements\n\nEvery component in this repo (`src/components/<name>`) extends\n`LitElement`, not `HTMLElement` directly. Components declare\n`@property({ reflect: true })` and never touch `observedAttributes` or\n`attributeChangedCallback` by hand.\n`platform-fundamentals.md` §1–§3 (constructor restrictions,\n`observedAttributes` completeness, attribute/property reflection) describe\nwhat the platform requires and are sourced from MDN's vanilla\ncustom-elements docs — Lit's reactive property system already satisfies\nthose three for you, so they're marked **Lit-covered** below. Everything\nfrom §4 onward (styling API, forms, accessibility, slotted content) is\nunaffected by Lit and stays the author's responsibility exactly as\nwritten.\n\n### 2. Relationship to this repo's contract-first flow\n\nThis skill governs **how** to write a custom element once you're writing\none. It does not replace the\n`rule:contract-first`: a new\ncomponent under `src/components/<name>` still needs a\n`spec/components/<name>/contract.json` before implementation begins.\n\n---\n\n## Decision tree\n\n```text\nWriting or changing a component's public API (attributes, properties, slots)? -> references/api-and-interop-conventions.md\nLifecycle, reflection, styling hooks, forms, shadow-boundary accessibility? -> references/platform-fundamentals.md\nBoolean flags piling up, slots, shared state across elements? -> references/composition-patterns.md\nSlow render, bundle size, waterfalls, re-render cost? -> references/performance-rules.md\nSeveral issues found? -> fix the highest priority first (Priority index)\n```\n\n---\n\n## Priority index\n\nFix higher-priority issues first — a CRITICAL bundle-size or waterfall\nproblem outweighs a dozen LOW-priority micro-optimizations.\n\n### Platform fundamentals — [`references/platform-fundamentals.md`](references/platform-fundamentals.md)\n\n| Priority | Category |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| CRITICAL | Constructor restrictions (no attribute/DOM work before `connectedCallback`) — **Lit-covered** |\n| CRITICAL | `observedAttributes` must list every attribute the component reacts to — **Lit-covered** (generated from `@property()`) |\n| HIGH | Attribute/property reflection must go both directions — **Lit-covered** (`@property({ reflect: true })`) |\n| HIGH | `::part()` + CSS custom properties as the public styling API |\n| HIGH | Form-associated elements need `ElementInternals` (form controls only) |\n| HIGH | Accessibility crosses the shadow boundary; focus delegation doesn't happen automatically |\n| MEDIUM | `::slotted()` for base styles on projected content |\n| MEDIUM | `:state()`/`CustomStateSet` for internal-state styling hooks |\n| MEDIUM | `slotchange` for validating/reacting to projected content |\n| LOW-MEDIUM | `:defined` to avoid a flash of unstyled/un-upgraded content |\n| HIGH | Observers set up in `firstUpdated` re-attach in `connectedCallback`; values derived from slotted content are read at render, not cached on `slotchange` |\n\n### Public API & framework interop — [`references/api-and-interop-conventions.md`](references/api-and-interop-conventions.md)\n\n| Priority | Convention |\n| -------- | ------------------------------------------------------------------------------------------------ |\n| CRITICAL | Public API is attributes + properties + events + slots — nothing else |\n| HIGH | dash-case attributes, camelCase properties |\n| HIGH | Attributes for simple declarative config; properties for complex data |\n| HIGH | Event naming — mirror native events, prefix custom ones, bubble + compose |\n| HIGH | Production anti-patterns (FOUC, naive shadow-DOM SSR, app-level logic in components) |\n| MEDIUM | Theming via the token layering; `--sb-<component>-*` component variables are the public override hook |\n| MEDIUM | Methods callable only after `customElements.whenDefined()` |\n| MEDIUM | Framework interop caveats (React 19 verbatim events, Vue `.prop`, ship TS defs) |\n\n### Composition & component architecture — [`references/composition-patterns.md`](references/composition-patterns.md)\n\n| Priority | Pattern |\n| -------- | ------------------------------------------------------------------------------------------------------ |\n| CRITICAL | Avoid boolean-attribute proliferation — use explicit variants / slots instead |\n| HIGH | Use named slots + a shared lightweight controller instead of a monolithic element with config props |\n| HIGH | Define a generic `state` / `actions` controller interface so a component's UI is state-source-agnostic |\n| HIGH | Lift shared state into a controller object, not scattered cross-element event listeners |\n| MEDIUM | Prefer explicit variant attributes over boolean-driven modes |\n| MEDIUM | Prefer slot composition over configuration attributes |\n\n### Performance — [`references/performance-rules.md`](references/performance-rules.md)\n\n| Priority | Category |\n| ----------- | --------------------------------------------------------------------- |\n| CRITICAL | Eliminating async waterfalls |\n| CRITICAL | Bundle size optimization |\n| HIGH | Declarative Shadow DOM / SSR (currently deferred — see reference doc) |\n| MEDIUM-HIGH | Client-side data fetching |\n| MEDIUM | Attribute-driven re-render optimization |\n| MEDIUM | Rendering performance |\n| LOW-MEDIUM | JavaScript hot-path performance |\n| LOW | Advanced patterns (only once profiling justifies them) |\n\n---\n\n## Commands\n\nNone: this skill is guidance only.\n\n---\n\n## Resources\n\n- [`references/platform-fundamentals.md`](references/platform-fundamentals.md) — lifecycle correctness, attribute/property reflection, styling API surface (`::part`, custom properties, `:state()`), forms participation, cross-shadow-boundary accessibility (sourced from MDN's Web Components docs)\n- [`references/api-and-interop-conventions.md`](references/api-and-interop-conventions.md) — public API surface conventions, naming/event conventions, framework interop caveats, production anti-patterns (sourced from Nord Health's dev docs and design-system practitioner writing)\n- [`references/composition-patterns.md`](references/composition-patterns.md) — component architecture, slotting, controller-object design\n- [`references/performance-rules.md`](references/performance-rules.md) — the 8-category performance rule set with examples\n",
165
+ "source": "harness/templates/agent-catalog/web-components-best-practices/SKILL.md",
166
+ "briefs": []
167
+ }
168
+ ],
169
+ "commands": [
170
+ {
171
+ "name": "add",
172
+ "description": "Add a component - install it from the catalog, or design a new one (scaffold, contract-author, check, plan, planning gate)",
173
+ "argumentHint": "",
174
+ "content": "Add the component \"<input>\" to the design system, following the harness rules.\n\n**From the catalog** (the reference components): if it is in the catalog and the person wants it as shipped, run `sketchbook add \"<input>\" --dry-run`, show what it installs (contract, code, stories, tests and any components it depends on), then run it without `--dry-run`; it ends with the checks. Report the result and the Storybook page. Run `sketchbook help add` to confirm options.\n\n**New or redesigned** (not in the catalog, or `--blank`):\nUse the `contract-author` skill as the source of truth for the workflow. For a genuinely new component, it checks for an existing alternative and registers the requested component as `planned` if needed, before previewing the blank scaffold. Draft and validate the contract and plan; when the planning gate is enabled, stop and ask for human approval. This command never writes tests, implementation, or an approval record.\n",
175
+ "source": "harness/templates/agent-catalog/commands/add.md"
176
+ },
177
+ {
178
+ "name": "check",
179
+ "description": "Run the deterministic checks and explain any failure",
180
+ "argumentHint": "",
181
+ "content": "Run `npm run check`. For each FAIL, explain in one or two plain sentences what is wrong, why the rule exists (link the decision when there is one, using `node harness/cli.mjs explain`), and the fix the check suggests. Do not change files unless asked. Exit code 2 means passing with flagged overrides: list them.\n",
182
+ "source": "harness/templates/agent-catalog/commands/check.md"
183
+ },
184
+ {
185
+ "name": "explain",
186
+ "description": "Explain where a token, component or decision comes from",
187
+ "argumentHint": "",
188
+ "content": "Run `sketchbook explain \"<input>\"` and turn the answer into plain words: what it is, where its value comes from in each mode, who uses it, and which decision explains it. Link the files.\n",
189
+ "source": "harness/templates/agent-catalog/commands/explain.md"
190
+ },
191
+ {
192
+ "name": "foundations",
193
+ "description": "Foundations studio - create, change, import, restart or roast foundations (color, type, spacing, radius, elevation, motion, density, grid, icons, z-index, contrast, naming)",
194
+ "argumentHint": "",
195
+ "content": "Use the `foundations` skill with \"<input>\".\n\n- First word, if it is an area (`color`, `typography`, `spacing`, `radius`, `elevation`, `motion`, `density`, `layout-grid`, `icons`, `z-index`, `contrast`, `semantic-naming`, or `all`), limits the session to that area and its reference. No area: ask which one, recommending the first area still on its default preset (`sketchbook status`).\n- A mode word (`guided`, `preset`, `expert`, `import`, `scratch`, `roast`) picks the mode. No mode: infer it from the request (the skill's table); for someone new, use `guided`.\n- Change foundations only through `brand.config.json` or `sketchbook tokens` (rule `tokens-through-the-harness`), `--dry-run` first.\n- End as the skill says: `sketchbook tokens diff`, `sketchbook tokens impact`, `sketchbook check`, the Storybook `Foundations/<Page>`, a proposed decision record, and an offer to sync Figma.\n",
196
+ "source": "harness/templates/agent-catalog/commands/foundations.md"
197
+ },
198
+ {
199
+ "name": "import-tokens",
200
+ "description": "Import existing tokens (DTCG / Tokens Studio, CSS custom properties) as a reviewed proposal, then apply",
201
+ "argumentHint": "",
202
+ "content": "Use the `foundations` skill in `import` mode for \"<input>\".\n\n1. If no file is given, ask for it. Infer `--from` from the content when it is not given (`$value`/`$type` → `dtcg`; `--name:` declarations → `css`) and say what you inferred.\n2. `sketchbook tokens import <file> --from <format>` → `generated/import/<name>.proposal.json`. Nothing else changes.\n3. Follow `agent:foundations/token-mapper` or hand the brief to an authorized reviewer with the proposal path. Write only `generated/import/<name>.mapping.json`.\n4. Review with the person: unmapped interface tokens, candidates to choose between, new roles, foundation candidates (preset or custom scale), contrast failures. One decision at a time, each with a recommendation.\n5. Reflect agreed choices in the original `.proposal.json` and skip unresolved entries (`\"apply\": false`). `import apply` does not consume the advisory `.mapping.json` or rename tokens. Preview with `sketchbook tokens import apply generated/import/<name>.proposal.json --dry-run`; apply only after approval.\n6. Close as the skill says (diff, impact, check, Storybook `Foundations/*`, proposed decision record, Figma sync offer).\n\nRun `sketchbook help tokens` to confirm the import options.\n",
203
+ "source": "harness/templates/agent-catalog/commands/import-tokens.md"
204
+ },
205
+ {
206
+ "name": "init",
207
+ "description": "Set up or rebrand the design system (starting point, brand, font, radius, density, design tool, prefix)",
208
+ "argumentHint": "",
209
+ "content": "First run (nothing chosen yet, or no flags): use the `onboarding` skill, which asks who the person is and where they start and runs `sketchbook init --start <starter>` (same as `/start`).\n\nWith flags in \"<input>\": run `sketchbook init <input> --dry-run`, show what would change, and apply only after approval. To rename the element and CSS prefix (`prefix` in `harness.config.json`; tags `<prefix>-button`, variables `--<prefix>-*`), use `--prefix <name>` (lowercase letters and digits). It rewrites sources, contracts, tests, and docs, so suggest committing first. It does not rename semantic token roles.\n\nFor a new project, follow onboarding’s optional token naming step and starter handoff even when flags supplied the choices. For an existing project, explain what changed and give the next command. For a contrast failure, name the pair and offer the suggested fix. Run `sketchbook help init` to confirm options.\n",
210
+ "source": "harness/templates/agent-catalog/commands/init.md"
211
+ },
212
+ {
213
+ "name": "kits",
214
+ "description": "Add, adapt or remove template kits (page templates and blocks built from Sketchbook components)",
215
+ "argumentHint": "",
216
+ "content": "Use the `kits` skill for \"<input>\" (default: `list`, with a recommendation for what the person is building). Show what will change with `--dry-run` before adding or removing. Adapting a kit follows test-first: its behavior spec changes before its composition. Finish with `sketchbook check`, the kit's story in Storybook (light and dark) and an offer to sync the design file (`/sync`). Run `sketchbook help kits` to confirm options.\n",
217
+ "source": "harness/templates/agent-catalog/commands/kits.md"
218
+ },
219
+ {
220
+ "name": "roast-foundations",
221
+ "description": "Roast the current foundations against the standards and accessibility, with evidence, risks and recommendations (read-only)",
222
+ "argumentHint": "",
223
+ "content": "Use the `foundations` skill in `roast` mode for \"<input>\" (default `all`).\n\n1. Follow `agent:foundations/foundations-critic`. For an independent critique, give the authorized reviewer only the area and today's date. Do not share your own opinion of the foundations.\n2. When it returns, read `docs/foundations-reviews/<date>.md` and present the top findings: what, evidence, risk, recommendation (a command). Keep accessibility failures apart from taste calls.\n3. Change nothing yet. Offer to fix the findings the person accepts with `/foundations <area>`; record disagreements in a proposed decision record.\n",
224
+ "source": "harness/templates/agent-catalog/commands/roast-foundations.md"
225
+ },
226
+ {
227
+ "name": "start",
228
+ "description": "Choose a starting point (blank, foundations, library, library+kits, pick, import, from-codebase) and set it up",
229
+ "argumentHint": "",
230
+ "content": "Use the `onboarding` skill. If \"<input>\" names a starter (`blank`, `foundations`, `library`, `library+kits`, `pick`, `import`, `from-codebase`), say what it installs and skip the starter question. Otherwise ask who the person is and where they want to start, one question at a time. Preview `sketchbook init --start <starter> --dry-run`, show what would change, and apply only after approval. Explain the check results, then follow the skill’s optional token naming step and starter handoff. Run `sketchbook help init` to confirm starter options.\n",
231
+ "source": "harness/templates/agent-catalog/commands/start.md"
232
+ },
233
+ {
234
+ "name": "swap",
235
+ "description": "Swap an adapter (token builder or design tool) without touching the spec",
236
+ "argumentHint": "",
237
+ "content": "Run `sketchbook swap <input>`. Known: tokens style-dictionary|plain; design figma|none. Report before → after and the check results.\n",
238
+ "source": "harness/templates/agent-catalog/commands/swap.md"
239
+ },
240
+ {
241
+ "name": "sync",
242
+ "description": "Sync variables, styles and docs to the design file (Figma)",
243
+ "argumentHint": "",
244
+ "content": "Use the `design-figma` skill for \"<input>\" (default: tokens). Confirm the configured file key first (`SKETCHBOOK_FIGMA_FILE` or `adapters.design.file`); with none, relay the example-file steps `sketchbook sync` prints and stop. If the Figma MCP isn't available, say exactly what the person needs to do and stop. `tokens`: run `sketchbook sync tokens`, then each generated script with `use_figma` in file order, one call at a time, checking each report has no errors; then `sketchbook sync stamp tokens`. `verify`: run the script from `sketchbook sync verify`, save its JSON and ingest it with `sketchbook sync verify --ingest <file>`. End with `sketchbook check` and report what reached the file. See `sketchbook help sync`.\n",
245
+ "source": "harness/templates/agent-catalog/commands/sync.md"
246
+ },
247
+ {
248
+ "name": "tour",
249
+ "description": "Tour of the commands - what each slash command and sketchbook CLI group is for, and what to run next",
250
+ "argumentHint": "",
251
+ "content": "Use the `onboarding` skill, section \"The command tour\". Answer in plain words, one line per command, grouped as the skill's two tables (slash commands, then CLI groups). For any command the person picks, show its options with `sketchbook help <cmd>`. End by asking where they want to start, and suggest `/start` when nothing is installed yet (run `sketchbook status` to check). Change no files.\n",
252
+ "source": "harness/templates/agent-catalog/commands/tour.md"
253
+ }
254
+ ]
255
+ };