@kiwidata/grimoire 0.1.2 → 0.1.4
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/AGENTS.md +56 -4
- package/README.md +29 -2
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/check.js +3 -3
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/configure.d.ts +3 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +19 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/map.d.ts.map +1 -1
- package/dist/commands/map.js +10 -11
- package/dist/commands/map.js.map +1 -1
- package/dist/core/archive.d.ts.map +1 -1
- package/dist/core/archive.js +32 -43
- package/dist/core/archive.js.map +1 -1
- package/dist/core/check.d.ts.map +1 -1
- package/dist/core/check.js +115 -104
- package/dist/core/check.js.map +1 -1
- package/dist/core/ci.d.ts.map +1 -1
- package/dist/core/ci.js +50 -69
- package/dist/core/ci.js.map +1 -1
- package/dist/core/configure.d.ts +14 -0
- package/dist/core/configure.d.ts.map +1 -0
- package/dist/core/configure.js +434 -0
- package/dist/core/configure.js.map +1 -0
- package/dist/core/detect.d.ts.map +1 -1
- package/dist/core/detect.js +153 -26
- package/dist/core/detect.js.map +1 -1
- package/dist/core/diff.d.ts.map +1 -1
- package/dist/core/diff.js +62 -93
- package/dist/core/diff.js.map +1 -1
- package/dist/core/doc-style.d.ts +0 -4
- package/dist/core/doc-style.d.ts.map +1 -1
- package/dist/core/doc-style.js +28 -23
- package/dist/core/doc-style.js.map +1 -1
- package/dist/core/docs.js +106 -100
- package/dist/core/docs.js.map +1 -1
- package/dist/core/health.js +55 -77
- package/dist/core/health.js.map +1 -1
- package/dist/core/hooks.d.ts +0 -3
- package/dist/core/hooks.d.ts.map +1 -1
- package/dist/core/hooks.js +0 -11
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/init.d.ts +2 -0
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +230 -406
- package/dist/core/init.js.map +1 -1
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +55 -65
- package/dist/core/list.js.map +1 -1
- package/dist/core/log.d.ts.map +1 -1
- package/dist/core/log.js +23 -33
- package/dist/core/log.js.map +1 -1
- package/dist/core/map.d.ts +15 -2
- package/dist/core/map.d.ts.map +1 -1
- package/dist/core/map.js +257 -194
- package/dist/core/map.js.map +1 -1
- package/dist/core/shared-setup.d.ts +0 -40
- package/dist/core/shared-setup.d.ts.map +1 -1
- package/dist/core/shared-setup.js +87 -52
- package/dist/core/shared-setup.js.map +1 -1
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/status.js +42 -52
- package/dist/core/status.js.map +1 -1
- package/dist/core/test-quality.d.ts +0 -8
- package/dist/core/test-quality.d.ts.map +1 -1
- package/dist/core/test-quality.js +24 -30
- package/dist/core/test-quality.js.map +1 -1
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/core/trace.js +31 -41
- package/dist/core/trace.js.map +1 -1
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +61 -11
- package/dist/core/update.js.map +1 -1
- package/dist/core/validate.d.ts +1 -4
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +126 -148
- package/dist/core/validate.js.map +1 -1
- package/dist/utils/config.d.ts +15 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +63 -42
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/fs.d.ts +0 -12
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +0 -12
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/paths.d.ts +0 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +0 -6
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/spawn.d.ts +0 -3
- package/dist/utils/spawn.d.ts.map +1 -1
- package/dist/utils/spawn.js +0 -3
- package/dist/utils/spawn.js.map +1 -1
- package/package.json +1 -1
- package/skills/grimoire-apply/SKILL.md +84 -16
- package/skills/grimoire-audit/SKILL.md +21 -1
- package/skills/grimoire-bug/SKILL.md +48 -9
- package/skills/grimoire-commit/SKILL.md +2 -1
- package/skills/grimoire-design/SKILL.md +259 -0
- package/skills/grimoire-design-consult/SKILL.md +200 -0
- package/skills/grimoire-discover/SKILL.md +65 -2
- package/skills/grimoire-draft/SKILL.md +85 -2
- package/skills/grimoire-plan/SKILL.md +61 -18
- package/skills/grimoire-pr/SKILL.md +4 -6
- package/skills/grimoire-pr-review/SKILL.md +45 -114
- package/skills/grimoire-precommit-review/SKILL.md +205 -0
- package/skills/grimoire-refactor/SKILL.md +5 -5
- package/skills/grimoire-review/SKILL.md +74 -147
- package/skills/grimoire-verify/SKILL.md +33 -0
- package/skills/references/adversarial-personas.md +225 -0
- package/skills/references/brand-tokens-format.md +186 -0
- package/skills/references/code-quality.md +140 -0
- package/skills/references/design-heuristics.md +138 -0
- package/skills/references/design-input-formats.md +190 -0
- package/skills/references/pattern-guard.md +180 -0
- package/skills/references/refactor-scan-categories.md +152 -0
- package/skills/references/review-personas.md +405 -0
- package/skills/references/security-compliance.md +22 -1
- package/skills/references/visual-fidelity.md +206 -0
- package/templates/brand-tokens-example.json +13 -0
- package/templates/brand-voice-example.md +22 -0
- package/templates/design-tool-setup-stub.md +59 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire-design
|
|
3
|
+
description: Generate UI/UX designs grounded in a stated user problem — variants, component states, brand-token compliance, and derived Gherkin scenarios. Use when the user wants to design, wireframe, mock up, or rethink a UI surface.
|
|
4
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
5
|
+
metadata:
|
|
6
|
+
author: kiwi-data
|
|
7
|
+
version: "0.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# grimoire-design
|
|
11
|
+
|
|
12
|
+
Generate UI/UX designs grounded in a stated user problem. Produces variants, enumerates component states, lints for brand drift, and derives Gherkin scenarios that hand off cleanly to `grimoire-draft` and `grimoire-plan`.
|
|
13
|
+
|
|
14
|
+
This is one skill, not three (see ADR-0017). Brand-drift lint is a *mode* of this skill, not a separate skill — same artifact (`tokens.json`), same skill, different verb.
|
|
15
|
+
|
|
16
|
+
## Triggers
|
|
17
|
+
- User describes UI/UX work: a new screen, a redesign, a flow, a component
|
|
18
|
+
- User mentions a design tool by name (Figma) in the context of producing work
|
|
19
|
+
- Loose match: contains "design", "wireframe", "ui", "ux", "mockup", "layout", "figma" combined with "new", "draft", "explore", "redesign", or "rethink"
|
|
20
|
+
|
|
21
|
+
## Routing
|
|
22
|
+
- Non-UI behavior change (API, data model, business logic) → `grimoire-draft` directly
|
|
23
|
+
- Brand-only updates (new logo, new color, capture missing tokens) → stay here; use `--capture-brand` or `--lint`
|
|
24
|
+
- Tech-check before designing ("should I worry about anything?") → `grimoire-design-consult`
|
|
25
|
+
- Bug in an existing UI → `grimoire-bug`
|
|
26
|
+
- Pure refactor of UI code (no behavior change) → no grimoire artifact; just do it
|
|
27
|
+
|
|
28
|
+
## Workflow
|
|
29
|
+
|
|
30
|
+
### 1. Qualify
|
|
31
|
+
Is this actually UI/UX work? If the user is asking for an API contract, a data model change, or backend logic with no user-facing surface, route to `grimoire-draft` and stop.
|
|
32
|
+
|
|
33
|
+
If a `.grimoire/changes/<change-id>/consult.md` exists for this change-id (from a prior `grimoire-design-consult` run), read it now. Parse the `## Inferred assumptions` and `## Inferred givens` sections verbatim — these exact H2 headers are written by `grimoire-design-consult` and must not be paraphrased or fuzzy-matched. Propagate both lists into every subsequent prompt in this workflow. Specifically:
|
|
34
|
+
|
|
35
|
+
- **Step 6 (Variant Generation)**: exclude patterns that violate any given. For example, if a given says "no JS-heavy patterns due to perf budget", do not produce a variant that relies on client-side state machines. State the exclusion in the affected variant's tradeoff line so reviewers see why the pattern was avoided.
|
|
36
|
+
- **Step 9 (Derive Gherkin)**: reference inferred assumptions in scenario preconditions where applicable (e.g., a Given line that mirrors the assumption "user is authenticated before reaching this surface"). Cite givens by their consult.md bullet when a scenario's expected outcome depends on the given.
|
|
37
|
+
|
|
38
|
+
Carry the open-questions list (also in `consult.md`) forward as warnings — surface unresolved items to the user when they affect a variant choice or scenario, but do not block on them. Open questions are flags, not gates.
|
|
39
|
+
|
|
40
|
+
### 2. Problem Statement (soft gate)
|
|
41
|
+
Ask for the user problem this design addresses. If the user provides one up-front, write it to `.grimoire/changes/<change-id>/designs/problem.md` and continue.
|
|
42
|
+
|
|
43
|
+
If the user skips or describes the design without a problem (e.g., "make a settings page"), emit the soft-gate warning verbatim:
|
|
44
|
+
|
|
45
|
+
> No user problem articulated. Generic designs ≈ wasted iteration.
|
|
46
|
+
> The most common cause of redesigns is missing problem context.
|
|
47
|
+
> Strongly recommend stating the problem first.
|
|
48
|
+
|
|
49
|
+
Then ask: "Proceed without problem statement? (y/N)". On `y`, log `problem_statement: skipped (user override)` in `problem.md` and continue. On `N` or no answer, offer the framework menu:
|
|
50
|
+
|
|
51
|
+
| option | format |
|
|
52
|
+
|---|---|
|
|
53
|
+
| jtbd | When [situation], I want to [motivation], so I can [outcome] |
|
|
54
|
+
| lean-ux | Business problem / users / outcomes / solutions / hypotheses |
|
|
55
|
+
| hmw | How might we [verb] [user] [outcome]? |
|
|
56
|
+
| pr-faq | Press release + FAQ working-backwards |
|
|
57
|
+
| freeform | (user writes their own) |
|
|
58
|
+
|
|
59
|
+
Render the chosen template for the user to fill in. Write the result to `problem.md`.
|
|
60
|
+
|
|
61
|
+
### 3. User Flow & Success Metrics
|
|
62
|
+
Ask for a **friction-log narrative** as the default minimum-viable level — a short prose description of the current user journey and where it hurts. Offer (but never force) two upgrades: Mermaid journey diagram, then service blueprint.
|
|
63
|
+
|
|
64
|
+
Separately — not bundled — ask "What are the user's current pain points?" Accept a bulleted list, free text, or "none known". Capture pain points in `problem.md` under a dedicated `## Pain Points` section. Variants generated in step 6 must each state which pain points they address (or explicitly mark "deferred").
|
|
65
|
+
|
|
66
|
+
Ask for at least one measurable success metric (e.g., "reduce support tickets about lockouts by 50%"). If the user cannot articulate one, note `no success metric — design effectiveness will be hard to evaluate` as an assumption in `problem.md`.
|
|
67
|
+
|
|
68
|
+
### 4. Lazy Component Inventory
|
|
69
|
+
If `.grimoire/docs/components.md` is absent AND the project has UI code, ask the user before scanning. On approval, scan for:
|
|
70
|
+
|
|
71
|
+
- `components.json` (shadcn-ui marker)
|
|
72
|
+
- `tailwind.config.{js,ts}` (Tailwind setup)
|
|
73
|
+
- MUI / Chakra / Mantine / Radix imports in `package.json`
|
|
74
|
+
- `*.stories.{ts,tsx,jsx,js}` (Storybook stories)
|
|
75
|
+
|
|
76
|
+
Write findings to `.grimoire/docs/components.md` listing detected components with file paths and known variants. Skip the scan entirely if no UI signals are present (greenfield or non-UI surface). Subsequent variants prefer existing components over net-new designs and flag net-new explicitly.
|
|
77
|
+
|
|
78
|
+
### 5. Brand Grounding
|
|
79
|
+
Read `.grimoire/brand/tokens.json` and `.grimoire/brand/voice.md` if they exist. Use the format documented in `../references/brand-tokens-format.md`. Required groups: `color.*`, `font.family.*`, `font.size.*`, `spacing.*`.
|
|
80
|
+
|
|
81
|
+
**Malformed `tokens.json`**: if JSON parse fails or required `$value` fields are missing, emit a one-line error:
|
|
82
|
+
|
|
83
|
+
> tokens.json malformed at `<path>` — `<parse-error-description>`. Continuing without brand grounding.
|
|
84
|
+
|
|
85
|
+
Continue the workflow without brand grounding rather than crashing. Variants will use neutral defaults and the user can fix the file and re-run. Anchor: pre-mortem failure mode #6 — undetected brand drift produces low-quality output, but a crashed skill produces zero output.
|
|
86
|
+
|
|
87
|
+
**Absent `tokens.json`**: continue silently with neutral defaults. Note in the generated HTML that no tokens were found.
|
|
88
|
+
|
|
89
|
+
### 6. Variant Generation
|
|
90
|
+
Produce **3 variants by default**. Each variant explicitly states the tradeoff it optimizes for (e.g., "minimal clicks", "maximum information density", "progressive disclosure") and lists which pain points from step 3 it addresses.
|
|
91
|
+
|
|
92
|
+
Output target by precedence — pick the highest-fidelity option available:
|
|
93
|
+
|
|
94
|
+
1. **Figma MCP** configured (`project.design_tool.mcp` present) → query Figma; reference variants by node ID in `.grimoire/changes/<change-id>/designs/variants.md`
|
|
95
|
+
2. **Static HTML** → write `.grimoire/changes/<change-id>/designs/variant-{n}.html` per variant. Self-contained, no CDN. Brand tokens injected as CSS custom properties in `:root` per `../references/design-input-formats.md` §5
|
|
96
|
+
3. **ASCII** → inline in `variants.md` for trivial scope (copy change, single-field form, TUI surface) per `../references/design-input-formats.md` §6
|
|
97
|
+
|
|
98
|
+
If Figma MCP is configured but unreachable, emit one-line "Figma MCP unreachable — `<error>`. Falling back to static HTML." and continue with HTML. Never crash.
|
|
99
|
+
|
|
100
|
+
Each variant must reference brand tokens from `tokens.json` (if present) and consult `../references/design-heuristics.md` to avoid common omissions (missing feedback, no escape hatch, contrast too low, novel pattern where a standard exists).
|
|
101
|
+
|
|
102
|
+
When the user requests a revision of a specific variant ("redo variant 2 with a wizard pattern"), regenerate only that variant; leave the others unchanged.
|
|
103
|
+
|
|
104
|
+
### 7. State Enumeration
|
|
105
|
+
For each interactive component in the selected variant, walk the state checklist from `../references/design-heuristics.md` §5:
|
|
106
|
+
|
|
107
|
+
| state | required? |
|
|
108
|
+
|---|---|
|
|
109
|
+
| default | yes |
|
|
110
|
+
| loading | yes |
|
|
111
|
+
| empty | yes |
|
|
112
|
+
| error | yes |
|
|
113
|
+
| success | conditional (forms, async actions) |
|
|
114
|
+
| disabled | conditional (inputs, buttons) |
|
|
115
|
+
| readonly | conditional (inputs) |
|
|
116
|
+
| over-limit | conditional (rate-limited / quota'd actions) |
|
|
117
|
+
|
|
118
|
+
If the user attempts to mark the design complete with a required state missing, emit the soft gate:
|
|
119
|
+
|
|
120
|
+
> Missing `<state>` state. Most "the design didn't work in production"
|
|
121
|
+
> complaints trace to missing error / loading / empty handling.
|
|
122
|
+
|
|
123
|
+
Ask "Skip `<state>` state? (y/N)". On confirm, log the skip as an unvalidated assumption in `problem.md` under a `## Skipped States` section (created if absent). Infer conditional state upgrades from change context — a form submission upgrades `success` to required; a rate-limited action upgrades `over-limit` to required.
|
|
124
|
+
|
|
125
|
+
### 8. Render Preview
|
|
126
|
+
For HTML output, write a single `.grimoire/changes/<change-id>/designs/preview.html` showing each component in each state, side-by-side. Each state is labeled and visually distinct (loading shimmer, error banner, empty placeholder, etc.). Designer opens the file directly in a browser — no `grimoire preview` CLI command exists in v1.
|
|
127
|
+
|
|
128
|
+
Skip preview rendering when output is Figma (the Figma file IS the preview) or ASCII (the markdown table IS the preview).
|
|
129
|
+
|
|
130
|
+
### 9. Derive Gherkin
|
|
131
|
+
Propose draft `.feature` files at `.grimoire/changes/<change-id>/features/<capability>/`. One Scenario per (component × state). Each Scenario has Given / When / Then steps grounded in the design.
|
|
132
|
+
|
|
133
|
+
Apply surface-conditional adversarial scenarios per `../references/adversarial-personas.md`:
|
|
134
|
+
|
|
135
|
+
- `project.surface: web` → keyboard-navigation, screen-reader-announcement, color-contrast scenarios
|
|
136
|
+
- `project.surface: mobile` → touch-target-size, gesture-conflict scenarios
|
|
137
|
+
- `project.surface: tui` → keyboard-navigation only (no screen-reader, no contrast)
|
|
138
|
+
|
|
139
|
+
Apply security tags per `../references/security-compliance.md`. Components handling user input get `@input-validation` and at least one negative scenario.
|
|
140
|
+
|
|
141
|
+
Present the proposed scenarios for review: "Review proposed scenarios — accept, edit, or reject each." Accept all / accept some / edit / reject any. Rejected scenarios do not get written.
|
|
142
|
+
|
|
143
|
+
### 10. Handoff
|
|
144
|
+
When the user accepts proposed scenarios, the change folder is populated. Suggest the next step:
|
|
145
|
+
|
|
146
|
+
> Run `grimoire-draft` to refine the manifest and ADRs, or `grimoire-plan` to break into tasks.
|
|
147
|
+
|
|
148
|
+
Skill is done.
|
|
149
|
+
|
|
150
|
+
## Revision Mode
|
|
151
|
+
|
|
152
|
+
Triggers: user says "revise", "iterate", "refine", "update variant", "change the design", "I want to try again with variant N", "add a state", "update the scenarios", or `--revise`.
|
|
153
|
+
|
|
154
|
+
Revision mode re-enters an **existing** change without restarting the full workflow. Steps 1–5 (problem statement, user flow, component inventory, brand grounding) are already done — skip them unless the user says the problem itself has changed.
|
|
155
|
+
|
|
156
|
+
**Revision workflow:**
|
|
157
|
+
|
|
158
|
+
1. Read the existing artifacts for the change-id: `problem.md`, `designs/variants.md` or `variant-*.html`, `features/`. Show a brief summary of what exists:
|
|
159
|
+
> Current design: 3 variants (wizard, inline, progressive). Accepted variant: 2. 8 Gherkin scenarios. 4 component states documented.
|
|
160
|
+
|
|
161
|
+
2. Ask one question: "What would you like to change?"
|
|
162
|
+
|
|
163
|
+
3. Based on the answer, identify the minimum affected steps and run only those:
|
|
164
|
+
|
|
165
|
+
| User says | Re-run |
|
|
166
|
+
|---|---|
|
|
167
|
+
| "redo variant 2 with a different pattern" | Step 6 — single variant only |
|
|
168
|
+
| "add empty state to the search field" | Step 7 — state enumeration for that component |
|
|
169
|
+
| "the problem is actually X not Y" | Update `problem.md`, re-run step 3 (user flow + pain points), then step 6 for all variants |
|
|
170
|
+
| "make it more accessible" | Step 9 — re-derive adversarial Gherkin scenarios |
|
|
171
|
+
| "show me 2 more variants" | Step 6 — additive, do not overwrite existing variants |
|
|
172
|
+
| "the preview looks wrong" | Step 8 — regenerate preview only |
|
|
173
|
+
|
|
174
|
+
4. Leave all other artifacts unchanged.
|
|
175
|
+
|
|
176
|
+
5. If Gherkin scenarios from a prior pass were already accepted, ask before overwriting:
|
|
177
|
+
> These scenarios were previously accepted — overwrite with revised versions? (y/N)
|
|
178
|
+
|
|
179
|
+
6. On completion, suggest `grimoire-draft` or `grimoire-plan` if not yet run, or `grimoire-verify` if implementation is already in progress.
|
|
180
|
+
|
|
181
|
+
**Revision is not a full restart.** If the design direction has fundamentally changed (different surface, new user, different problem), start a new change-id via `grimoire-design` fresh rather than revising.
|
|
182
|
+
|
|
183
|
+
## Modes
|
|
184
|
+
|
|
185
|
+
The flags below are **conversational invocations** the AI interprets, not real CLI subcommands of the `grimoire` binary. Per ADR-0010, skills are pure markdown — there is no executable code behind `--lint`, `--variants=N`, or `--capture-brand`. The AI reads these as user intent and runs the corresponding flow.
|
|
186
|
+
|
|
187
|
+
### `--capture-brand` / "capture brand" / "capture brand guidelines"
|
|
188
|
+
When the user says "capture brand" or invokes `--capture-brand`, run the brand-capture flow using the same prompts as `grimoire init` onboarding (see `src/core/init.ts` `askPreferences()` brand-capture block):
|
|
189
|
+
|
|
190
|
+
- Ask for primary / secondary / accent color (hex, validated against `/^#([0-9a-f]{3}|[0-9a-f]{6})$/i`; re-prompt on invalid)
|
|
191
|
+
- Ask for font family, base font size, base spacing unit
|
|
192
|
+
- Optional: logo path, favicon path
|
|
193
|
+
- Ask for one Do-example and one Don't-example for voice/tone
|
|
194
|
+
- Write `.grimoire/brand/tokens.json` in DTCG format (see `../references/brand-tokens-format.md`)
|
|
195
|
+
- Write `.grimoire/brand/voice.md` from the captured do/don't pair
|
|
196
|
+
|
|
197
|
+
Before writing, glob the repo root for existing `tokens.json` or `design-tokens.json`. If found, ask "Use existing `<path>`? (Y/n)" — on yes, copy it to `.grimoire/brand/tokens.json` instead of prompting from scratch.
|
|
198
|
+
|
|
199
|
+
Do **not** create `.grimoire/brand/` unless the user has explicitly opted in via this mode or the onboarding flow.
|
|
200
|
+
|
|
201
|
+
### `--lint` / "lint brand" / "lint brand drift"
|
|
202
|
+
When the user says "lint brand" or invokes `--lint`, run the brand-drift lint flow described in the Lint Mode section below.
|
|
203
|
+
|
|
204
|
+
### `--variants=N` / "give me N variants" / "N variants"
|
|
205
|
+
When the user invokes `--variants=N` or says "give me 5 variants", override the default count of 3 in step 6. Accept any positive integer up to 10. Above 10, ask the user to confirm — variants become noise beyond that count.
|
|
206
|
+
|
|
207
|
+
## Lint Mode
|
|
208
|
+
|
|
209
|
+
Brand-drift lint cross-references hardcoded values in code against `.grimoire/brand/tokens.json` and suggests token replacements.
|
|
210
|
+
|
|
211
|
+
### Scope
|
|
212
|
+
- Default: scan **staged files** (`git diff --cached --name-only`) — fast, dev-loop-friendly
|
|
213
|
+
- `--all` / "scan all" → scan all tracked files (slower; honor `.grimoire/mapignore`)
|
|
214
|
+
- File types: `.css`, `.scss`, `.less`, `.html`, `.jsx`, `.tsx`, `.vue`, `.svelte` (configurable per project conventions)
|
|
215
|
+
|
|
216
|
+
### What it looks for
|
|
217
|
+
- Hardcoded color hex values (`#0066ff`, `#06f`, `rgb(...)`)
|
|
218
|
+
- Hardcoded `px` / `rem` / `em` values
|
|
219
|
+
- Hardcoded `font-family` strings
|
|
220
|
+
|
|
221
|
+
Each hit is cross-referenced against `tokens.json`. If a near-match exists, emit a suggestion:
|
|
222
|
+
|
|
223
|
+
> `src/components/Button.css:14` — `#0066ff` matches `color.primary`. Replace with `var(--color-primary)`.
|
|
224
|
+
|
|
225
|
+
### Clean state
|
|
226
|
+
If zero drift is found, emit exactly:
|
|
227
|
+
|
|
228
|
+
> No brand drift detected across N files scanned.
|
|
229
|
+
|
|
230
|
+
And exit 0. Do **not** print a long "everything passed" report — clean state is a one-liner. False positives erode trust faster than missed findings.
|
|
231
|
+
|
|
232
|
+
### Malformed `tokens.json`
|
|
233
|
+
Catch JSON parse errors and missing `$value` fields. Emit a one-line error with the parse description and exit non-zero — this is a misconfiguration, not a lint finding:
|
|
234
|
+
|
|
235
|
+
> tokens.json malformed at `<path>` — `<parse-error>`. Fix or remove.
|
|
236
|
+
|
|
237
|
+
Do not attempt partial lint with a half-parsed token file.
|
|
238
|
+
|
|
239
|
+
### Absent `tokens.json`
|
|
240
|
+
Clean exit. Emit:
|
|
241
|
+
|
|
242
|
+
> No brand tokens to lint against. Run `grimoire init` or `grimoire-design --capture-brand` first.
|
|
243
|
+
|
|
244
|
+
Do not error — absence is a valid state for projects that haven't onboarded brand capture yet.
|
|
245
|
+
|
|
246
|
+
### Integration
|
|
247
|
+
`grimoire-precommit-review` invokes this lint automatically when `.grimoire/brand/tokens.json` exists. The lint logic is also referenced from `../references/visual-fidelity.md` (the shared reference used by `grimoire-review`, `grimoire-precommit-review`, and `grimoire-pr-review` for the visual-fidelity tier).
|
|
248
|
+
|
|
249
|
+
## Important
|
|
250
|
+
- **Pure markdown.** This skill is interpreted by an LLM per ADR-0010. Do not generate executable code or shell scripts to satisfy any step. The variant HTML files are output artifacts; the workflow itself is prose the AI follows.
|
|
251
|
+
- **Ask before scanning large codebases.** Component-inventory scans (step 4) and `--lint --all` scans can be expensive on monorepos. Confirm with the user before scanning more than ~500 files.
|
|
252
|
+
- **Honor `.grimoire/mapignore`.** Any scan (component inventory, brand lint) must respect mapignore patterns. Reuse the same exclusion logic as `grimoire map`.
|
|
253
|
+
- **Do not create `.grimoire/brand/` unprompted.** The directory only appears when the user opts in via onboarding or `--capture-brand`. Reading from a missing brand directory is a valid state — fall back to neutral defaults.
|
|
254
|
+
- **Never log Figma access tokens.** The token lives in `FIGMA_ACCESS_TOKEN` env var, read by the MCP server. Never write it to config, never echo it in transcripts, never include it in artifacts.
|
|
255
|
+
- **Soft gates are warnings, not blockers.** The problem-statement gate (step 2) and the state-enumeration gate (step 7) warn aggressively but accept user override. Record overrides as assumptions so they surface in review.
|
|
256
|
+
- **Brand drift findings are suggestions, not blockers.** Lint mode proposes token replacements; it does not auto-rewrite code. The user decides whether to apply.
|
|
257
|
+
|
|
258
|
+
## Done
|
|
259
|
+
When the user accepts proposed Gherkin scenarios and the change folder contains `problem.md`, `designs/`, and `features/`, the workflow is complete. Suggest `grimoire-draft` (manifest + ADRs) or `grimoire-plan` (task breakdown) next.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire-design-consult
|
|
3
|
+
description: Pre-design technical consult. Security and data personas interview the designer (or engineer) about a proposed change before any artifacts exist, surfacing assumptions and constraints early. Use before grimoire-design or grimoire-draft when the change might touch sensitive data, compliance, or risky surfaces.
|
|
4
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
5
|
+
metadata:
|
|
6
|
+
author: kiwi-data
|
|
7
|
+
version: "0.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# grimoire-design-consult
|
|
11
|
+
|
|
12
|
+
A **pre-design Q&A** with security and data personas. The designer brings a problem statement; the personas ask clarifying questions; the skill distills the transcript into assumptions, givens, and open questions that downstream `grimoire-design` and `grimoire-draft` consume.
|
|
13
|
+
|
|
14
|
+
This is **not** a review. No artifacts are required to exist. No blocker/suggestion findings are produced. The output is a conversation transcript plus inferred constraints.
|
|
15
|
+
|
|
16
|
+
## Triggers
|
|
17
|
+
- User says "consult", "tech check", "tech check this idea", "should I ...", "what should I worry about", or "before designing"
|
|
18
|
+
- User wants security or data sign-off on an idea before investing in design work
|
|
19
|
+
- Loose match: "talk through", "sanity check", "pre-design", "thinking about" combined with concerns about data, auth, compliance, or PII
|
|
20
|
+
|
|
21
|
+
## Routing
|
|
22
|
+
- User already has a clear design direction and just wants to produce variants → `grimoire-design`
|
|
23
|
+
- A full design with artifacts (problem.md, variants, scenarios) already exists and the user wants critical feedback → `grimoire-review`
|
|
24
|
+
- User describes a bug rather than a new design → `grimoire-bug` or `grimoire-bug-report`
|
|
25
|
+
- Change is purely behavioral / non-UI and the user is ready to spec it → `grimoire-draft`
|
|
26
|
+
|
|
27
|
+
## Prerequisites
|
|
28
|
+
- A `change-id` (existing or new). If no change exists yet, create the directory `.grimoire/changes/<change-id>/` with just a placeholder so `consult.md` has a home — no manifest, features, decisions, or tasks needed.
|
|
29
|
+
- `.grimoire/config.yaml` exists (for surface, compliance, brand context). If absent, the consult still runs but skips the briefing axes that would require it.
|
|
30
|
+
|
|
31
|
+
## Skipping
|
|
32
|
+
This skill is optional. Engineers and designers can skip straight to `grimoire-draft` or `grimoire-design`. When the user skips and the change touches PII / payments / auth / compliance tags, downstream skills emit a one-line soft suggestion ("Consider `grimoire-design-consult` first — this change touches PII") but do not block.
|
|
33
|
+
|
|
34
|
+
## Modes
|
|
35
|
+
|
|
36
|
+
These are **conversational invocations** the AI interprets, not commander.js subcommands of the `grimoire` binary. Per ADR-0010, skills are pure markdown — the AI decides how to behave based on what the user said.
|
|
37
|
+
|
|
38
|
+
- `--personas=security,data,qa` or "add QA persona" / "include the product manager" — adds personas beyond the default Security + Data pair. Allowed names match `../references/review-personas.md` §4 (product, senior, security, qa, data, adversarial-user). Do not load Code Style Reviewer or Contrarian — they are diff-time personas.
|
|
39
|
+
- "shorter consult" / "quick consult" — cap each persona at 3 questions instead of the usual 5-8
|
|
40
|
+
- "skip security" / "skip data" — drop a default persona for a single run (rare; warn the user once if their problem statement mentions PII / payments / auth and they skip security)
|
|
41
|
+
|
|
42
|
+
## Workflow
|
|
43
|
+
|
|
44
|
+
### 1. Collect Minimal Input
|
|
45
|
+
Open with a brief orientation so the designer knows what to expect — display this verbatim before asking anything:
|
|
46
|
+
|
|
47
|
+
> **Design consult** — two expert personas (Security Engineer + Data Engineer) will ask you questions about your idea before any design work begins. Their goal is to surface constraints and assumptions early, not find problems with a finished design.
|
|
48
|
+
>
|
|
49
|
+
> We'll start with your problem statement, then the personas take turns. Each asks **one question at a time** — you'll see `[Persona — Q N/total]` so you always know where you are.
|
|
50
|
+
|
|
51
|
+
Collect inputs in three sequential turns — not a combined prompt:
|
|
52
|
+
|
|
53
|
+
**Turn 1:** Ask only for the problem statement.
|
|
54
|
+
> What user problem or business need does this design address? (One paragraph is enough.)
|
|
55
|
+
|
|
56
|
+
If the user provides a clear problem statement, proceed. Do not gate on optional inputs.
|
|
57
|
+
|
|
58
|
+
**Turn 2:** Derive a change-id slug from the problem statement and confirm in one line.
|
|
59
|
+
> I'll track this change as `<slug>` — OK, or would you prefer a different name? (A "change ID" is just a short folder name we use to group your design artifacts.)
|
|
60
|
+
|
|
61
|
+
On confirm or no reply, use the slug. On correction, use the user's name.
|
|
62
|
+
|
|
63
|
+
**Turn 3 (optional context):** Ask for user flow and data together — these are supplementary and the personas will cover what's missing.
|
|
64
|
+
> Two optional questions — type "none" or skip with Enter for either:
|
|
65
|
+
> 1. Proposed user flow (1–2 sentences — e.g. "user taps X → sees Y → confirms Z"). Note: this should describe an existing journey or rough idea, not a solution — the design will derive the flow.
|
|
66
|
+
> 2. What data will this design touch? (e.g. "user profiles", "payment methods", "none")
|
|
67
|
+
|
|
68
|
+
### 2. Build the Mini-Briefing
|
|
69
|
+
Follow the briefing pattern in `../references/review-personas.md` §1, but **pared down** for pre-design context. Skip the feature inventory (the change has no features yet) and focus on the axes that matter for security / data Q&A:
|
|
70
|
+
|
|
71
|
+
**Sources** (subset of review-personas.md §1):
|
|
72
|
+
- `.grimoire/config.yaml` → `project.surface`, `project.compliance`, `project.language`
|
|
73
|
+
- `.grimoire/docs/context.yml` if present → deployment environment, related services, trust boundaries
|
|
74
|
+
- All `.grimoire/decisions/*.md` with `status: accepted` — extract ID, title, top driver
|
|
75
|
+
- Tag histogram across `.grimoire/changes/**/*.feature` for data-sensitivity signals (pii, payment, auth, phi)
|
|
76
|
+
- `.grimoire/brand/tokens.json` existence (one bit — not needed for security/data questions but informs surface context)
|
|
77
|
+
|
|
78
|
+
**Briefing block** (inject as preface to every persona, mirror review-personas.md §1 format):
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## Project Briefing (consult)
|
|
82
|
+
|
|
83
|
+
**Surface:** <tui | web | mobile | api | mixed | unknown>
|
|
84
|
+
**Stage:** <prototype | internal | customer-facing | regulated — from compliance + README>
|
|
85
|
+
**Data sensitivity:** <none | pii | financial | phi — from tag histogram + compliance>
|
|
86
|
+
**Compliance:** <list configured frameworks, or "none">
|
|
87
|
+
**Threat surface signals:** <tags with count >0 — auth=N, pii=N, payment=N>
|
|
88
|
+
**Active constraints (accepted ADRs):**
|
|
89
|
+
- ADR-XXXX — <title>
|
|
90
|
+
- ...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Skip the Feature Inventory and Linked-change Non-goals sections — there are no features yet and the consult precedes the manifest.
|
|
94
|
+
|
|
95
|
+
### 3. Engage Personas in Q&A Mode
|
|
96
|
+
**This is the core difference from `grimoire-review`.** Personas ASK questions; the designer ANSWERS. No blocker/suggestion grading. No materiality gate (the gate exists to keep reviewers from manufacturing findings — Q&A doesn't have findings).
|
|
97
|
+
|
|
98
|
+
Default personas: **Security Engineer** + **Data Engineer**. Add others only when the user invokes a mode flag (e.g., `--personas=security,data,qa`).
|
|
99
|
+
|
|
100
|
+
For each engaged persona:
|
|
101
|
+
- Read the persona's section in `../references/review-personas.md` §4 to understand its concerns (what it cares about, what it would flag in a review).
|
|
102
|
+
- Translate those concerns into clarifying questions for the designer, using the interview patterns in `../references/elicitation-personas.md` for that persona.
|
|
103
|
+
- Determine a question count for this persona: 5 by default; 3 in "quick consult" mode; fewer if the problem statement or briefing already answers likely questions. Announce the count once before the first question: e.g. `Security Engineer — 5 questions.`
|
|
104
|
+
- Ask **one question per turn**. Never list multiple questions in a single message. Prefix every question with its progress marker: `[Security — Q 1/5]`, `[Security — Q 2/5]`, etc.
|
|
105
|
+
- Wait for the answer before asking the next question. Do not hint at or pre-list upcoming questions.
|
|
106
|
+
- Skip questions whose answers are already obvious from the problem statement, briefing, or a prior answer — decrement the count and note it inline: `[Security — Q 3/5 skipped — covered above]`.
|
|
107
|
+
- Questions are conversational. Examples:
|
|
108
|
+
- Security: "What user data flows through this screen?", "Does any of it leave the boundary of our service?", "Is this surface authenticated, or public?", "Are there compliance frameworks (GDPR, HIPAA) that apply to this data?"
|
|
109
|
+
- Data: "What entities does this design touch?", "Are you reading from existing tables or creating new ones?", "If new fields are needed, what's the cardinality and nullability?", "Are there migrations implied?"
|
|
110
|
+
- Do **not** dump a checklist.
|
|
111
|
+
- Do **not** produce blocker/suggestion findings. If a persona spots a real risk, frame it as a question ("Have you considered what happens if X?") not a verdict ("[blocker] X is wrong").
|
|
112
|
+
|
|
113
|
+
Record the transcript verbatim for `consult.md` — questions asked, designer's answers, follow-up questions.
|
|
114
|
+
|
|
115
|
+
### 4. Distill Assumptions, Givens, and Open Questions
|
|
116
|
+
Once each persona has finished its Q&A pass, summarize the transcript into three distinct lists:
|
|
117
|
+
|
|
118
|
+
- **Inferred assumptions** — things the design must hold true to be valid. Examples: "All write operations happen behind authentication." / "PII is only displayed to the owning user, never logged." Phrase as positive declarations the design will need to honor.
|
|
119
|
+
- **Inferred givens** — constraints from existing systems, compliance, or accepted ADRs that the design cannot change. Examples: "User auth flows through the existing `auth-service` (ADR-0007)." / "PII storage must encrypt at rest per project.compliance: gdpr."
|
|
120
|
+
- **Open questions** — items the designer could not answer in this consult. These are flags for follow-up, not blockers. Examples: "Unknown: retention window for payment audit logs — needs product input." / "Unknown: whether mobile clients will consume this surface in phase 1."
|
|
121
|
+
|
|
122
|
+
Be honest about the boundary between assumption and given: a *given* is something the world imposes (compliance, an ADR, an existing service contract); an *assumption* is something the designer commits to upholding.
|
|
123
|
+
|
|
124
|
+
### 5. Write `.grimoire/changes/<id>/consult.md`
|
|
125
|
+
Compose the file with explicit, implementable sections in this order:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
# Pre-design consult: <change-id>
|
|
129
|
+
|
|
130
|
+
## Problem statement
|
|
131
|
+
<user's problem statement, verbatim>
|
|
132
|
+
|
|
133
|
+
## Proposed user flow
|
|
134
|
+
<user's input, or "Not provided">
|
|
135
|
+
|
|
136
|
+
## Data the design will touch
|
|
137
|
+
<user's input, or "Not provided">
|
|
138
|
+
|
|
139
|
+
## Project Briefing (consult)
|
|
140
|
+
<briefing block from step 2>
|
|
141
|
+
|
|
142
|
+
## Security Q&A
|
|
143
|
+
**Q:** <question 1>
|
|
144
|
+
**A:** <designer's answer>
|
|
145
|
+
|
|
146
|
+
**Q:** <question 2>
|
|
147
|
+
**A:** <designer's answer>
|
|
148
|
+
...
|
|
149
|
+
|
|
150
|
+
## Data Q&A
|
|
151
|
+
**Q:** <question 1>
|
|
152
|
+
**A:** <designer's answer>
|
|
153
|
+
...
|
|
154
|
+
|
|
155
|
+
## <Any other engaged personas> Q&A
|
|
156
|
+
<same Q/A format>
|
|
157
|
+
|
|
158
|
+
## Inferred assumptions
|
|
159
|
+
- <assumption 1>
|
|
160
|
+
- <assumption 2>
|
|
161
|
+
...
|
|
162
|
+
|
|
163
|
+
## Inferred givens
|
|
164
|
+
- <given 1, with ADR / compliance citation where applicable>
|
|
165
|
+
- <given 2>
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
## Open questions
|
|
169
|
+
- <unanswered item 1 — flagged for follow-up>
|
|
170
|
+
- <unanswered item 2>
|
|
171
|
+
...
|
|
172
|
+
|
|
173
|
+
## Personas engaged
|
|
174
|
+
- Security Engineer
|
|
175
|
+
- Data Engineer
|
|
176
|
+
<- ... other personas if added via mode flag>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Do not invent content for empty sections. If the designer skipped "Proposed user flow", write "Not provided" — do not synthesize one. If a Q&A turn produced no actionable assumption, the assumptions list can be short.
|
|
180
|
+
|
|
181
|
+
### 6. Handoff
|
|
182
|
+
Tell the user what runs next and what those skills will do with `consult.md`:
|
|
183
|
+
|
|
184
|
+
- **`grimoire-design`** on the same `change-id` will read `consult.md` first, propagate assumptions and givens into prompts for variant generation (e.g., "exclude patterns that violate givens"), and copy the lists into `manifest.md` when the designer accepts a direction.
|
|
185
|
+
- **`grimoire-draft`** on the same `change-id` will read `consult.md` and copy "Inferred assumptions" + "Inferred givens" into `manifest.md` (Assumptions section, plus a new Givens section) at level 3-4 complexity.
|
|
186
|
+
- **Open questions** travel into `manifest.md` as unvalidated assumptions for the designer/PM to resolve before plan.
|
|
187
|
+
|
|
188
|
+
Do not invoke the next skill automatically. Confirm with the user, then suggest the next command.
|
|
189
|
+
|
|
190
|
+
## Important
|
|
191
|
+
- **This is Q&A, not findings.** Personas ASK questions of the designer; they do not produce blocker/suggestion verdicts. If you catch yourself writing `[blocker]` or `[suggestion]` in `consult.md`, stop — that is `grimoire-review`'s job, not this skill's.
|
|
192
|
+
- **No materiality gate.** The review-personas materiality gate exists to prevent manufactured findings. Q&A doesn't produce findings, so the gate does not apply — but the *intent* still holds: ask questions whose answers will change the design, not questions whose answers are already obvious from the briefing.
|
|
193
|
+
- **Minimal input bar.** Problem statement only is enough to start. Do not interrogate the user before engaging personas — the personas exist to ask the missing questions.
|
|
194
|
+
- **Available to engineers too.** This skill is not designer-exclusive. An engineer who says "I'm thinking about adding X, what should I worry about?" is invoking the same workflow. The output flows into `grimoire-draft` the same way it flows into `grimoire-design`.
|
|
195
|
+
- **Do not load Contrarian or Code Style personas.** Contrarian challenges other personas' findings; Code Style reviews diffs. Neither has a role in pre-design Q&A.
|
|
196
|
+
- **Honor the briefing pare-down.** Do not include the full review-personas.md §1 briefing — skip Feature Inventory and Linked-change Non-goals. They add noise without informing the questions a consult needs to ask.
|
|
197
|
+
- **Pure markdown skill.** Do not generate executable code. The `--personas=` and "quick consult" mode markers in this file describe how the AI interprets user phrasing — they are not CLI flags of the `grimoire` binary.
|
|
198
|
+
|
|
199
|
+
## Done
|
|
200
|
+
When `consult.md` is written and the user has acknowledged the handoff path, the consult is complete. Suggest `grimoire-design` (visual surface work) or `grimoire-draft` (behavioral specs) as the next step on the same `change-id`.
|
|
@@ -66,10 +66,11 @@ If the snapshot includes a `duplicates` section (from `grimoire map --duplicates
|
|
|
66
66
|
This replaces the need to manually read every source file to extract symbols. The graph gives you AST-accurate function signatures, call relationships, and dead code detection across 66 languages.
|
|
67
67
|
|
|
68
68
|
### 2. Determine Scope
|
|
69
|
-
Ask the user what to document:
|
|
69
|
+
Ask the user what to document (or accept the scope passed in by a calling skill):
|
|
70
70
|
- **Full scan** — document all areas from the snapshot (default for first run)
|
|
71
71
|
- **Area scan** — document specific directories (e.g., "just the API layer")
|
|
72
72
|
- **Gap fill** — only document areas flagged as `undocumented` in the snapshot
|
|
73
|
+
- **Targeted refresh** — a list of directories is passed in (from `grimoire-precommit-review` doc freshness check or `grimoire-plan` staleness gate). Skip the full snapshot walk. Go directly to step 3 for each named directory, regenerate only those area docs, and update their `last_updated` entries in `index.yml`. This is the fast-path mode for post-change maintenance — it does not touch areas outside the passed list.
|
|
73
74
|
|
|
74
75
|
Check `.grimoire/docs/index.yml` if it exists — don't redo work unless refreshing.
|
|
75
76
|
|
|
@@ -174,6 +175,66 @@ Scan the codebase for data models, ORM definitions, migration files, and schema
|
|
|
174
175
|
|
|
175
176
|
If `.grimoire/docs/data/` already exists, update it rather than regenerating. Diff against existing schema.yml to flag new models or removed fields.
|
|
176
177
|
|
|
178
|
+
### 5.5 Component Inventory (optional)
|
|
179
|
+
|
|
180
|
+
Scan the codebase for an existing UI component library, then produce `.grimoire/docs/components.md` documenting reusable components. This inventory lets `grimoire-design` reuse what exists instead of generating duplicate components.
|
|
181
|
+
|
|
182
|
+
**Detection — component library:**
|
|
183
|
+
|
|
184
|
+
| Signal | What it tells you |
|
|
185
|
+
|--------|------------------|
|
|
186
|
+
| `components.json` | shadcn/ui — components live under the configured `aliases.components` path (typically `components/ui/`) |
|
|
187
|
+
| `tailwind.config.{js,ts}` | Tailwind project — utility-first; components are project-local |
|
|
188
|
+
| `package.json` deps: `@mui/material` | Material UI — components imported from `@mui/material/*` |
|
|
189
|
+
| `package.json` deps: `@chakra-ui/react` | Chakra UI — components imported from `@chakra-ui/react` |
|
|
190
|
+
| `package.json` deps: `@mantine/core` (or any `mantine` package) | Mantine |
|
|
191
|
+
| `package.json` deps: `@radix-ui/*` | Radix primitives — usually wrapped by shadcn or project components |
|
|
192
|
+
|
|
193
|
+
**Detection — Storybook:**
|
|
194
|
+
|
|
195
|
+
| Signal | What it tells you |
|
|
196
|
+
|--------|------------------|
|
|
197
|
+
| `.storybook/main.{ts,js}` | Storybook configured — stories define canonical component variants |
|
|
198
|
+
| `*.stories.{ts,tsx,jsx,js}` | Story files — each story is a documented component variant |
|
|
199
|
+
|
|
200
|
+
**Skip condition:** If no library signal and no story files are found, emit a single-line note ("No UI component signals detected — skipping component inventory.") and continue to §6. Do not create `components.md`.
|
|
201
|
+
|
|
202
|
+
**Workflow:**
|
|
203
|
+
1. Detect the library (or libraries) using the signals above
|
|
204
|
+
2. Locate component source files — for shadcn, walk `components/ui/`; for project-local components, look under `src/components/`, `app/components/`, or wherever the convention places them
|
|
205
|
+
3. For each component file, extract: name, file path, exported variants (e.g., `variant="primary|secondary"`), and notable props (especially required ones)
|
|
206
|
+
4. If Storybook is present, walk `*.stories.*` files to harvest the canonical variant list per component — stories are the source of truth for which variants exist
|
|
207
|
+
5. Write `.grimoire/docs/components.md` listing each component with file path, variants, and key props
|
|
208
|
+
|
|
209
|
+
**`components.md` format:**
|
|
210
|
+
|
|
211
|
+
```markdown
|
|
212
|
+
# Component Inventory
|
|
213
|
+
> Last updated: YYYY-MM-DD
|
|
214
|
+
> Library: <shadcn | MUI | Chakra | Mantine | project-local | mixed>
|
|
215
|
+
|
|
216
|
+
## Components
|
|
217
|
+
|
|
218
|
+
| Component | Location | Variants | Key Props | Notes |
|
|
219
|
+
|-----------|----------|----------|-----------|-------|
|
|
220
|
+
| `Button` | `components/ui/button.tsx` | `default`, `destructive`, `outline`, `ghost`, `link` | `variant`, `size`, `asChild` | Wraps Radix Slot when `asChild` |
|
|
221
|
+
| `Dialog` | `components/ui/dialog.tsx` | — | `open`, `onOpenChange` | Compound: `Dialog`, `DialogTrigger`, `DialogContent` |
|
|
222
|
+
|
|
223
|
+
## Stories
|
|
224
|
+
<Only if Storybook detected. List story files and the variants they document.>
|
|
225
|
+
|
|
226
|
+
| Story File | Component | Documented Variants |
|
|
227
|
+
|------------|-----------|---------------------|
|
|
228
|
+
| `Button.stories.tsx` | `Button` | Primary, Secondary, Destructive, Loading |
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Rules:**
|
|
232
|
+
- Document what exists in code, not what should exist. If the project has both shadcn and ad-hoc components, list both and note the inconsistency.
|
|
233
|
+
- Point to source files; do not duplicate component code into the doc.
|
|
234
|
+
- Variants come from prop unions in the type signature OR from the canonical Storybook stories — prefer Storybook when present.
|
|
235
|
+
- Only list components meant for reuse. Skip one-off page-level components (e.g., `LoginPage`) unless they're imported elsewhere.
|
|
236
|
+
- If `.grimoire/docs/components.md` already exists, update it — diff against existing entries to flag new or removed components.
|
|
237
|
+
|
|
177
238
|
### 6. Generate Project Context
|
|
178
239
|
|
|
179
240
|
Scan the codebase for deployment and infrastructure artifacts, then populate `.grimoire/docs/context.yml`. This file captures the project's ecosystem — how it's deployed, what services it talks to, and what infrastructure it depends on. If `context.yml` doesn't exist, copy it from the template first (`grimoire init` creates it, but this handles projects initialized before this feature).
|
|
@@ -280,7 +341,9 @@ These are read by `grimoire map` and affect the snapshot this skill consumes.
|
|
|
280
341
|
- The **plan** skill should read `.grimoire/docs/` before generating tasks — look for existing utilities in the reuse inventory, follow documented patterns
|
|
281
342
|
- The **verify** skill can check new code against documented patterns
|
|
282
343
|
- The **audit** skill can trigger a discover pass as part of onboarding
|
|
283
|
-
-
|
|
344
|
+
- The **design** skill reads `.grimoire/docs/components.md` first to avoid generating duplicate components
|
|
345
|
+
- The **precommit-review** skill checks area doc freshness on every commit and invokes discover in targeted refresh mode for stale dirs — this is the primary maintenance trigger, not a periodic manual task
|
|
346
|
+
- The **plan** skill gates on staleness for level 3-4 changes and directs the user to run targeted refresh before planning
|
|
284
347
|
|
|
285
348
|
## Important
|
|
286
349
|
- **Start from the snapshot.** Don't scan the filesystem yourself — `grimoire map` already did that. Read `.snapshot.json` for structure, then use `codebase-memory-mcp` graph queries for symbols and call graphs (if available), and read actual code files for meaning.
|