@ethlete/agent-rules 0.1.0-next.31 → 0.1.0-next.32

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 (38) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +7 -1
  3. package/content/hooks/background-design-commands.py +140 -0
  4. package/content/hooks/builder-chat-words.py +74 -0
  5. package/content/hooks/context-warning.py +47 -19
  6. package/content/hooks/git-safety.py +181 -0
  7. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +1 -1
  8. package/content/rules/nx-layout.md +5 -2
  9. package/content/rules/subagent-models.md +2 -2
  10. package/content/skills/agent-sessions/SKILL.md +5 -3
  11. package/content/skills/agent-sessions/agent-sessions.mjs +20 -4
  12. package/content/skills/design-exploration/SKILL.md +47 -547
  13. package/content/skills/design-exploration/reference-check-and-notes.md +92 -0
  14. package/content/skills/design-exploration/reference-flows-and-wireframes.md +78 -0
  15. package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
  16. package/content/skills/design-exploration/reference-order-and-design-system.md +124 -0
  17. package/content/skills/design-exploration/reference-products-and-sketches.md +199 -0
  18. package/content/skills/design-exploration/reference-shots.md +25 -0
  19. package/content/skills/git-commit/SKILL.md +10 -0
  20. package/content/skills/grilling/SKILL.md +1 -0
  21. package/content/skills/handoff/SKILL.md +20 -4
  22. package/package.json +1 -1
  23. package/src/index.js +2 -1
  24. package/src/index.js.map +1 -1
  25. package/src/lib/git-flow-repair.d.ts +1 -1
  26. package/src/lib/git-flow-start.d.ts +1 -1
  27. package/src/lib/migrate.js +2 -1
  28. package/src/lib/migrate.js.map +1 -1
  29. package/src/lib/output-style-command.d.ts +1 -1
  30. package/src/lib/prettier.d.ts +21 -0
  31. package/src/lib/prettier.js +51 -0
  32. package/src/lib/prettier.js.map +1 -0
  33. package/src/lib/sync.d.ts +1 -1
  34. package/src/lib/sync.js +9 -2
  35. package/src/lib/sync.js.map +1 -1
  36. package/src/lib/targets/hooks-shared.d.ts +3 -3
  37. package/src/lib/targets/hooks-shared.js +58 -20
  38. package/src/lib/targets/hooks-shared.js.map +1 -1
@@ -0,0 +1,92 @@
1
+ # Design exploration: checking a product, drawing files and notes
2
+
3
+ ### Check a product
4
+
5
+ ```bash
6
+ et design check --product <name> # layer dependencies, hard-coded colours, undefined tokens, copied components, scripted motion, tsc (open sketch variants too), render
7
+ et design system --json # each part's origin, note, states, presets and problems
8
+ ```
9
+
10
+ Without `--product`, `check` covers every product. A part may only use its own layer and the
11
+ layers below it (see "The order of a design"). Rule `FLOW` reports a misshaped flow file, a frame
12
+ naming a part or state that exists neither in the product nor in an open sketch of that part, a duplicate state, and a line to a state that is not a frame of
13
+ the flow. Rule `WIREFRAME-KIT` reports a component or foundation importing the kit. Pass the changed files to the check below as before.
14
+
15
+ Once the other rules pass, the check draws every state in a headless Chromium on a server of its own
16
+ (pages at each preset, a part with `widths` at each width, any other part fitted), and
17
+ `sketch check` does the same for the open variants and the pages they show in. Each line names
18
+ product, part, state, size and a selector path:
19
+
20
+ - `OVERFLOW` - the frame scrolls: content wider than the frame, or taller than a preset height.
21
+ - `CLIPPED` - an element with `overflow: hidden|clip` cuts its content, unless it sets
22
+ `text-overflow: ellipsis` or a line clamp.
23
+ - `WRAP` - text in a button, tab, badge, chip or `white-space: nowrap` box runs onto a second line.
24
+ - `ZERO-SIZE` - the part root has no width or no height.
25
+ - `UNKNOWN-THEME` - a `et-color--<name>` class names a colour theme no stylesheet of the frame defines, so it draws in the fallback colour.
26
+ - `RENDER` - the frame refused to draw, or the part did not load.
27
+
28
+ A `WARNING` line does not fail the check:
29
+
30
+ - `UNDEFINED-CLASS` - a class carries a prefix the product's part CSS uses (`st-`, not the SDK's
31
+ `et-`), but no stylesheet of the frame defines it. Named once, at the first part that draws it.
32
+ - `GRID-COVERAGE` - some `grid` rows fill every interaction column (`rest`, `hover`, `active`,
33
+ `focus-visible`, `disabled`) and others leave some out, so a state can break there unseen.
34
+
35
+ A part that breaks a rule on purpose names it: `definePart({ checks: { skip: ['CLIPPED'] }, … })`;
36
+ the skip covers the part wherever it is drawn. Without Playwright Chromium the check prints
37
+ `RENDER CHECK SKIPPED` and passes on the other rules.
38
+
39
+ A project's `config.json` entry can name `themes`, `{ "surface": [...], "color": [...] }`; a
40
+ frame asked for a theme gets the `et-surface--<name>` and `et-color--<name>` classes on its root,
41
+ so a drawing must take its colours from the theme tokens and never set a surface or colour class
42
+ on its own root. An inner panel may set `et-surface--<name>`.
43
+
44
+ `et design [checkout]` serves the frames; the checkout defaults to the working directory and
45
+ `DE_PORT` overrules the port. In the ethlete SDK the user reads Studio, started with `yarn studio`,
46
+ which serves the frames itself: do not start `yarn design` next to it. Studio carries its own copy
47
+ of the tool, so a checkout that installs nothing still draws.
48
+
49
+ Three constraints on a drawing file:
50
+
51
+ - **Never import a package barrel.** The libraries resolve to source, so one barrel makes the
52
+ browser request every module and the requests fail with `ERR_INSUFFICIENT_RESOURCES`. Import
53
+ the one file you need.
54
+ - **The fixture is shared, and a variant may not change it.**
55
+ - **One file per variant**, so a broken variant breaks its own frame only.
56
+
57
+ A `<script>` in a drawing never runs. For behavior give the drawing a `setup(root)` function
58
+ (called once after the markup is in `root`, no cleanup, wire one delegated listener). Render each
59
+ state of a prototype with `ngStates({ closed: …, open: … }, { imports })` and swap them with
60
+ `setup: flow.on([{ click: '.trigger', go: 'open' }])`. To draw an open overlay, open it in the
61
+ template (`<et-select [open]="true">`); `ng()` returns the real panel and the frame places it.
62
+ `ngStates` wraps the states in `<div data-de-states style="display: contents">`, so a selector
63
+ rule must not depend on that wrapper.
64
+
65
+ **A repository with a sketch Storybook** draws every variant in the **same** story, side by
66
+ side, under the real geometry the thing ships in. The default Storybook is
67
+ {%storybookUrl%}; an app with its own sketch Storybook names its port in the plan file.
68
+
69
+ Either way:
70
+
71
+ - Sketches take inputs only and stay out of the application's build.
72
+ - Prototype, never refactor. Do not touch the shipped component until the treatment is
73
+ settled.
74
+ - Keep the rejected variants drawn, marked as rejected.
75
+
76
+ ### Notes
77
+
78
+ A note explains a state: why it looks this way, what it shows. A comment is feedback that needs
79
+ an answer. Write a note when nothing is asked of the reader.
80
+
81
+ A note is `<product>/notes/<timestamp>-<id>.json`:
82
+
83
+ ```json
84
+ { "part": "button", "state": "disabled", "point": { "x": 24, "y": 8 }, "size": "mobile", "text": "Muted, not hidden." }
85
+ ```
86
+
87
+ - `part`, `state` and `text` are required. `point` is optional, in CSS pixels.
88
+ - `size` is required when `point` is set: the preset, the CSS pixel width, or `"fitted"` the note was written at. A
89
+ pointed note shows only at that size; a note without a point shows at every size.
90
+ - A free note on a flow is an entry in the `notes` array of `flows/<name>.json`:
91
+ `{ "id": "…", "text": "…", "at": { "x": 0, "y": -40 } }`. `at` is optional, the note's top-left
92
+ corner on the flow canvas, and may be negative.
@@ -0,0 +1,78 @@
1
+ # Design exploration: flows and wireframes
2
+
3
+ ### Draw a flow
4
+
5
+ A flow joins states of pages into a path the user reads left to right in Studio's Flows view.
6
+ It is `<product>/flows/<name>.json`; `position` and `label` are optional:
7
+
8
+ ```json
9
+ {
10
+ "frames": [{ "part": "pages/library", "state": "empty", "position": { "x": 0, "y": 0 } }],
11
+ "lines": [
12
+ {
13
+ "from": { "part": "pages/library", "state": "empty" },
14
+ "to": { "part": "pages/film-detail", "state": "default" },
15
+ "label": "user adds a film"
16
+ }
17
+ ]
18
+ }
19
+ ```
20
+
21
+ Every flow line is labelled, and the element the label names is visible in the frame before it: a line
22
+ labelled "user clicks 'Log in'" starts from a frame that shows a "Log in" button. A line that names
23
+ nothing the reader can see, or a label for a control the page lacks, is a defect.
24
+
25
+ A line may join two states of one page. A frame may name a page that exists only as an open sketch;
26
+ the flow then shows its first variant. Lines hold for every preset. Without `position`, Studio
27
+ lays the frames out along the lines.
28
+
29
+ ### Draw a wireframe
30
+
31
+ A wireframe exists to iterate fast, in minutes per round, rough enough to redraw with a client at
32
+ the table. It answers one thing: which regions a screen has and what each region holds. These
33
+ rules are strict:
34
+
35
+ - **Keep what exists.** Before a sketch, list what the running app already does on that screen.
36
+ Keep it as a labelled box, and draw only what is still open.
37
+ - **One sketch per screen or flow**, never one per region or per detail. The variants differ in
38
+ layout: where the regions sit and how big they are.
39
+ - **Regions and names only.** A region is a box with a label; a list shows item names. Draw no
40
+ counts, badges, status markers, inspectors, size labels or field lists. If a detail matters,
41
+ write it as a word in the region label.
42
+ - **Never polish.** Do not fix alignment, spacing or a kit gap. When the kit lacks a shape, draw a
43
+ labelled box. Look at each shot only for a broken frame: overflow, a scroll bar, clipped text.
44
+ - **Draw it yourself.** A wireframe round is small work: no subagent, no friction report.
45
+ - **Stop early.** When the regions of the main screens are settled, the stage ends. Comments on
46
+ the look of a wireframe belong to the next stage, not to a new wireframe round.
47
+
48
+ A page may not import another page. To show a page inside a page ("in context"), embed it:
49
+ `embedPage('pages/system', { state, width, height, scale })` from `@design-system` answers a
50
+ drawing whose `body` is a frame of that page, drawn in the same product, sketch variant and theme
51
+ as the embedding frame. `width` and `height` are the viewport the page is drawn at (default
52
+ 1280 x 800; `height: 'auto'` fits its content), `scale` shrinks the frame. Never rebuild a page
53
+ from its elements to show it.
54
+
55
+ A page that has no parts yet draws grey stand-ins from the wireframe kit; pages and elements may
56
+ import it, components and foundations may not:
57
+
58
+ ```ts
59
+ import { box, heading, textLines, image, button, input, icon, select } from '@design-system/kit';
60
+ ```
61
+
62
+ Signatures are in `libs/cli/design/wireframe-kit.ts`: `box(children, { direction, gap, padding, width, height, grow, plain, stackBelow, fill })`,
63
+ `heading(text, { size })`, `textLines({ lines, width, size })`, `image({ width, height, ratio })`,
64
+ `button(label, { primary })`, `input({ label, placeholder, width })`, `icon({ size, glyph })`,
65
+ `select({ label, value, width })`, `tabs(labels, { active })`, `segmented(options, { active })`,
66
+ `checkbox(label, { checked })`, `badge(text)` and `dot({ hollow, size })`. Draw a control as its
67
+ type: a picker is a `select`, a section switch `tabs`, a size switch `segmented`, a count a `badge`,
68
+ a status a `dot`, never a row of buttons or an empty `icon`. Give an icon a `glyph` (`'plus'`,
69
+ `'close'`, `'menu'`, `'more'`, …; another name draws its first letter). Give the root box of a page or a
70
+ shell `fill: true` so it is as tall as the frame, instead of a hand-written `min-height`. Draw for
71
+ every preset, not one width: give a picture a `ratio` (`'2/3'`) instead of a fixed height, and give
72
+ a row `stackBelow: <px>`, the width below which it stacks its children, instead of fixed widths
73
+ that only fit the desktop. Never use `vh`, `dvh` or `svh` in a part: a part has no viewport of its own, so the unit measures Studio's frame, not the page. A full page is a frame of a fixed size. Put titles in `heading`, never in hand-written markup. Studio lists such a page under
74
+ "Wireframes" with its kit-use count. A shell is a normal element named by purpose (`shell-main`); draw a rough one with the kit, so each
75
+ page imports the shell instead of repeating it, and a shell pick lands in one file.
76
+ A dialog without its own URL is an element that a page state shows ("login open"). Examples in
77
+ `.ethlete/design/studio-lab`: `pages/film-detail`, `elements/shell-main`, `elements/login-dialog`,
78
+ `flows/sign-in.json`.
@@ -0,0 +1,54 @@
1
+ # Design exploration: the inbox and the MCP server
2
+
3
+ ### Read the inbox
4
+
5
+ The user comments on a state of a part in Studio, at a point, or on a sketch variant. The sketch of
6
+ an element also shows each page that uses it, with each variant swapped in: a comment there names
7
+ the page as its part and the element's sketch variant, so change the variant, not the page.
8
+
9
+ ```bash
10
+ et design inbox [--json] [--product <p>] # open comments and rebases, then what waits for the user
11
+ et design inbox done <id> --note <text> --by <model id> # set the part note, mark the thread addressed
12
+ et design comment reply <id> --by <model id> <text> [--question] # answer a comment thread (takes --product)
13
+ ```
14
+
15
+ Read the inbox at the start of a session and after each sketch you mark `ready`. Answer a comment
16
+ by changing the sketch or the part, then `inbox done <id> --note "…"`. The note replaces the `note` of the part the comment was made on (for a sketch variant, the product's part), so write it to explain the whole shape of the part, and pass the old note unchanged when it still holds. `done` fails without `--note`; only the user withdraws a comment without one, in Studio. `done` also stores your `--by` where the comment sat: in the authors of the sketch variant, or in the `madeBy` of the part. A pick or discard decision is listed as waiting
17
+ for the user: Studio merges or discards on the user's click, so never run `sketch merge` after a pick.
18
+
19
+ A comment is a thread: the user and you both reply. When a comment is unclear, ask with
20
+ `comment reply --question` instead of guessing. The thread then moves to the "waiting for the user" group
21
+ (`waitingForUser` in `--json`) and returns to the inbox when the user answers. A thread there is
22
+ not work for you.
23
+
24
+ A thread has three states. **Open** waits for an answer. **Addressed** (`addressed`: who, when, why,
25
+ the round) means `inbox done`, a new round, a merge or a discard answered it: it leaves the inbox and
26
+ the check, Studio shows it with an "addressed" badge, and you may still `comment reply` on it to say
27
+ what you changed. A reply by the user opens it again. **Resolved** means the user closed it in Studio -
28
+ only the user resolves. The file stays so the user can look back at it; a reply or `done` on it fails.
29
+
30
+ Pass `--question` only when you cannot go on without the user's answer. Studio lists only those
31
+ threads under "Questions for you". A report of what you did is no question: reply without the
32
+ flag, and the thread shows as "answered" until the user withdraws it or replies.
33
+
34
+ ### The `ethlete-design` MCP server
35
+
36
+ `ethlete-agents sync` registers `et design mcp` as `ethlete-design` in `.mcp.json` and
37
+ `.codex/config.toml` when `@ethlete/cli` is installed. When the tools are in your tool list, use them
38
+ instead of the CLI: each runs the `et design` command of the same name in the session's working
39
+ directory, takes its flags as arguments, and every write takes `by` (your model id). `product` may be
40
+ left out when the workspace has one. `shot` and `motion_shots` return the sheet image itself, so you
41
+ look at it without opening a PNG path.
42
+
43
+ - **Read:** `parts` (every part, as JSON), `call` (a call's `call.ts`, `fixture.ts`, the variant file to draw into and the frame URL; never change the fixture).
44
+ - **Check:** `check` (a product; with `call` and `variant` it lints, type-checks and renders that variant - run it after every edit of a variant), `sketch_check` (each variant laid over the product), `sketch_preview` (what a merge of a variant changes).
45
+ - **Shots:** `shot` (a part's states, `variants` for the open sketch), `motion_shots` (a motion at its keyframes, full and reduced, plus its tracks as JSON).
46
+ - **Sketch lifecycle:** `sketch_new`, `sketch_variant`, `sketch_round`, `sketch_report`, `sketch_ready`, `sketch_rebase`, `sketch_list`. `sketch_merge` and `sketch_discard` exist, but Studio runs them on the user's click; do not call them.
47
+ - **Comments:** `inbox` (what waits for you, then for the user), `comment_reply` (`question` waits for the user's answer), `inbox_done` (needs the new part `note`).
48
+
49
+ Part files are written with your own file tools; the server has no write tool for them. Call
50
+ `sketch_report` before every variant edit: it tells Studio what you build. It refuses a `ready` sketch: only when the
51
+ user asks for a change, run `et design sketch report … --reopen`, which moves the sketch back to in progress, and call
52
+ `sketch_ready` again when you are done. `sketch_ready` runs the
53
+ render check and refuses on any render issue; mark an element that renders wrong on purpose with
54
+ `data-et-skip="<rule>"`. A tool that fails returns the CLI's output; fix it and call again.
@@ -0,0 +1,124 @@
1
+ # Design exploration: the order of a design and drawing from the design system
2
+
3
+ ## The order of a design
4
+
5
+ A product design runs in this order. Each stage settles in calls before the next starts, and
6
+ each stage draws with what the stages before it settled (the wireframes draw with the kit only):
7
+
8
+ 1. **Wireframes**: early, rough concepts of the main flows (a legacy call with `mode: 'wireframe'`;
9
+ in a product, draw them with the wireframe kit, see "Draw a wireframe"). They show
10
+ which components the product needs, not how they look. The stage ends with an inventory in
11
+ the wireframe call: every part the wireframes need, each mapped to the SDK component it
12
+ starts from, or marked new with the component call that draws it. The inventory is the
13
+ queue of component calls:
14
+
15
+ ```ts
16
+ inventory: [
17
+ { part: 'Search field', sdk: 'et-input' },
18
+ { part: 'Match card', new: true, call: 'tomflix/components/match-card' },
19
+ ],
20
+ ```
21
+
22
+ 2. **Foundations**: colours, colour themes and surface themes (the project's `themes` in
23
+ `config.json`), plus the type scale, spacing and radius.
24
+ 3. **Logo and CI**, if the project needs them.
25
+ 4. **Components**, the inventory is their queue, from the SDK ones rendered with `ng()`, themed and set up for the project.
26
+ Each accepted one becomes a design-system entry.
27
+ 5. **Larger elements**: the shell, the navigation, headers, lists, built from the entries.
28
+ 6. **Pages**, built from the elements and the entries.
29
+ 7. **The working prototype**: the pages joined with `ngStates` and `flow.on`.
30
+
31
+ Do not start a stage before the one above it is settled, and do not draw a page from parts that
32
+ are not in the design system. If the user asks for a later stage first, say which earlier stage
33
+ is missing, and draw that first.
34
+
35
+ The stages map onto the layers of a product: wireframes, foundations, components, elements, pages. A settled
36
+ Legacy call with a stage counts for that stage in this order.
37
+
38
+ A later stage can show that an earlier one is incomplete. If a page needs a part that the system
39
+ does not have, add it to the inventory. A part becomes a component only when at least two hosts
40
+ draw the same case. Until then it stays in the one element or page that draws it. When a second
41
+ host draws it, open a component sketch, and list in its brief every host and every case each one
42
+ draws, so the component covers them all.
43
+
44
+ A component documents its states per axis, not every combination: for example kind, end mark and
45
+ interaction (rest, hover, focus-visible, selected, inert), plus only the combinations that look
46
+ different. A smaller piece with no states of its own, such as an icon set, is a foundation asset,
47
+ not a component.
48
+
49
+ When each of several cases is drawn at rest and in the same interactions, build the states and their grid with
50
+ `interactionRows(rows, { interactions: ['hover', 'active'], force: (props, interaction) => ({ ...props, interaction }) })`
51
+ from `@design-system` and spread the result into `definePart`; never write those states and the grid by hand.
52
+ `sketch check` prints `grid <rows> x <columns> ok`, or the states the grid leaves out; a state in two cells
53
+ fails it as `GRID`, in `design check` too.
54
+ Interaction states (a state name whose last word is hover, focus, pressed, active or selected, such as `row-hover`) live only on a control
55
+ part, one whose `controls` declare a control of a checked kind. On a shell, element or page they fail as
56
+ `CONTROL-STATE`: declare the component's controls (Q164), or extract the button or row as its own control part and draw its states there.
57
+ A drawn `button`, `a[href]`, `input`, `select`, `textarea` or control role without `data-et-control` on it or around
58
+ it is `CONTROL-PART-INPUT`: no control check sees it. Wrap it in `control(markup, name)` from
59
+ `@ethlete/components/design/control` and declare the name in `controls`; a sketch fails on one it adds,
60
+ `design check` only warns of one a merged part already draws. On a reused control part's render,
61
+ `control(drawn.body, name)` renames its control: never string-replace `data-et-control`.
62
+ `definePart({ interactions })` forces an interaction on the part's root only. To draw one element of the part
63
+ hovered, focused, pressed or disabled, such as one row of a list, wrap that element's markup in
64
+ `forceInteraction(markup, 'hover')` from `@design-system` inside `render`, driven by a prop; never write
65
+ `data-et-force` by hand.
66
+
67
+ ## Draw from the design system
68
+
69
+ A call that invents its own button, field or row does not match the calls beside it. **Before
70
+ you draw a part, look for it in this order, and draw new only when none of them has it:**
71
+
72
+ 1. The product's design system, `.ethlete/design/<product>/` (and its base).
73
+ 2. The real SDK components, rendered on the design server with `ng()` from `@design-explore`:
74
+
75
+ ```ts
76
+ const field = ng(`<et-form-field><et-label>Name</et-label><et-input /></et-form-field>`, {
77
+ imports: ['FORM_FIELD_IMPORTS', 'INPUT_IMPORTS'],
78
+ });
79
+
80
+ export default field.then((body) => drawing({ body }));
81
+ ```
82
+
83
+ Never `await` at the top level of a design module: WebKit can hang for good when a frame is
84
+ removed while the module evaluates, and `et design check` fails it with `TOP-LEVEL-AWAIT`. A
85
+ call default-exports a promise of its drawing; a part awaits inside its `render`.
86
+
87
+ The template is a real Angular template, and `imports` names exports of
88
+ `@ethlete/components`. The project's `providers` module in `config.json` supplies the themes.
89
+ Render every component of a drawing in **one** `ng()` call: each call is a new app, so two
90
+ calls repeat element ids. The server renders the built package, so in the SDK rebuild
91
+ `dist` after a component change.
92
+
93
+ To draw a form state (a value, an error, a touched field), give `ng()` (or `ngStates()`)
94
+ `fields`. Each entry becomes a signal form field the template binds as
95
+ `[formField]="fields.<name>"`. An error is a kind (`'required'`) or a kind and a message. A
96
+ field shows its errors only when it is touched:
97
+
98
+ ```ts
99
+ const form = ng(`<et-form-field><et-label>Email</et-label><et-input [formField]="fields.email" /></et-form-field>`, {
100
+ imports: ['FORM_FIELD_IMPORTS', 'INPUT_IMPORTS'],
101
+ fields: { email: { value: 'ada@', errors: [{ kind: 'email', message: 'Not an email' }], touched: true } },
102
+ });
103
+ ```
104
+
105
+ 3. Only then a new drawing. Build it from the two above, and say in the variant's `claim`
106
+ that the part is new.
107
+
108
+ **Colours come from the two SDK theming systems, never from tokens of your own.** A raised or
109
+ floating area sets a surface scope (`data-et-surface` or a surface scope class) and takes its
110
+ background, text, border and interaction states from the `et-surface` tokens of that scope. An
111
+ accent, a warning or a danger colour comes from the SDK colour theming (`--et-theme-color-*` under a
112
+ colour theme scope). Foundations define only the inputs of these themes. Never add a tier class
113
+ (`bg-surface-raised`), an accent utility or a `var(--accent)` to a part or to the product
114
+ stylesheet. Give a raised or floating area `data-et-auto-surface` and an interactive one
115
+ `data-et-surface-interactive`, never a picked `et-surface--<name>` class: the frame resolves them by elevation like
116
+ `etAutoSurface` and `etSurfaceInteractive`. Give a warning, error or success accent
117
+ `data-et-semantic-color="<type>"`, never a picked `et-color--<name>` class: the frame resolves it by type like
118
+ `injectSemanticColorTheme`. Read the theming skill of the SDK before the first colour in a drawing. `et design check` reports
119
+ a denied class from the product's `deniedClasses` list in `config.json`.
120
+
121
+ A part is one folder, `<product>/<layer>/<part>/`, with its drawing and states. Read the parts of
122
+ the product before the first drawing of a session. **A part exists only because the user picked a
123
+ sketch.** A `chosen` verdict in an old call is not enough. Never change a part's look without a
124
+ sketch the user decided.
@@ -0,0 +1,199 @@
1
+ # Design exploration: products, sketches and rounds
2
+
3
+ ### Create a product
4
+
5
+ ```bash
6
+ et design product new <name> [--base @ethlete/components|<path>] [--from-project <name>]
7
+ ```
8
+
9
+ It writes the `config.json` entry and the empty layer folders. A product on `@ethlete/components`
10
+ takes the SDK as its base, so its parts start from the real components rendered with `ng()`.
11
+ Without a base it gets the presets phone (390x844) and desktop (1440x900). A product's own `presets`
12
+ replace its base's whole: a desktop-only app lists `desktop` alone and draws no phone state. `--from-project` copies
13
+ `styles`, `head`, `providers` and `themes` from an old project entry. Studio never writes
14
+ `config.json`; the command does.
15
+
16
+ Every frame loads the product's tokens stylesheets once, before the part's own `styles`, so a part
17
+ never imports the tokens and never adds them to its `styles`. The product's config `tokens` lists
18
+ those parts in load order (`["foundations/tokens"]` when left out); a listed part that does not
19
+ exist yet is skipped. A product's own copy of a listed part, or a sketch of it, replaces the base's
20
+ in every frame. Never list a `tokens.css` in config `styles`.
21
+
22
+ A part file default-exports its `definePart(...)` and may also export named helpers, such as a piece of its
23
+ markup: `import { studioMark } from '@system/foundations/logo'`. Import a piece from the part that draws it;
24
+ never copy its markup into another part. A piece that uses the part's classes needs its stylesheet too
25
+ (`@system/foundations/logo.css?inline`), or from the part's default export when the part sets
26
+ `definePart({ styles })`: every drawing of that part gets it, so `render` returns only extra styles, or `drawing({ body })` with none. The layer
27
+ rules hold for these imports as well.
28
+
29
+ A component a host embeds exports its markup as such a helper, and a wrapper only its own frame needs, such as
30
+ padding that makes room for a focus ring, goes in `render` alone, never in that helper: the host places the
31
+ component itself and would inherit the wrapper's offset.
32
+
33
+ A product whose app uses Tailwind lists one stylesheet in config `styles` that imports the app's styles and
34
+ registers the drawing folders with `@source './'`. Sketches then use the app's utilities; plain CSS stays for what
35
+ utilities cannot express, such as camera geometry.
36
+
37
+ ### Propose a change as a sketch
38
+
39
+ A change to a part, or a new part, is a **sketch**: the question is the part, the variants are the
40
+ answers. Variants are drawn at the same geometry, and one variant wins only against the others.
41
+
42
+ ```bash
43
+ et design sketch new <layer>/<name> --variants a,b --by <model id> [--like <layer>/<name>] [--variant-note a=<text>]… [--product <p>] # each variant starts as a copy of the part
44
+ et design sketch new <layer>/<name> <layer>/<name>… --variants a --by <model id> # one change across several parts: one sketch, one ready, one merge
45
+ et design sketch target add <layer>/<name> <layer>/<name> --by <model id> # add a part to an open sketch's targets, seeded into each variant
46
+ et design sketch report <layer>/<name> --variant b --by <model id> "phone" # tell Studio what you build now
47
+ et design sketch report <layer>/<name> --variant b --by <model id> --done # you stopped drawing b; Studio shows its frames
48
+ et design sketch check [<layer>/<name>] [--fix] # each variant laid over the product
49
+ et design sketch ready <layer>/<name> --by <model id> # now the user can pick
50
+ et design sketch reject <layer>/<name> --variant b [--reason <text>] --by <model id> # only when the user rejected b; no pick or merge until reopened
51
+ et design sketch reopen <layer>/<name> --variant b [--reason <text>] --by <model id> # only when the user takes b back; the rejection stays in the history
52
+ ```
53
+
54
+ One change across several parts (an alias removal, a token rename) is one sketch with several targets: each
55
+ variant holds every target, and `ready` compares them all. `ready` and `preview` also name every part a `shared/`
56
+ edit reaches.
57
+
58
+ Variants are alternatives. A variant never stands for a state of another variant: a hidden or
59
+ collapsed mode of variant d is a further state of d, not a variant e. Before you draw a new control,
60
+ look for a control that already does the job (an active rail button that toggles its panel), and
61
+ draw that first.
62
+
63
+ A section of an app is a page under `pages/`, never a state of the shell. An element holds its
64
+ own chrome only. A sketch on an element adds no state whose difference is page content in a slot.
65
+
66
+ A variant mirrors the product layout and holds only the parts it changes. Draw two to four
67
+ variants, each with what it costs, and run `sketch check` before `ready`. A variant with problems
68
+ cannot be picked. A part in a variant keeps every state the part has in the product: `sketch check`
69
+ and `sketch ready` fail on a dropped state, and warn when two stylesheets of one part define the same class. A problem the product already had prints as `NOTE (was there before)` and fails
70
+ neither. Use `sketch list` to see the open ones.
71
+ `sketch check` also runs tsc over each variant with its `@shared/` and `@system/` imports, so never write a
72
+ tsconfig of your own. It warns of a variant stylesheet that restyles a class of `shared/`, of a
73
+ variant file nothing imports, and of a `shared/` export the variant does not import; `design check` warns of
74
+ an export in a merged part's `shared/` that nothing imports, and (`STALE-REPLACE`) of a `.replace('<…')` or
75
+ `.replace(/<…/)` on markup that neither the part nor a part it uses draws. To delete a file of a part, delete it in the variant: a merge deletes the
76
+ product file the picked variant no longer holds.
77
+
78
+ Each variant's note, what it is and what it costs, goes in with `sketch new --variant-note a=<text>`, once
79
+ per variant: `sketch.json` keeps it apart from the part's `definePart({ note })`, and Studio shows it in the
80
+ variant's head. A merge keeps the part's note, takes its `--note`, or gives a new part the picked variant's note.
81
+ `sketch new` and `sketch variant` write their files in the checkout's Prettier format; after an edit,
82
+ `sketch check --fix` formats the variants before it checks them. A sketch command
83
+ without `--product` takes the product that holds the sketch.
84
+
85
+ Start a new part from a close one with `--like`: `sketch new pages/inbox --like pages/system`
86
+ copies the product's `pages/system` into each variant, renamed to the target and without its
87
+ `madeBy`; `--like pages/system:b` copies variant b of the open sketch on it, with that sketch's
88
+ `shared/` folder.
89
+
90
+ Rendering for one variant lives in that variant's files. `shared/` holds only code every variant
91
+ uses: do not give a shared helper a parameter, branch, import or style rule that only one variant, or
92
+ a variant you dropped, needs. A merge takes `shared/` whole, so what stays there ships with the pick.
93
+
94
+ Code the variants of one sketch have in common (sample data, a switch, a helper) goes in the
95
+ sketch's `shared/` folder, next to the variant folders, never into copies per variant. A part in a
96
+ variant imports it as `@shared/<path>`, and a shared file may import `@system/...` and
97
+ `@shared/...`. A part outside a sketch may not import `@shared/`. A variant that needs a shared file
98
+ changed holds its own copy at `<variant>/shared/<path>`; `@shared/<path>` finds that copy first, and a merge
99
+ of that variant takes it. On a merge, `shared/` moves into
100
+ the target's folder as `shared/` with its imports made relative; when no part imports it, it is
101
+ dropped. With several targets, each takes only the files it imports, directly or through another
102
+ shared file; a file nobody imports goes back to the target that held it, and the merge refuses one no
103
+ target held. `sketch new` refuses targets whose `shared/` folders hold one path with different contents. Only the target may import it: a merge refuses while another part of the picked variant
104
+ does, so move that code into the part. `sketch new` prints each file it puts in `shared/`, for example
105
+ the `shared/` folder of a merged page: edit it there, as part of the sketch, not in a variant copy.
106
+
107
+ ```ts
108
+ // sketches/pages-flows/shared/flow-data.ts
109
+ export const flows = [{ name: 'Checkout', steps: 4 }];
110
+
111
+ // sketches/pages-flows/a/pages/flows/flows.ts
112
+ import { flows } from '@shared/flow-data';
113
+ ```
114
+
115
+ An asset (a mark, logo, icon, picture or font) is one file in `.ethlete/design/<product>/assets/`,
116
+ never a copy inlined into parts. A part imports it as `@assets/<file>`: the default import is a URL
117
+ for `<img src>`; an SVG that must follow tokens (`currentColor`, `var(--accent)`) imports with
118
+ `?raw` and goes inline, for example `@assets/icons/<name>.svg?raw`. A stylesheet, the product's
119
+ `styles.css` or a part's, uses `url('@assets/<file>')`, for example in an `@font-face`. A foundation
120
+ part may wrap an asset in a named export. A product finds its base product's assets too. A sketch
121
+ variant adds or changes an asset in its own `<variant>/assets/` folder (`sketch new` and `sketch variant`
122
+ print it next to the part file), and a merge copies it into the product's. Size an inline SVG with
123
+ `svgAsset(mark, { size: 32 })` from `@design-system`, never by replacing its `width`/`height` as a
124
+ string; `class` and `attrs` (`{ 'aria-hidden': 'true' }`) set the rest of the root's attributes. `design check` fails an SVG asset with no root `<svg>` or without
125
+ `xmlns="http://www.w3.org/2000/svg"` (an `<img src>` and an image viewer do not draw it). The part hash behind `design check` and "changed outside a sketch" counts the bytes of
126
+ the assets a part uses.
127
+
128
+ Every change to a merged part goes through a sketch, also a small one: new copy, sample data, an
129
+ added state. When there is nothing to choose, the sketch has one variant (`--variants a`), and the
130
+ user merges it or comments on it. Never edit a merged part directly, or the user cannot compare or
131
+ comment on the change in Studio. `design check` warns, and Studio marks the part "changed", when a
132
+ merged part changed outside a sketch; only a merged sketch on that part clears it.
133
+
134
+ A sketch on a foundations part such as `foundations/tokens` keeps the part's overview drawing: the
135
+ variant adds its token group as a state, or extends that group's state. It never replaces the
136
+ drawing with a demo scene, since the merge would drop every other group. A demo may be an extra state.
137
+
138
+ Name the variant you work on with `--variant`. Studio marks it as drawing, and hides its frames,
139
+ while the latest report names it. `sketch new` starts no report, so `report --done` follows only a report
140
+ of your own; it prints the next steps. `sketch new`, `sketch variant` and each report record your
141
+ model id as an author of the variants they write, and `sketch ready` records it on every variant
142
+ that has no author yet. A merge adds the picked variant's authors to the `madeBy` the part file
143
+ already holds, and never removes it.
144
+
145
+ ### Combine variants in a new round
146
+
147
+ Studio never combines variants. When the user asks for one in a comment ("solid like a, outline
148
+ like b"), draw it as a new variant in a new round:
149
+
150
+ ```bash
151
+ et design sketch variant <layer>/<name> c --from a --by <model id> --round "Solid a, outline b" --note "r1 showed pill and square; the user wants a's solid with b's outline"
152
+ ```
153
+
154
+ `--from` copies a variant into the new one, sets the sketch back to in progress and clears the
155
+ pick; it refuses while the decision is a discard (the user picks a variant first). Without `--round` the new variant joins the running round; with it, `--note` is required and
156
+ goes on the running round: what it showed and why its variants lost. Older variants stay pickable.
157
+ The command prints the notes of the previous round. Fix a round's title or note later with `sketch round <layer>/<name> <round> --title … --note … --by <model id>`; `sketch list` shows each sketch's rounds.
158
+ Letters continue across rounds (r1: a, b; r2: c, d). `sketch variant <layer>/<name> c,d --from a` adds
159
+ several variants at once; with `--round` they all start the new round. A new round answers the comments on the
160
+ `--from` variant and marks them "addressed in round" with the new round's key. A variant without `--round` fails while the sketch has open comments and lists them: a variant that answers a comment starts a new round. Draw the combined
161
+ variant and mark the sketch `ready` again. `sketch new --round <title> --note <text>` names
162
+ round 1 and sets its note; `--round` without `--note` fails. `sketch ready` refuses while the running round has no note; set it with `sketch round`.
163
+ `sketch ready` also shoots every state of every variant and of the product's part: when not one pixel differs
164
+ in any of them, it merges the sketch itself and logs it as an `auto` entry in the product's `accepted.json`
165
+ ("No visible change in any state: merged automatically."). Any difference or failed shot leaves it `ready`.
166
+ A problem the product already had before the merge does not block it (the check prints it as a note); only a problem the merge adds does.
167
+ Run `sketch ready` again on a `ready` sketch to repeat the check and the auto merge.
168
+
169
+ Mark a sketch `ready` only when no change to it waits on anything: no open decision, no helper still to
170
+ land, no "once X is decided I adapt the sketch". A pending change keeps the sketch in work and out of the
171
+ merge queue: ask first, make the change, then mark it `ready`. Record the wait with
172
+ `et design sketch hold <layer>/<name> --until "<what it waits on>" --by <model id>` (a `ready` sketch goes back
173
+ in progress) and `sketch release` it once the change is in.
174
+
175
+ ### Your model id: `--by`
176
+
177
+ Every command that writes takes `--by <model id>` and fails without it: `sketch new`, `variant`, `report`,
178
+ `ready`, `rebase`, `merge`, `discard`, `inbox done` and `comment reply`. The id is the exact model
179
+ id as free text, for example `claude-opus-5-5`, `gpt-6.1-sol` or `gemini-3-argon`. Studio shows it
180
+ on the variant, the reply and the part, so the user sees which model made what.
181
+
182
+ **Never guess your id.** Use the one your prompt names. If your prompt names none and you do not
183
+ know your own exact id, ask the coordinator or the user before you write.
184
+
185
+ ### The user decides, Studio merges
186
+
187
+ The user picks a variant, or discards the sketch, in Studio. **Studio merges on the user's click.
188
+ Never run `sketch merge` or `sketch discard` yourself, and never pick a variant.** Both mark
189
+ the open comments on the sketch's variants addressed: the user's click answers them. Comments on the
190
+ product's parts stay. If a part the variant replaces changed
191
+ in the product since the sketch was created, the merge refuses: bring each variant up to date, run
192
+ `et design sketch rebase <layer>/<name>`, and mark it `ready` again. `sketch preview <layer>/<name>
193
+ <variant>` lists the elements and pages a merge changes. The note on a part records why it has its
194
+ current shape. The user's reason is optional: with one, the merge sets the note from it; without
195
+ one, the part keeps the `note` the picked variant file holds, so write that note while you draw.
196
+
197
+ After the user approves a direct edit of a merged part (no sketch), run `et design accept <layer>/<name> --product <p> --by <model id> --note <why>` so `design check` stops warning `changed outside a sketch`. Never accept an edit the user did not approve.
198
+
199
+ To drop a merged part the user no longer wants (folded back into its host, say), run `et design part remove <layer>/<name> --product <p> --by <model id>`: it deletes the folder, its `merged.json` entry and its tsconfig path, and resolves its comments. It refuses while another part imports it or an open sketch targets it. Never `git rm` a part by hand.
@@ -0,0 +1,25 @@
1
+ # Design exploration: shots and screenshots
2
+
3
+ **Do not send a screenshot.** The user keeps the call open. Screenshot only for your own
4
+ check that a variant renders. In a repository with `et design`, take it with
5
+ `et design shot <layer>/<name> --states [--variants]`: one contact sheet of every state, and
6
+ every variant of the open sketch, with a label per cell; below each variant row, a diff row marks
7
+ the pixels that differ from the merged state in red, or says "no pixel change" (with ", but the markup differs" when only the markup changed, e.g. both sides miss the same content). It prints the PNG path last. `--scale 2` enlarges a small part; `--crop x,y,w,h` cuts each cell to that CSS-pixel box, to judge hairlines. `--interaction hover` forces an interaction on every cell. `--state a,b` draws only those states, to compare them side by side. With `--variants`, `--round r2` or `--variant i,j` draws only those variants next to the merged row, so the current round stays readable; it filters the picture, never the checks. With `--variants`, `--diff-props` compares each variant with the merged part drawn with the variant's state props, so changed props do not paint the diff red. It draws
8
+ undimmed, whatever Studio shows. Do not write a scratch script for batch shots.
9
+ `et design motion shots <layer>/<name> <motion>` draws a motion at its keyframes, in full and reduced motion, into one sheet, and writes its tracks (element, properties, start, duration, easing) as JSON next to it.
10
+
11
+ ## Screenshots
12
+
13
+ **Off by default.** The user has the call open and sends you a picture when something looks
14
+ wrong. Take one only when the code cannot tell you whether two variants really differ, and
15
+ never to put in front of the user. Copy `shoot-template.mjs` from this skill folder to the repository
16
+ root.
17
+
18
+ ```bash
19
+ node shoot.mjs <story-id> 1100 760 out.png
20
+ ```
21
+
22
+ - `waitUntil: 'networkidle'` never settles on an iframe that holds a live dev server
23
+ connection. Use `'domcontentloaded'`.
24
+ - `:hover`, `:focus-visible` and `:active` need a CDP session and `CSS.forcePseudoState`.
25
+ Several hold open at once, so one image shows them all. The template does this.
@@ -30,4 +30,14 @@ Commits are **lean** and follow {%commitRuleSource%}:
30
30
  refuses an untracked file: run `git add -N <that file>` for that one path
31
31
  first. Pass a formatter or `eslint --fix` the exact paths you changed, never a
32
32
  list from `git diff` or `git status` - that list holds other sessions' files.
33
+ - **Few commits.** One commit per finished slice of work: the code, its specs, its
34
+ changeset and its plan note ("as built") go in together. Fix format, lint and
35
+ review findings before that commit, not in a follow-up commit.
36
+ - **Notes are not commits of their own.** A plan, finding or status note rides
37
+ with the slice it belongs to; a note-only session commits once per finished
38
+ round, never once per finding or status line.
39
+ - **Sketches:** one commit per finished round and one per merge.
40
+ - **Never rewrite shared history.** No rebase, no `--fixup`, no `--amend` in a
41
+ checkout that other sessions share: it rewrites their commits too.
42
+ - Brief every subagent with these commit rules.
33
43
  - Don't push unless asked.
@@ -47,5 +47,6 @@ This section is ours, not upstream.
47
47
  - **Check the facts before you recommend.** A recommendation built on an assumed file format or
48
48
  an assumed existing tool is worse than none. Look it up first, and say in the round when a
49
49
  look-up proved an earlier recommendation wrong.
50
+ - **Decide technical questions yourself.** Put only product and UX questions to the user.
50
51
  - **Close with the shared state.** When the frontier is empty, list every decision in one short
51
52
  summary and ask the user to confirm it before you write it anywhere.