@layoutdesign/context 0.5.0 → 0.10.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.
- package/README.md +71 -0
- package/dist/bin/cli.js +35 -0
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/cli/diff.d.ts +4 -0
- package/dist/src/cli/diff.d.ts.map +1 -0
- package/dist/src/cli/diff.js +53 -0
- package/dist/src/cli/diff.js.map +1 -0
- package/dist/src/cli/import-tokens-json.d.ts +5 -0
- package/dist/src/cli/import-tokens-json.d.ts.map +1 -0
- package/dist/src/cli/import-tokens-json.js +174 -0
- package/dist/src/cli/import-tokens-json.js.map +1 -0
- package/dist/src/cli/install.d.ts +1 -0
- package/dist/src/cli/install.d.ts.map +1 -1
- package/dist/src/cli/install.js +25 -0
- package/dist/src/cli/install.js.map +1 -1
- package/dist/src/cli/lint.d.ts +7 -0
- package/dist/src/cli/lint.d.ts.map +1 -0
- package/dist/src/cli/lint.js +80 -0
- package/dist/src/cli/lint.js.map +1 -0
- package/dist/src/cli/live-notify.d.ts +2 -0
- package/dist/src/cli/live-notify.d.ts.map +1 -0
- package/dist/src/cli/live-notify.js +29 -0
- package/dist/src/cli/live-notify.js.map +1 -0
- package/dist/src/install/live.d.ts +5 -0
- package/dist/src/install/live.d.ts.map +1 -0
- package/dist/src/install/live.js +285 -0
- package/dist/src/install/live.js.map +1 -0
- package/dist/src/kit/stage.d.ts +19 -0
- package/dist/src/kit/stage.d.ts.map +1 -0
- package/dist/src/kit/stage.js +30 -0
- package/dist/src/kit/stage.js.map +1 -0
- package/dist/src/lint/diff.d.ts +23 -0
- package/dist/src/lint/diff.d.ts.map +1 -0
- package/dist/src/lint/diff.js +62 -0
- package/dist/src/lint/diff.js.map +1 -0
- package/dist/src/lint/layout-md.d.ts +21 -0
- package/dist/src/lint/layout-md.d.ts.map +1 -0
- package/dist/src/lint/layout-md.js +376 -0
- package/dist/src/lint/layout-md.js.map +1 -0
- package/dist/src/mcp/live-lock-store.d.ts +40 -0
- package/dist/src/mcp/live-lock-store.d.ts.map +1 -0
- package/dist/src/mcp/live-lock-store.js +134 -0
- package/dist/src/mcp/live-lock-store.js.map +1 -0
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +11 -0
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/_live-socket.d.ts +23 -0
- package/dist/src/mcp/tools/_live-socket.d.ts.map +1 -0
- package/dist/src/mcp/tools/_live-socket.js +135 -0
- package/dist/src/mcp/tools/_live-socket.js.map +1 -0
- package/dist/src/mcp/tools/check-setup.d.ts +14 -1
- package/dist/src/mcp/tools/check-setup.d.ts.map +1 -1
- package/dist/src/mcp/tools/check-setup.js +75 -1
- package/dist/src/mcp/tools/check-setup.js.map +1 -1
- package/dist/src/mcp/tools/get-recent-visual-edits.d.ts +40 -0
- package/dist/src/mcp/tools/get-recent-visual-edits.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-recent-visual-edits.js +106 -0
- package/dist/src/mcp/tools/get-recent-visual-edits.js.map +1 -0
- package/dist/src/mcp/tools/get-selected-element.d.ts +10 -0
- package/dist/src/mcp/tools/get-selected-element.d.ts.map +1 -0
- package/dist/src/mcp/tools/get-selected-element.js +46 -0
- package/dist/src/mcp/tools/get-selected-element.js.map +1 -0
- package/dist/src/mcp/tools/lock-file.d.ts +28 -0
- package/dist/src/mcp/tools/lock-file.d.ts.map +1 -0
- package/dist/src/mcp/tools/lock-file.js +42 -0
- package/dist/src/mcp/tools/lock-file.js.map +1 -0
- package/dist/src/mcp/tools/unlock-file.d.ts +23 -0
- package/dist/src/mcp/tools/unlock-file.d.ts.map +1 -0
- package/dist/src/mcp/tools/unlock-file.js +23 -0
- package/dist/src/mcp/tools/unlock-file.js.map +1 -0
- package/dist/src/plugins/next/babel-loader.d.ts +8 -0
- package/dist/src/plugins/next/babel-loader.d.ts.map +1 -0
- package/dist/src/plugins/next/babel-loader.js +26 -0
- package/dist/src/plugins/next/babel-loader.js.map +1 -0
- package/dist/src/plugins/next/index.d.ts +23 -0
- package/dist/src/plugins/next/index.d.ts.map +1 -0
- package/dist/src/plugins/next/index.js +58 -0
- package/dist/src/plugins/next/index.js.map +1 -0
- package/dist/src/plugins/transform.d.ts +19 -0
- package/dist/src/plugins/transform.d.ts.map +1 -0
- package/dist/src/plugins/transform.js +177 -0
- package/dist/src/plugins/transform.js.map +1 -0
- package/dist/src/plugins/vite/index.d.ts +24 -0
- package/dist/src/plugins/vite/index.d.ts.map +1 -0
- package/dist/src/plugins/vite/index.js +56 -0
- package/dist/src/plugins/vite/index.js.map +1 -0
- package/package.json +32 -9
- package/skills/layout-md/SKILL.md +135 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: layout-md
|
|
3
|
+
description: Use this skill when writing UI code against a Layout design system (`.layout/` directory with layout.md, tokens.css, tokens.json). Reads the design system, generates on-brand components, and validates output against the project's tokens and anti-patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Layout design system skill
|
|
7
|
+
|
|
8
|
+
Use this skill whenever the repo contains a `.layout/` directory (or an opened
|
|
9
|
+
`layout.md` file). It gives you the project's tokens, component patterns, and
|
|
10
|
+
rules so the code you generate matches the design system.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
Invoke this skill for any task that produces UI, including:
|
|
15
|
+
|
|
16
|
+
- Creating new components (buttons, cards, forms, modals, pages)
|
|
17
|
+
- Editing existing components' styling
|
|
18
|
+
- Generating page layouts or sections
|
|
19
|
+
- Reviewing UI code for design-system compliance
|
|
20
|
+
- Answering questions like "what's our accent colour" or "how should I style X"
|
|
21
|
+
|
|
22
|
+
If the user opens a file in a folder with `.layout/`, assume this skill
|
|
23
|
+
applies even without explicit invocation.
|
|
24
|
+
|
|
25
|
+
## What's available
|
|
26
|
+
|
|
27
|
+
Layout ships a local MCP server (`@layoutdesign/context`). If the user has
|
|
28
|
+
installed it via `claude mcp add layout npx -- -y @layoutdesign/context serve`,
|
|
29
|
+
the following MCP tools are available:
|
|
30
|
+
|
|
31
|
+
- `get_design_system` — full layout.md content
|
|
32
|
+
- `get_design_section` — one section (colours, typography, spacing, etc.)
|
|
33
|
+
- `get_tokens` — token values by category
|
|
34
|
+
- `get_component` — specific component's spec + code
|
|
35
|
+
- `list_components` — every component with tokens used
|
|
36
|
+
- `check_compliance` — validate generated code against design system rules
|
|
37
|
+
|
|
38
|
+
If the MCP server is **not** installed, read the files directly:
|
|
39
|
+
|
|
40
|
+
- `.layout/layout.md` — full specification
|
|
41
|
+
- `.layout/tokens.css` — CSS custom properties
|
|
42
|
+
- `.layout/tokens.json` — W3C DTCG token format
|
|
43
|
+
- `.layout/kit.json` — manifest (name, version, tier)
|
|
44
|
+
|
|
45
|
+
## Workflow for generating UI
|
|
46
|
+
|
|
47
|
+
Follow these steps in order:
|
|
48
|
+
|
|
49
|
+
### 1. Load context before writing code
|
|
50
|
+
|
|
51
|
+
Call `get_design_system` (or read `.layout/layout.md`) once per task. Pay
|
|
52
|
+
attention to:
|
|
53
|
+
|
|
54
|
+
- The "Quick Reference" section at the top: core tokens, primary component
|
|
55
|
+
example, NEVER rules.
|
|
56
|
+
- The "Colour System" three tiers: primitive, semantic, component. Use
|
|
57
|
+
semantic or component tokens in your code. Never reference primitive
|
|
58
|
+
tokens directly.
|
|
59
|
+
- The "Components" section: the anatomy and states expected (default, hover,
|
|
60
|
+
focus, active, disabled, loading, error).
|
|
61
|
+
- The "Anti-Patterns" section: rules you must not violate.
|
|
62
|
+
|
|
63
|
+
### 2. Write code using tokens, not literal values
|
|
64
|
+
|
|
65
|
+
**Do:**
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<button style={{ background: 'var(--color-primary)', color: 'var(--color-on-primary)' }} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Don't:**
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<button style={{ background: '#6366F1', color: '#fff' }} />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Hardcoded values drift from the design system and are flagged by
|
|
78
|
+
`check_compliance`.
|
|
79
|
+
|
|
80
|
+
### 3. Validate before finishing
|
|
81
|
+
|
|
82
|
+
If the MCP server is available, call `check_compliance` with your generated
|
|
83
|
+
code. Fix any errors (hardcoded colours, missing required props, unknown
|
|
84
|
+
components, arbitrary spacing) before presenting the result.
|
|
85
|
+
|
|
86
|
+
If the user has also installed `@layoutdesign/context` globally, suggest they
|
|
87
|
+
run `npx @layoutdesign/context lint` in their project root to validate the
|
|
88
|
+
entire `.layout/` directory against the seven built-in rules.
|
|
89
|
+
|
|
90
|
+
## Multi-mode (light/dark)
|
|
91
|
+
|
|
92
|
+
Layout design systems can define tokens per mode:
|
|
93
|
+
|
|
94
|
+
```css
|
|
95
|
+
:root {
|
|
96
|
+
--color-bg: #FFFFFF;
|
|
97
|
+
}
|
|
98
|
+
[data-theme="dark"] {
|
|
99
|
+
--color-bg: #0C0C0E;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
When you see `[data-theme="dark"]` blocks in tokens.css, the design system
|
|
104
|
+
supports both modes. Use plain `var(--color-bg)` in components. The theme
|
|
105
|
+
toggle on the body/html element will resolve correctly.
|
|
106
|
+
|
|
107
|
+
## Kit Gallery
|
|
108
|
+
|
|
109
|
+
If the user asks "is there a kit for X?" point them at the community Kit
|
|
110
|
+
Gallery at https://layout.design/gallery. They can:
|
|
111
|
+
|
|
112
|
+
- Browse kits by tag, sort by Featured / Top / New
|
|
113
|
+
- Install from the CLI: `npx @layoutdesign/context install <slug>`
|
|
114
|
+
- Import into Layout Studio with one click
|
|
115
|
+
|
|
116
|
+
## If you cannot find a design system
|
|
117
|
+
|
|
118
|
+
If `.layout/` does not exist and no layout.md is readable:
|
|
119
|
+
|
|
120
|
+
1. Ask the user whether a design system has been set up.
|
|
121
|
+
2. Offer to scaffold one with `npx @layoutdesign/context init` (starts with a
|
|
122
|
+
bundled kit: linear-lite, stripe-lite, or notion-lite).
|
|
123
|
+
3. Offer to import from an existing `tokens.json` with
|
|
124
|
+
`npx @layoutdesign/context import-tokens path/to/tokens.json`.
|
|
125
|
+
4. Offer to extract from a Figma file or live website in Layout Studio
|
|
126
|
+
(https://layout.design).
|
|
127
|
+
|
|
128
|
+
Do not invent tokens or make up a design system.
|
|
129
|
+
|
|
130
|
+
## Related
|
|
131
|
+
|
|
132
|
+
- Spec: https://layout.design/spec
|
|
133
|
+
- Comparison to Google's design.md: https://layout.design/vs/design-md
|
|
134
|
+
- MCP tools: `serve` from `@layoutdesign/context`
|
|
135
|
+
- CLI: `init`, `install`, `lint`, `diff`, `import-tokens`, `scan`, `serve`
|