@cychien/ezdesign 0.0.0-stage → 0.8.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.
@@ -0,0 +1,247 @@
1
+ # Write the project's DESIGN.md
2
+
3
+ > Only for a turn whose prompt says 增強設計 (the design harness) is on for it, or a request that
4
+ > asks for it by name. In any other turn, handle the request as if you had never read this file.
5
+
6
+ ## What this file is
7
+
8
+ `DESIGN.md` at the project root captures the project's visual language in broad strokes: the
9
+ character of its colour, type, space and form, and the handful of values that anchor them. It is a
10
+ direction agents start from when they design, not a specification they are held to. **Keep it
11
+ broad.** A file that settles every size, step and shadow leaves the work nothing to decide, and
12
+ everything made from it comes out looking alike. The fine detail - the full type ramp, the spacing
13
+ scale, the shadow recipes, each component's values - lives in the design system and the code, where
14
+ the components step and the work itself put it.
15
+
16
+ It follows the DESIGN.md format (`npx -y -p @google/design.md designmd spec`): YAML frontmatter
17
+ carrying machine-readable tokens, then markdown sections in a fixed order with canonical headings.
18
+ Here **the tokens are anchors, not a full set**: the few values the language is recognised by.
19
+ Sections may be omitted when irrelevant, but the ones present keep the spec's order and exact
20
+ headings, so the file stays portable across DESIGN.md-aware tools.
21
+
22
+ **Components are not defined here.** A markdown file cannot carry a component's states, variants
23
+ and behaviour completely, so the components step turns this file's language into the stack's own
24
+ design system and a component set, and records where in `.ezdesign/config.json`. This file
25
+ therefore carries no `components:` group in its frontmatter and no `## Components` section; a
26
+ reader who needs a component goes to the design system. See [components.md](components.md).
27
+
28
+ ## The frontmatter
29
+
30
+ ```yaml
31
+ ---
32
+ name: <project title>
33
+ description: <one-line tagline>
34
+ colors:
35
+ primary: "#b8422e"
36
+ canvas: "#faf7f2"
37
+ ink: "#1f1d1a"
38
+ typography:
39
+ display:
40
+ fontFamily: "Cormorant Garamond, Georgia, serif"
41
+ fontWeight: 300
42
+ body:
43
+ fontFamily: "Inter, system-ui, sans-serif"
44
+ fontSize: "1rem"
45
+ rounded:
46
+ soft: "8px"
47
+ omitted:
48
+ - spacing
49
+ ---
50
+ ```
51
+
52
+ - **Anchors only.** The colours the language is recognised by - the ground, the ink, the accent or
53
+ two - and not every tint and state. One entry per typographic role that has a character of its
54
+ own, usually display and body, with its family and the one or two properties that define it. A
55
+ radius when the form language has one. No scale: a ramp of steps is the design system's.
56
+ - **List what you leave out under `omitted`**, so the linter reads a missing group as a decision.
57
+ - **Keys describe, not enumerate**: `oxblood-deep`, `canvas`, `ink-mute`, not `blue-800`,
58
+ `gray-100`. The one exception is the main accent, which goes under `primary` because the linter
59
+ expects it. Use the names the project already uses when it has them; do not rename to Material
60
+ defaults.
61
+ - **Colours accept any valid CSS colour string.** Hex is the portable default, but keep an
62
+ incumbent `rgb()`, `hsl()` or `oklch()` when that is the project's normative source. One format
63
+ per token, and never the same token restated in prose with a different value.
64
+ - **The schema has no place for shadows, motion or breakpoints.** When one is part of the
65
+ character, describe it in prose. Do not invent a top-level group for them.
66
+
67
+ ## The body: canonical sections, in order
68
+
69
+ 1. `Overview`
70
+ 2. `Colors`
71
+ 3. `Typography`
72
+ 4. `Layout`
73
+ 5. `Elevation & Depth`
74
+ 6. `Shapes`
75
+ 7. `Do's and Don'ts`
76
+
77
+ The format also defines `Components` between Shapes and Do's and Don'ts; this harness leaves it
78
+ out on purpose. Omit any other section the project has nothing real for, rather than filling it.
79
+ Every section is a short paragraph or a few bullets. The whole file reads in a couple of minutes.
80
+
81
+ ## Step 1: Load current state
82
+
83
+ - `PRODUCT.md` comes first. If it is missing, run [product.md](product.md) and come back: the
84
+ Overview's voice and the visual constraints come from it.
85
+ - Read `.ezdesign/config.json` for the stack and the browser tool. If it is missing or names no
86
+ browser tool, run [stack.md](stack.md) and come back.
87
+ - If `DESIGN.md` already exists, **do not silently overwrite it**. Show the user what is there, and
88
+ ask whether to refresh, overwrite or merge. Use the structured question tool when available;
89
+ otherwise ask and wait.
90
+ - Decide the path by scanning first (Scan mode, Step 2). If the scan finds no tokens, no component
91
+ files and no rendered site, offer Seed mode; do not switch silently.
92
+
93
+ ## Scan mode: read the language the project already speaks
94
+
95
+ The project has tokens, components or rendered output. This is the default.
96
+
97
+ ### Step 2: Look at what exists
98
+
99
+ Read the sources for the values the project defines, and the rendered page for which of them
100
+ carry it:
101
+
102
+ - **The sources**: CSS custom properties, the Tailwind config or `@theme` block, CSS-in-JS theme
103
+ files, token files, the global stylesheet, and the main components - button, card, input,
104
+ navigation, dialog.
105
+ - **The rendered page**: at the url your prompt gives, otherwise at the dev server, which you
106
+ start if it is not up. Measure it with `node <skill>/scripts/page.mjs measure <url>`, where
107
+ `<skill>` is the folder above this file's `reference/`: it renders the page at desktop and at
108
+ 390px and tallies what the visible elements use - text, background and border colours, each
109
+ background's share of the screen, families, sizes, weights, line heights, radii, shadows,
110
+ padding, gaps and container widths - with the project's own tokens. **Frequency** is what a
111
+ stylesheet cannot tell you: the colour on three hundred elements is the ground, the one on two is
112
+ the accent, a rule matching nothing is not in the language, so let the counts say what dominates.
113
+ A `redirected` field means it measured the page the url sent it to, a sign-in most of the time,
114
+ not the product: measure a path that stays, or lean on the sources.
115
+ Look at it too: `node <skill>/scripts/page.mjs shots <url> <dir>` writes a desktop and a mobile
116
+ screenshot into a folder outside the project. Only when the script cannot run - there is no
117
+ Chrome - do the same with the browser tool.
118
+
119
+ Where a source and the page disagree, the page is what users see.
120
+
121
+ ### Step 3: Name the character
122
+
123
+ From what you found, say what the language is, not everything it contains:
124
+
125
+ - **Colour**: the ground, the ink, the accent, and how much of a screen the accent gets.
126
+ - **Type**: the pairing and the contrast between display and body; how large, how tight, how
127
+ loud the scale runs. Not each step.
128
+ - **Space**: dense or airy, and whether the rhythm is even or varied.
129
+ - **Depth and form**: flat, layered or lifted; sharp, softened or round.
130
+
131
+ Stop at what defines it. A value that appears once is drift, and a value the language does not
132
+ depend on belongs to the design system.
133
+
134
+ ### Step 4: Ask for what cannot be extracted
135
+
136
+ The rest is judgment, and the user is the client. Ask in two rounds of at most three questions
137
+ each, waiting between rounds, each question led by your own proposal so the client corrects rather
138
+ than composes. Use the structured question tool when available; otherwise ask and wait. Choose the
139
+ questions for this project from these, skip any the page already answers plainly, and add one of
140
+ your own when the project needs it:
141
+
142
+ - **Overview voice**: mood adjectives, the aesthetic philosophy in two or three sentences, and the
143
+ anti-reference - what this must never be mistaken for.
144
+ - **Elevation philosophy**: flat, layered or lifted.
145
+
146
+ Carry a line from `PRODUCT.md` only when it is a durable brand commitment that actually constrains
147
+ the visual system. Page strategy and surface concepts do not belong here.
148
+
149
+ ### Step 5: Write DESIGN.md
150
+
151
+ The frontmatter, then the body:
152
+
153
+ ```markdown
154
+ # Design System: [Project Title]
155
+
156
+ ## Overview
157
+
158
+ [Two short paragraphs, in plain words: personality, density and aesthetic philosophy, and the
159
+ anti-reference. No named metaphor - a metaphor becomes the idea every later design reaches for.
160
+ End with a short **Key Characteristics:** list, three to five bullets.]
161
+
162
+ ## Colors
163
+
164
+ [The palette's character in a sentence or two, then one line per anchor.]
165
+ - **[Descriptive Name]** (`{colors.canvas}`): [Its role, and roughly how much of a screen it gets.]
166
+
167
+ ## Typography
168
+
169
+ **Display Font:** [Family] (with [fallback])
170
+ **Body Font:** [Family] (with [fallback])
171
+
172
+ [The pairing's personality, and how the scale behaves - its contrast and its loudness - in one or
173
+ two sentences. Not a list of steps.]
174
+
175
+ ## Layout
176
+
177
+ [Density and rhythm, and the spatial idea in a sentence or two.]
178
+
179
+ ## Elevation & Depth
180
+
181
+ [Flat, layered or lifted, in a sentence or two. "No shadows" is said explicitly, with how depth is
182
+ conveyed instead.]
183
+
184
+ ## Shapes
185
+
186
+ [The form language in a sentence or two.]
187
+
188
+ ## Do's and Don'ts
189
+
190
+ ### Do:
191
+ - **Do** [a tendency the language has].
192
+
193
+ ### Don't:
194
+ - **Don't** [a direction the language is not, which the incumbent system or the user confirmed].
195
+ ```
196
+
197
+ ### Step 6: Lint, confirm, refine
198
+
199
+ Run `npx -y -p @google/design.md designmd lint DESIGN.md` and fix what it reports, in the
200
+ document. Writing this file changes no other file: measuring a page turns up things that are wrong
201
+ with it, and they are the document's subject, not your to-do list.
202
+
203
+ Then show the user what you wrote, point out the creative choices that were yours (the colour names
204
+ you gave the palette, the voice) and which parts you asked rather than measured, and offer to revise a section. When
205
+ this step runs as part of a larger request, put that offer in one line at the end of its reply
206
+ instead, and do not stop to wait for an answer.
207
+
208
+ ## Seed mode: a visual language before there is code
209
+
210
+ ### Step 1: `PRODUCT.md`
211
+
212
+ It is the prerequisite. If it is missing, run [product.md](product.md) and come back.
213
+
214
+ ### Step 2: Derive and write
215
+
216
+ Propose a visual language from `PRODUCT.md`, and discuss it with the user before writing. The
217
+ product's job sets the density and the register of the type: a dashboard for people who read
218
+ numbers all day is dense, with a small, tight body scale (12px and 14px labels are right there); a
219
+ brochure for a first visit is airy, with a large display scale and few colours. The brand
220
+ commitments set the colours and marks that are fixed; everything else is a proposal, led by you and
221
+ confirmed by the client in rounds of at most three questions. Write the same file as Scan mode,
222
+ with the anchors you proposed as the frontmatter, and mark it as a seed in the Overview. Re-run in
223
+ Scan mode once there is code.
224
+
225
+ ## Style guidelines
226
+
227
+ - **Character over quantity.** Say what the language is like, and give the value only where it is
228
+ the anchor. A reader should come away knowing what belongs and what does not, with the decisions
229
+ inside that left to them.
230
+ - **Tendencies, not requirements**: "leans on", "mostly", "reaches for". The file is a direction;
231
+ write it as one.
232
+ - **Descriptive over technical**: "Gently curved edges (8px)" over `rounded-lg`. Lead with the
233
+ description, put the value in parentheses.
234
+ - **Specific to this product.** Prose that would read the same pasted onto another product has
235
+ captured nothing.
236
+
237
+ ## Pitfalls
238
+
239
+ - Do not paste raw class names; translate them.
240
+ - Do not write out scales: no type ramp, spacing scale, shadow recipe or per-state colour. They
241
+ are the design system's.
242
+ - Do not document components here; they are the components step's.
243
+ - Do not overwrite an existing `DESIGN.md` without asking.
244
+ - Do not duplicate `PRODUCT.md`; this file is strictly visual.
245
+ - Do not rename or paraphrase the canonical headings: `Colors`, not "Color Palette"; `Typography`,
246
+ not "Typography Rules". Tooling parses the exact headers.
247
+ - Do not add frontmatter groups outside `colors`, `typography`, `rounded`, `spacing` and `omitted`.
@@ -0,0 +1,125 @@
1
+ # Search the inspiration database
2
+
3
+ > Only for a turn whose prompt says 增強設計 (the design harness) is on for it, or a request that
4
+ > asks for it by name. In any other turn, handle the request as if you had never read this file.
5
+
6
+ ## What it is
7
+
8
+ A curated collection of interfaces that work, each entry carrying the reason it works and the case
9
+ where it would be the wrong choice. Every entry is the work of some of the best product designers in
10
+ the world, chosen by hand because it is good: study it the way a designer studies a master's work,
11
+ not the way you skim an average page. It is searched by meaning - a description of what the piece has
12
+ to show - and entries carry tags in their curator's own words (`onboarding`, `dark popover`), which
13
+ nudge a search when you name one. It is an outside source: nothing in `PRODUCT.md` or `DESIGN.md` is decided by it or written in its
14
+ words. The collection is not in this skill or in the project; the commands below query it, and you
15
+ see what you asked for.
16
+
17
+ ## The commands
18
+
19
+ ```
20
+ npx -y @cychien/ezdesign@latest inspire --query "<what the piece has to show>" [--tag onboarding] [--limit 5]
21
+ ```
22
+
23
+ A `--query`, `--tag`, or both. A search prints a block per result: what it is, its tags, `Shows:`
24
+ (what the entry is), `Components:` and `Actions:` (what is on it, and what can be done there),
25
+ `Why it works:` and `Wrong when:`, then local paths to its images and, when the entry has it,
26
+ `code:` - a working implementation of it. `(approximate)` in the heading means that entry was read
27
+ off a screenshot, so its inventory is an estimate rather than a reading. The images and the code
28
+ are downloaded to disk, so open them the way you open any file - when the steps below say to.
29
+
30
+ There is no fixed list of tags, so lean on the query: it finds by meaning, and a tag you guess only
31
+ helps when some entry happens to carry it.
32
+
33
+ It works without a review session, a daemon or a dev server. It needs a token, stored once by
34
+ `npx -y @cychien/ezdesign@latest login`.
35
+
36
+ When the prompt names the ezdesign command to run, run that one instead of `npx -y @cychien/ezdesign@latest`.
37
+ Never look for another copy or version of ezdesign to run - a repository checkout, a global install,
38
+ a different package version: the command you were given is the only one.
39
+
40
+ ## How to search
41
+
42
+ - **A batch.** Write the query first: one or two sentences saying what the piece has to show - the
43
+ elements on it, the register its wording is in, the actions it offers. "A settings page with a
44
+ two-column form, a destructive delete behind a confirm dialog, labels in Traditional Chinese."
45
+ Run it once, with `--limit 5`. The design takes one direction, but its moves may come from more
46
+ than one result.
47
+ - **An explore.** Search only for a variant whose direction would gain from a precedent; a variant
48
+ does not need one, and the round is about arrangement, not inspiration.
49
+ - **A plain request.** Even "a pricing table" is a query: `--query "a pricing table"` finds it by
50
+ meaning.
51
+
52
+ ## What to take from a result
53
+
54
+ A result need not match the request: one that covers most of it, or one part of it well, is a
55
+ result, since nothing in the collection was made for this product. Do not run the search again
56
+ because the first answer was not a fit.
57
+
58
+ **Learn why it works, and how it is made.** Every entry is the work of an outstanding designer, so
59
+ study it the way a designer studies a master's work, for both. The intent: what each element and
60
+ pattern is there to do for the person using it - why this surface is dark, why this gap is wider
61
+ than that one, why the description stops where it does, why the action sits there - and what would
62
+ go wrong without it. The surface, just as closely: how it arranges and presents the information,
63
+ and the refined details that make it look finished - how a label sits against its value, how a
64
+ group is framed, the size steps between a title, its text and its action, a subtle ground or edge.
65
+ That is where much of a precedent's value is, and what your first idea usually lacks. `Why it
66
+ works:` names the move; the image and the code show how it is carried out. Take a result seriously
67
+ before you judge it: a part you leave out is one you understood and found wrong for this product,
68
+ and your reply says why.
69
+
70
+ Read a result in two steps, and go on to the second only for the results you learn from:
71
+
72
+ 1. **The text and the first image**, of every result. `Shows:`, `Components:` and `Actions:` say
73
+ which part of your request it covers, `Why it works:` names the move, and `Wrong when:` says when
74
+ it is the wrong choice; the first image is the whole piece at desktop size, and shows the move.
75
+ Judge the direction by both: the text says what an entry is, the image whether it looks the part.
76
+ The other images are the phone and further states: open as many of them as the judgment needs.
77
+ 2. **The code**, of each result you learn from - one or several - and of none you set aside. A
78
+ screenshot is one moment, and a precedent understood from it alone is understood wrong: the code
79
+ is the precedent working. Read the whole file, not its first lines - the states and the motion are
80
+ usually further down. Read it to understand how the piece behaves, not to paste it: what appears
81
+ only on hover or focus, what is hidden until chosen, what moves, and the proportions behind what
82
+ the image shows.
83
+
84
+ **Mind the motion.** The code shows what moves, when, how far and on what curve. Work out what each
85
+ motion is for - confirming an action, showing where something came from or went, drawing the eye to
86
+ what changed - and use motion in your piece only where it does that same job here. Keep it as short
87
+ and quiet as the job allows, in the easing the principles give, and let it fall away under
88
+ `prefers-reduced-motion`. Motion that is only there because the precedent had it is decoration.
89
+
90
+ **Make it yours.** Bring what you learned into a design of your own for this product: the intent
91
+ carried over, expressed in this project's tokens, type, components and motion, and held to
92
+ `baseline.md`. Carry relationships, not numbers: the space between groups against the space inside
93
+ them, the padding a surface gives its content, the size steps between a title, its text and its
94
+ action - each in the project token nearest in role, keeping the proportion, so a gap half its
95
+ card's padding stays half. The entry's palette, fonts, exact values and content do not transfer.
96
+ The piece should read as this product's own, not as the precedent in a new skin.
97
+
98
+ **Starting from a pattern.** When one pattern is right for this case - it solves the problem in
99
+ front of you, and `Wrong when:` does not describe this product - you may start from it: take its
100
+ structure as the base, then adapt it to this product's content, its point and hierarchy, and its
101
+ tokens. Even then it is a starting point, not a copy: every part you keep, you keep because you know
102
+ why it works here.
103
+
104
+ A move that `DESIGN.md` does not describe is not a reason to drop it: `DESIGN.md` is a direction,
105
+ and a precedent is how the design gets past its first idea. What does stop a move is `PRODUCT.md`,
106
+ `baseline.md`, the craft floor in `principles.md`, and `Wrong when:` - read it against the product
107
+ in `PRODUCT.md`, and when the situation it names is this one, drop that result.
108
+
109
+ You are not obliged to use a precedent's pattern. It is there to learn from, and the direction stays
110
+ yours: often what it teaches - a spacing rhythm, a way of bringing one thing forward, a motion that
111
+ explains a change - is the whole of what belongs in your design. When it does not fit at all, leave
112
+ it. The one thing not to do is set it aside unread.
113
+
114
+ ## Where a result may be named
115
+
116
+ In your reply to the user, and nowhere else. Never write an entry, a slug, a source or an image
117
+ path into `DESIGN.md`, `PRODUCT.md`, a code comment, a commit message or any other file in the
118
+ project. A project repository is often shared; the collection is not.
119
+
120
+ ## When it does not answer
121
+
122
+ `no matches for ...`, or an error and exit code 2 - no token, a refused token, a service that
123
+ cannot be reached. Either way, say nothing to the user about it, and carry on with `DESIGN.md`, the
124
+ project's own kin and your own judgment. This step never
125
+ blocks the work, never gets a retry, and never another way to run the command.