@jonandev/longbeard 0.9.0 → 0.11.0

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.
package/bin/long-beard.js CHANGED
@@ -37,20 +37,22 @@ The catalog is beard.json. The command is longbeard, via npx in the project.
37
37
  npx longbeard list
38
38
  npx longbeard --version
39
39
 
40
- npx longbeard init [--global] [--all] [--yes] [--agent cursor]
41
- npx longbeard update [--global] [--all] [--force] [--yes]
40
+ npx longbeard init [--global] [--all] [--skill add-on] [--no-addons] [--yes] [--agent cursor]
41
+ npx longbeard update [--global] [--all] [--skill add-on] [--force] [--yes]
42
42
  npx longbeard add <source> --skill <name> --author <name> --why <text> [--when text]
43
43
  npx longbeard remove <name>
44
44
 
45
45
  init installs missing skills from beard.json. A skill already present for an agent is left there.
46
46
  update installs anything new, refreshes only items in beard-lock.json, and rewrites the AGENTS.md block.
47
47
  A skill written here is copied from the installed package when its version moved, and the line says which versions.
48
- A kit (ponytail) is every skill its author publishes. update adds new ones and removes retired ones you did not edit, and a kit's skills when the catalog drops it.
48
+ A kit (Matt Pocock's) is every skill its author publishes. update adds new ones, and removes any skill the catalog or its kit no longer lists, unless you edited it.
49
49
  Install the package first (npm install -D @jonandev/longbeard@latest); update does not fetch it.
50
50
  add in a project writes beard.local.json (an extra, not a second kit). remove omits a kit skill here.
51
+ init lists the add-ons in a terminal, some already ticked. --all takes every add-on; --skill takes one; --no-addons takes none.
52
+ Each of those skips the list. An add-on you took stays and refreshes on update.
51
53
  --agent skips the agent list and installs for that tool. Repeat it.
52
- --force replaces local edits of skills this command installed.
53
- --yes skips prompts and uses the catalog agents (cursor, claude-code).
54
+ --force replaces local edits of skills this command installed, and removes edited ones the catalog dropped.
55
+ --yes skips prompts and uses the catalog agents (cursor, claude-code) and, on a first init, the ticked add-ons.
54
56
  This does not install marketplace plugins or replace Cursor or Claude commands.
55
57
  `;
56
58
 
@@ -142,6 +144,7 @@ function parseArgs(argv) {
142
144
  force: false,
143
145
  yes: false,
144
146
  optional: false,
147
+ noAddons: false,
145
148
  agents: [],
146
149
  skill: [],
147
150
  why: "",
@@ -157,6 +160,7 @@ function parseArgs(argv) {
157
160
  else if (arg === "--force") flags.force = true;
158
161
  else if (arg === "--yes" || arg === "-y") flags.yes = true;
159
162
  else if (arg === "--optional") flags.optional = true;
163
+ else if (arg === "--no-addons") flags.noAddons = true;
160
164
  else if (arg === "--help" || arg === "-h") flags.help = true;
161
165
  else if (arg === "--version" || arg === "-V") flags.version = true;
162
166
  else if (arg === "--agent" || arg === "-a") flags.agents.push(take(argv, ++i, arg));
@@ -232,21 +236,34 @@ function writeExtra(flags, state) {
232
236
 
233
237
  // A kit is what its author publishes: the skills in their plugin manifest, else
234
238
  // every folder in their skills/. Read at install time so a new or retired skill
235
- // follows the author, not this catalog.
236
- async function kitSkills(item) {
239
+ // follows the author, not this catalog. Read once per run.
240
+ const kitCache = new Map();
241
+ function kitSkills(item) {
242
+ if (!kitCache.has(item.source)) kitCache.set(item.source, fetchKit(item));
243
+ return kitCache.get(item.source);
244
+ }
245
+
246
+ async function fetchKit(item) {
237
247
  const repo = item.source.match(/github\.com\/([^/]+\/[^/#?]+)/)?.[1]?.replace(/\.git$/, "");
238
248
  if (!repo) fail(`${item.name}: a kit needs a GitHub source.`);
239
249
  // update retires what this list leaves out, so a failed fetch must stop here,
240
250
  // never fall through to a guess. Only a missing manifest (404) falls back.
241
- const cannot = `Could not list the ${item.name} kit from GitHub. Check the network and try again.`;
251
+ // Every stop names its reason, so a failure is never just "check the network".
252
+ const cannot = `Could not list the ${item.name} kit from GitHub`;
242
253
  const get = async (url) => {
254
+ let res;
255
+ try {
256
+ res = await fetch(url);
257
+ } catch (error) {
258
+ const reason = error.cause?.code ?? error.cause?.message ?? error.message;
259
+ fail(`${cannot}: ${reason} reaching ${url}. Check the network and try again.`);
260
+ }
261
+ if (res.status === 404) return null;
262
+ if (!res.ok) fail(`${cannot}: ${res.status} ${res.statusText} from ${url}.`);
243
263
  try {
244
- const res = await fetch(url);
245
- if (res.status === 404) return null;
246
- if (!res.ok) fail(`${cannot} (${res.status} from ${url})`);
247
264
  return await res.json();
248
265
  } catch {
249
- fail(cannot);
266
+ fail(`${cannot}: ${url} did not return JSON.`);
250
267
  }
251
268
  };
252
269
  const manifest = await get(`https://raw.githubusercontent.com/${repo}/HEAD/.claude-plugin/plugin.json`);
@@ -255,7 +272,7 @@ async function kitSkills(item) {
255
272
  : ((await get(`https://api.github.com/repos/${repo}/git/trees/HEAD?recursive=1`))?.tree ?? [])
256
273
  .map((entry) => entry.path.match(/^skills\/([^/]+)\/SKILL\.md$/)?.[1])
257
274
  .filter(Boolean);
258
- if (names.length === 0) fail(cannot);
275
+ if (names.length === 0) fail(`${cannot}: ${repo} lists no skills.`);
259
276
  return names;
260
277
  }
261
278
 
@@ -274,11 +291,21 @@ async function expandKits(skills, omit) {
274
291
  return out;
275
292
  }
276
293
 
294
+ function knownAddons(flags) {
295
+ const addons = catalog(curated()).filter((item) => item.optional).map((item) => item.name);
296
+ for (const name of flags.skill) {
297
+ if (!addons.includes(name)) fail(`${name} is not an add-on. Add-ons: ${addons.join(", ")}.`);
298
+ }
299
+ }
300
+
277
301
  function chosen(flags) {
278
302
  const manifest = curated();
279
303
  const extra = extraState(flags);
280
304
  const omitted = new Set(extra.omit);
281
- const shared = catalog(manifest).filter((item) => (flags.all || !item.optional) && !omitted.has(item.name));
305
+ // An add-on comes with --all, with --skill <name>, or because you took it before.
306
+ const installed = readLock(flags).skills;
307
+ const wanted = (item) => !item.optional || flags.all || flags.skill.includes(item.name) || Boolean(installed[item.name]);
308
+ const shared = catalog(manifest).filter((item) => wanted(item) && !omitted.has(item.name));
282
309
  const seen = new Set(shared.map((item) => item.name));
283
310
  const extras = extra.items.filter((item) => !seen.has(item.name) && !omitted.has(item.name));
284
311
  const items = [...shared, ...extras];
@@ -337,25 +364,22 @@ function readKey() {
337
364
  return "";
338
365
  }
339
366
 
340
- function pickAgents(options, selected) {
367
+ // One checkbox list for both questions init asks. An option is { name, label, detail }.
368
+ function pickList(title, options, selected, { min = 0 } = {}) {
341
369
  const on = new Set(selected);
342
370
  let index = 0;
343
371
  const height = options.length + 1;
372
+ const width = Math.max(16, ...options.map((option) => option.label.length));
344
373
  const paintList = (first) => {
345
374
  if (!first) process.stdout.write(`\x1b[${height}A`);
346
- process.stdout.write(` Which agents? ${dim("space toggle · enter continue")}\x1b[K\n`);
375
+ process.stdout.write(` ${title} ${dim("space toggle · enter continue")}\x1b[K\n`);
347
376
  for (let i = 0; i < options.length; i += 1) {
348
- const name = options[i];
377
+ const option = options[i];
349
378
  const arrow = i === index ? "❯" : " ";
350
- const mark = on.has(name) ? "x" : " ";
351
- const label = (agentNames[name] ?? name).padEnd(16);
352
- const path = flagsPath(name);
353
- process.stdout.write(` ${arrow} [${mark}] ${label} ${dim(path)}\x1b[K\n`);
379
+ const mark = on.has(option.name) ? "x" : " ";
380
+ process.stdout.write(` ${arrow} [${mark}] ${option.label.padEnd(width)} ${dim(option.detail ?? "")}\x1b[K\n`);
354
381
  }
355
382
  };
356
- function flagsPath(name) {
357
- return agentDirs[name].project;
358
- }
359
383
  process.stdin.setRawMode(true);
360
384
  paintList(true);
361
385
  try {
@@ -363,11 +387,11 @@ function pickAgents(options, selected) {
363
387
  const key = readKey();
364
388
  if (key === "ctrl-c") fail("Aborted.");
365
389
  if (key === "enter") {
366
- if (on.size === 0) continue;
367
- return options.filter((name) => on.has(name));
390
+ if (on.size < min) continue;
391
+ return options.filter((option) => on.has(option.name)).map((option) => option.name);
368
392
  }
369
393
  if (key === "space") {
370
- const name = options[index];
394
+ const { name } = options[index];
371
395
  if (on.has(name)) on.delete(name);
372
396
  else on.add(name);
373
397
  } else if (key === "up") index = (index + options.length - 1) % options.length;
@@ -380,6 +404,27 @@ function pickAgents(options, selected) {
380
404
  }
381
405
  }
382
406
 
407
+ function pickAgents(options, selected) {
408
+ const rows = options.map((name) => ({ name, label: agentNames[name] ?? name, detail: agentDirs[name].project }));
409
+ return pickList("Which agents?", rows, selected, { min: 1 });
410
+ }
411
+
412
+ // init asks which add-ons, with the catalog's `preselected` ones ticked. Naming
413
+ // add-ons with a flag is the answer, so it skips the list. Ticks are for a
414
+ // first init only: after that, what you took stays and nothing comes back.
415
+ function chooseAddons(flags) {
416
+ if (flags.all || flags.noAddons || flags.skill.length) return [];
417
+ const taken = readLock(flags).skills;
418
+ const omitted = new Set(extraState(flags).omit);
419
+ const open = catalog(curated()).filter((item) => item.optional && !taken[item.name] && !omitted.has(item.name));
420
+ if (open.length === 0) return [];
421
+ const first = !existsSync(lockFile(flags));
422
+ const ticked = first ? open.filter((item) => item.preselected).map((item) => item.name) : [];
423
+ if (flags.yes || !process.stdin.isTTY) return ticked;
424
+ const rows = open.map((item) => ({ name: item.name, label: item.name, detail: item.hint ?? item.when ?? "" }));
425
+ return pickList("Which add-ons?", rows, ticked);
426
+ }
427
+
383
428
  function chooseAgents(manifest, flags, { pick, lock } = {}) {
384
429
  const known = knownAgents();
385
430
  if (flags.agents.length) {
@@ -559,24 +604,36 @@ function locallyEdited(name, entry, agents, global) {
559
604
  return folders.some((folder) => statSync(join(folder, "SKILL.md")).mtimeMs > installed + 2000);
560
605
  }
561
606
 
562
- function generateRouter(items) {
607
+ function generateRouter(items, manifest = curated()) {
608
+ const stages = manifest.stages ?? [];
609
+ const staged = new Set(stages.flatMap((stage) => stage.skills));
563
610
  const line = (when, name, why) => (why?.trim() ? `- ${when}: ${name}. ${why.trim()}` : `- ${when}: ${name}`);
564
- const lines = items.filter((item) => kind(item) === "skill").flatMap((item) => {
611
+ const helpers = items.filter((item) => kind(item) === "skill").flatMap((item) => {
565
612
  if (item.kit) return (item.routes ?? []).map((route) => line(route.when, route.skill, route.why));
613
+ if (staged.has(item.name)) return [];
566
614
  return [line(item.when?.trim() || item.name, item.name, item.why)];
567
615
  });
616
+ const have = new Set(items.map((item) => item.name));
617
+ // A preselected add-on was decided at init, so it is never offered again.
618
+ const addons = catalog(manifest).filter((item) => item.optional && !item.preselected && !have.has(item.name));
619
+ const rows = stages.map((stage) => `| ${stage.name} | ${stage.when} | ${stage.skills.join(" → ")} | ${stage.writes} |`);
620
+ const offer = addons.length
621
+ ? `\nAdd-ons, offered once when needed (\`npx longbeard update --skill <name>\`): ${addons.map((item) => (item.hint ? `${item.name} (${item.hint})` : item.name)).join(", ")}. At Architecture, a framework skill.\n`
622
+ : "";
568
623
  return `# Long Beard
569
624
 
570
- The project's own code, conventions, and DESIGN.md win.
625
+ The project's own code, conventions, and DESIGN.md win. Load only what the task needs.
571
626
 
572
- Load only what the task needs. Leave the rest unread.
627
+ | Stage | Starts when | Skills | Writes |
628
+ |---|---|---|---|
629
+ ${rows.join("\n")}
573
630
 
574
- A marketing site is the page a person lands on to understand or choose. An application is the tool they come back to. Official look wins: DESIGN.md, then Figma, then the board. Hunt finds references and proposes an adaptation; it does not code the page. Open the moodboard before they pick, say what we take, change, and leave, then ask to write or update DESIGN.md as its own message — once more, first, if they move on without answering — only on yes. Code the page only when they asked to build. Direction-only stops after the next-step offer. A site hunts live pages; an application hunts screen shots. With a direction already, hunt only the piece.
631
+ Each stage offers the next; start it on yes. A skill you can't load: they type /<name>. No UI: skip Direction and Design. A feature with a brief: grill-with-docs for new terms, else grilling, then Plan.
575
632
 
576
- ${lines.join("\n")}
577
-
578
- A normal change can be ponytail and a short premortem. That is still a small set.
633
+ UI tickets link their Ready Figma frame. UI work follows DESIGN.md and that frame; a mismatch is a bug.
579
634
 
635
+ ${helpers.join("\n")}
636
+ ${offer}
580
637
  Write so a person can use the reply in one read. End with what you did not check.
581
638
  `;
582
639
  }
@@ -712,8 +769,10 @@ function remember(lock, flags, skills, agents) {
712
769
 
713
770
  async function init(flags) {
714
771
  requireProject(flags);
715
- const { manifest, extra, items, later, ...picked } = chosen(flags);
716
- const agents = chooseAgents(manifest, flags, { pick: true, lock: readLock(flags) });
772
+ knownAddons(flags);
773
+ const agents = chooseAgents(curated(), flags, { pick: true, lock: readLock(flags) });
774
+ flags.skill.push(...chooseAddons(flags));
775
+ const { extra, items, later, ...picked } = chosen(flags);
717
776
  const skills = await expandKits(picked.skills, extra.omit);
718
777
  const classified = classify(skills, agents, flags);
719
778
  classified.later = later;
@@ -732,21 +791,24 @@ async function init(flags) {
732
791
 
733
792
  async function update(flags) {
734
793
  requireProject(flags);
794
+ knownAddons(flags);
735
795
  const { manifest, extra, items, later, ...picked } = chosen(flags);
736
796
  const agents = chooseAgents(manifest, flags, { pick: false, lock: readLock(flags) });
737
797
  const skills = await expandKits(picked.skills, extra.omit);
738
798
  const classified = classify(skills, agents, flags);
739
799
  classified.later = later;
740
- // A kit skill nothing lists any more leaves, unless you edited it: the author
741
- // stopped publishing it, or the catalog dropped the kit.
742
- const listed = new Set(skills.map((skill) => skill.name));
800
+ // A skill nothing lists any more leaves, unless you edited it: the catalog
801
+ // dropped it, or its kit's author stopped publishing it. Listed means the
802
+ // whole catalog, so an add-on installed with --all stays without it.
803
+ const all = [...catalog(manifest), ...extra.items].filter((item) => kind(item) === "skill");
804
+ const listed = new Set((await expandKits(all, extra.omit)).map((skill) => skill.name));
743
805
  const retired = Object.entries(classified.lock.skills)
744
- .filter(([name, entry]) => entry.kit && !listed.has(name) && !extra.omit.includes(name))
806
+ .filter(([name]) => !listed.has(name) && !extra.omit.includes(name))
745
807
  .map(([name, entry]) => ({ name, author: entry.author, edited: locallyEdited(name, entry, agents, flags.global) }));
746
- const drop = retired.filter((skill) => !skill.edited);
808
+ const drop = flags.force ? retired : retired.filter((skill) => !skill.edited);
747
809
  plan("update", flags, agents, classified);
748
810
  rows("retired", yellow, drop, "No longer in its kit or the catalog. Removed.", nameWidth([retired]));
749
- rows("retired, kept", yellow, retired.filter((skill) => skill.edited), "No longer in its kit or the catalog. Kept because you edited it.", nameWidth([retired]));
811
+ rows("retired, kept", yellow, retired.filter((skill) => !drop.includes(skill)),"No longer in its kit or the catalog. Kept because you edited it. Pass --force to remove it.", nameWidth([retired]));
750
812
  confirmWrite(flags, classified.writes);
751
813
  if (drop.length > 0) {
752
814
  // No --agent: with one, the skills CLI unlinks Claude Code but leaves the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonandev/longbeard",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Designs like an Art director. Codes like a senior.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,6 +42,7 @@
42
42
  "scripts": {
43
43
  "longbeard": "node ./bin/long-beard.js",
44
44
  "router": "node ./bin/long-beard.js router > AGENTS.md",
45
- "test": "node --test"
45
+ "test": "node --test",
46
+ "share": "node scripts/share.mjs"
46
47
  }
47
48
  }
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: design
3
+ description: >
4
+ Turn a direction into the product's look: prototype the brief's key screens
5
+ in plain HTML, let them pick and iterate, then on approval write DESIGN.md
6
+ in one go and build the screens in Figma from it. Colour, type, spacing and
7
+ copy are chosen here, on rendered screens. Runs when
8
+ design-exploration/<slug>/direction.md exists and there is no approved
9
+ DESIGN.md, or for a feature that needs screens. Figma is required.
10
+ ---
11
+
12
+ # Design
13
+
14
+ Three things come out, in order: a prototype they approved, `DESIGN.md` (the official look, committed), and the screens in Figma marked **Ready**. Figma is the truth for screens. `DESIGN.md` is the written summary of the rules behind them.
15
+
16
+ Read [design-rules.md](references/design-rules.md) before the first prototype. It is the checklist for every screen here and in `design-check`.
17
+
18
+ ## Gate
19
+
20
+ Look at the repo. Do not ask what is there.
21
+
22
+ 1. No `docs/brief.md` → `idea` first. Stop.
23
+ 2. The brief says no UI → nothing to design. Stop.
24
+ 3. No `design-exploration/identity*/direction.md` and no `DESIGN.md` → `design-direction` first. Stop.
25
+ 4. `DESIGN.md` exists and an identity `direction.md` is newer than it → a rebrand: **First pass**. On approval its `DESIGN.md` replaces the old one.
26
+ 5. `DESIGN.md` exists → **Feature loop**.
27
+ 6. Otherwise → **First pass**.
28
+
29
+ The first pass reads the newest `design-exploration/identity*/direction.md` (`identity/`, `identity-2/`), never a one-piece direction.
30
+
31
+ No Figma connection → say Figma is required for UI projects, and stop before the Figma step. The prototype and `DESIGN.md` can still be done.
32
+
33
+ ## First pass
34
+
35
+ ### 1. Ask first
36
+
37
+ The direction settles the idea, not the values. Colour, type and the rest of the look are chosen here, so they get a say before anything is drawn. Read the brief and `direction.md`, then send one message and wait. Always ask, however the run was set up. Only they can say "go".
38
+
39
+ ```
40
+ Before I prototype, a few choices. Skip any with "go" and I'll bring options to react to.
41
+
42
+ 1. Colour: light, dark or both? Any colours you already have, want, or refuse?
43
+ 2. Type: what should it feel like to read? Any faces you love or refuse?
44
+ 3. Anything else you already see: shapes, density, imagery, how it moves?
45
+ ```
46
+
47
+ Propose from the direction, so they react rather than start from nothing: for each question, offer two or three concrete options that fit it.
48
+
49
+ ### 2. Prototype the key screens
50
+
51
+ Read the brief's key screens (2–4) and `direction.md`. Prototype only those, with their main states. Other screens are composed later in Figma from the components.
52
+
53
+ Load Matt's `prototype`, UI branch, and tell it:
54
+
55
+ - **No app.** Sub-shape B, in `design-exploration/<slug>/prototype/`: one `index.html` per key screen, plain HTML and CSS, no build step, no router, no NODE_ENV gate. It runs by opening the file.
56
+ - **2–3 variants per screen** behind `?variant=`, structurally different as its rules say. Build their answers in. Where they left a choice open, variants differ on it: this is where colour and type get chosen.
57
+ - **Hide the switcher when the URL has `capture`** (`?variant=B&capture`), so screenshots show only the design.
58
+ - **Real content, not polish skipped.** Real copy in the voice from `direction.md`, real or properly chosen imagery (local files in `prototype/img/`), the longest real names. No lorem, no grey boxes.
59
+ - **No throwaway branch.** The folder is gitignored. The winner goes into `DESIGN.md`, not into git.
60
+
61
+ The default state is not enough. Each key screen also gets the empty, loading and error states a person can reach, as frames in the same file (`?variant=B&state=empty`). A product with more than one theme shows each one, so they approve every theme, not only the first.
62
+
63
+ ### 3. Self-check, then show
64
+
65
+ Screenshot each variant at desktop and mobile:
66
+
67
+ ```
68
+ node <skill>/scripts/capture.mjs "file://$PWD/design-exploration/<slug>/prototype/today.html?variant=B&capture" --out <scratch>/today-b.png
69
+ node <skill>/scripts/capture.mjs "file://$PWD/design-exploration/<slug>/prototype/today.html?variant=B&capture" --out <scratch>/today-b-mobile.png --width 390
70
+ ```
71
+
72
+ Shoot every state of every variant, in every theme, not only the default. Check them against the rules: Idea first, then hard, then soft. That includes the hard rules about controls: every input has a visible label, focus and pressed exist, and what looks tappable has a stated result. A hard finding after approval reopens an approved screen. Fix what fails before they see it. Then give the paths and the `?variant=` keys, name the colours and faces each variant uses, and ask which leads, what to take from the others, and whether the colour and type are right. Expect "the header from B with the list from C": that is the design. Iterate on the prototype until they say it is right.
73
+
74
+ A pattern can bring a feature the brief does not have. Name it when you show it. If they keep it, that is a product change: `idea`, Change, before `DESIGN.md`.
75
+
76
+ An `ownable` from `direction.md` is unconfirmed until they have seen it rendered. Confirm it or replace it here.
77
+
78
+ A gap no reference covers (a screen, a control) → `design-direction` one-piece mode with its own slug, then back here.
79
+
80
+ ### 4. Approve: write `DESIGN.md` in one go
81
+
82
+ Only on their yes to a rendered prototype. Write the whole file from [design-md-template.md](references/design-md-template.md): idea, voice, colour, type, spacing, components, decisions. Write it once, from what was approved. Do not draft it during iteration.
83
+
84
+ - **Contrast first.** Every text and background pair, and every control colour against its ground, goes through `scripts/contrast.mjs` before it is written: 4.5:1 for body text, 3:1 for large text and non-text marks. A failing pair is fixed in the prototype, shown again, then written. Never write a failing pair.
85
+ ```
86
+ node <skill>/scripts/contrast.mjs "#1b1b1f on #fafaf7" "#c2410c on #fafaf7:mark"
87
+ ```
88
+ - **Themes.** A product with more than one theme lists each colour token once, with a value per theme, and every pair passes the contrast check in each theme.
89
+ - **Ideas, not sources.** `DESIGN.md` is committed and often public. It never names a product, site, studio or designer from the exploration, and never cites a `design-exploration/` path. Turn each into the idea: "a quiet reading page", not whose.
90
+ - **Write down what makes it this design.** Whatever someone would need to rebuild it without the prototype open goes under Components, with values, not adjectives.
91
+ - **Tokens are code names.** Name each colour, type and spacing token as it will be named in code (`color/ink`, `space/md`). Figma variables use the same names, with code syntax `var(--color-ink)`.
92
+ - **Soft rules overridden on purpose** go under Decisions with the reason. Hard rules cannot be overridden.
93
+
94
+ ### 5. Figma
95
+
96
+ Load `figma-use`, `figma-generate-library` and `figma-generate-design`, and follow them. This skill adds only what they do not decide.
97
+
98
+ - **One file per product.** A new one if the project has none (`figma-create-new-file`). Put its URL in `DESIGN.md`.
99
+ - **Our tokens, not a kit.** Variables and styles come from `DESIGN.md`. New files may come with community kits attached (Material, Apple, Simple Design System). Their discovery steps tell you to reuse them. Do not: search the file only (no `includeLibraryKeys`), and build what is missing from `DESIGN.md`.
100
+ - **Build, do not capture.** Compose screens from the tokens and components. Do not run `generate_figma_design` on the prototype. It is a throwaway with a switcher. For pictures, create the image frames, then `upload_assets` the prototype's own files with those `nodeIds`.
101
+ - **Themes are modes.** One colour collection with a mode per theme. Each screen is built once and switches with the mode, never a colour set or a frame per theme. If Figma refuses the modes, stop and ask. Never fall back to separate sets.
102
+ - **Pages:** Cover, Foundations, Components; one `Screens — <flow>` page per flow from the brief; `Explorations` for anything kept for later, by date.
103
+ - **Order:** tokens and styles from `DESIGN.md` → only the components the key screens need → the key screens → their states. The library grows with features. It is not built ahead.
104
+ - **States:** every screen has a frame for each of empty, loading and error that a person can reach, next to the default. A state nobody can reach gets no frame: add the screen, the state and the reason under Decisions in `DESIGN.md`.
105
+ - **Names:** `<screen> — <state>`. When a screen's layout differs by device, `<screen> · <device> — <state>`. The state can describe itself. Theme is never in the name.
106
+ - **Components have their states too:** focus and pressed for every control, before a screen uses it.
107
+ - **One text style per weight used.** Changing a font on styled text detaches it. A weight `DESIGN.md` does not list is a new style, and a new row there.
108
+ - **Trust the file, not the picture.** Take a screenshot only after the edit has returned, and read text back from the nodes. A cloned variant loses its text property links: wire them again. Swapping an instance can keep old overrides: replace it with a fresh one.
109
+ - **Be faithful to the approved prototype.** It is what they said yes to, and Figma is that design, not a new reading of it. Tokens carry the values, not the whole design, so work with the approved variant open and match it. If something cannot be built the same way, say so and ask. Never simplify it silently.
110
+ - **Check each screen** with `design-check` frame mode before showing it, passing the prototype shot. Fix its hard findings.
111
+ - **Ready:** when they approve a frame, add `— Ready` to its name. Tickets link Ready frames, and build is checked against them.
112
+
113
+ If a Figma decision changes a rule (a new token, a component variant, a spacing step), update `DESIGN.md` in the same turn and say what changed.
114
+
115
+ ### 6. Clean up
116
+
117
+ Offer to delete `design-exploration/<slug>/`. `DESIGN.md` and Figma now carry the result. On no, leave it. It is gitignored either way.
118
+
119
+ Then offer the next stage: architecture. They start it by typing `/grill-with-docs`. When it runs, seed `GLOSSARY.md` from the brief and the copy in the Figma screens, and ask before renaming a term the screens show.
120
+
121
+ ## Feature loop
122
+
123
+ A feature with screens, once `DESIGN.md` exists.
124
+
125
+ - **Only existing parts?** Compose the screens in Figma from the library, with their states, and skip the prototype and `design-direction`.
126
+ - **New parts?** Prototype only the new parts, on the real screens around them, in `design-exploration/<feature>/prototype/`, then as above.
127
+ - New page `Screens — <feature>`. Reuse components. New ones are added to Components.
128
+ - `DESIGN.md` gets entries (a token, a component, a decision with date and reason). It is never rewritten in a feature.
129
+ - **Identity changes need their own yes.** A new colour role, a typeface, a change to the idea or the voice: ask for each one separately, after showing it rendered. Two such changes are approved one at a time, never bundled.
130
+ - A rebrand is not a feature: that is `design-direction` again, then a first pass.
131
+ - **A screen with no Ready frame.** A project that joined with its screens already in Figma has frames nobody marked. When a feature touches one, run `design-check` frame mode on it, add what it lacks, and mark it Ready on their yes. A screen with a copy per theme becomes one frame on modes. Only the screens the feature touches, never the whole file.
132
+
133
+ ## Do not
134
+
135
+ - Write `DESIGN.md` before they approve a rendered prototype, or rewrite it during a feature. Only a rebrand's first pass replaces it.
136
+ - Name a reference or a `design-exploration/` path in `DESIGN.md`.
137
+ - Use a community kit's components or variables in Figma.
138
+ - Build the whole component library before the screens need it.
139
+ - Mark a frame Ready that lacks a state a person can reach, or that has open hard findings.
@@ -0,0 +1,58 @@
1
+ # DESIGN.md template
2
+
3
+ Write the whole file once, from the approved prototype. A builder follows it without the prototype or the references open. Short lines. Our words, never a reference's name.
4
+
5
+ ```markdown
6
+ # Design
7
+
8
+ Figma: <file URL>. Figma is the truth for screens. This file is the rules behind them.
9
+
10
+ ## Idea
11
+ <one sentence: what this product's look says>
12
+ - ownable: <the one element made from the product's own identity, as approved on the prototype>
13
+
14
+ ## Voice
15
+ - <three adjectives>
16
+ - <one sample line, and one line it would never say>
17
+
18
+ ## Colour
19
+ | Token | Value | Use |
20
+ |---|---|---|
21
+ | color/bg | #… | page ground |
22
+ | color/ink | #… | body text |
23
+ | … | | |
24
+
25
+ Contrast (scripts/contrast.mjs):
26
+ - color/ink on color/bg: <ratio> <AA | AAA>
27
+ - <every text, control and focus pair>
28
+
29
+ ## Type
30
+ | Token | Face, weight | Size / line height | Use |
31
+ |---|---|---|---|
32
+ | type/heading | … | …/… | screen titles |
33
+ | type/body | … | …/… | body, lists |
34
+
35
+ - Licence: <covers how this ships: web, app bundle>
36
+
37
+ ## Spacing
38
+ - Scale: <space/sm 8, space/md 16, …>
39
+ - <how the scale is used: inside components, between items, between groups, between sections>
40
+ - Corner radius: <value, and where>
41
+
42
+ ## Components
43
+ - <component>: <what it is for, its variants, its states>
44
+
45
+ ## Imagery
46
+ - <what the pictures are and how they are treated, or "none">
47
+
48
+ ## Decisions
49
+ - <date>: <what was decided> — <the reason>. <Soft rule overridden, if any: rule number and why>
50
+
51
+ ## Do not
52
+ - <what we leave, as ideas: "a bright brand accent", never whose>
53
+ ```
54
+
55
+ - Every token name is its code name, and the same name in Figma.
56
+ - Every colour pair in the table has been through `scripts/contrast.mjs`. No FAIL is written.
57
+ - More than one theme: one row per token, with a value column per theme. Every pair is checked in each theme.
58
+ - A section with nothing to say is left out, not filled with a guess.