@se-studio/skills 1.0.5 → 1.0.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @se-studio/skills
2
2
 
3
+ ## 1.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Version bump: patch for changed packages
8
+
9
+ ## 1.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Add site-workflows-contentful-vercel-setup skill
14
+
15
+ ## 1.0.9
16
+
17
+ ### Patch Changes
18
+
19
+ - Add site-workflows-copy-doc-snapshot skill
20
+ - Add site-workflows-new-project skill
21
+ - Add site-workflows-project-cleanup skill
22
+
23
+ ## 1.0.8
24
+
25
+ ### Patch Changes
26
+
27
+ - Add site-workflows-apply-design-snapshot skill
28
+
29
+ ## 1.0.7
30
+
31
+ ### Patch Changes
32
+
33
+ - Add site-workflows-figma-design-snapshot skill
34
+
35
+ ## 1.0.6
36
+
37
+ ### Patch Changes
38
+
39
+ - Version bump: patch for changed packages
40
+
3
41
  ## 1.0.5
4
42
 
5
43
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/skills",
3
- "version": "1.0.5",
3
+ "version": "1.0.11",
4
4
  "description": "SE Studio agent skills for marketing site development with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: "contentful-cms:setup"
3
+ description: "Guide a user through installing and configuring the cms-edit MCP server for Claude Desktop."
4
+ ---
5
+
6
+ # Skill: cms-edit Setup
7
+
8
+ Use this skill when the user wants to install or configure the `cms-edit` MCP server so Claude Desktop can read and edit Contentful content.
9
+
10
+ ## Overview
11
+
12
+ The setup wizard handles everything automatically:
13
+ - Collects the Contentful Management Token
14
+ - Discovers spaces and environments via the Contentful API
15
+ - Writes `~/.contentful-cms.json`
16
+ - Updates the Claude Desktop config to register the `cms-edit` MCP server
17
+
18
+ ## Prerequisites
19
+
20
+ The user needs:
21
+ 1. **Node.js** installed (LTS version from [nodejs.org](https://nodejs.org))
22
+ 2. **A Contentful Management Token** — see Step 1 below
23
+
24
+ ## Step 1: Get a Management Token
25
+
26
+ Tell the user:
27
+
28
+ > To get your Contentful Management Token:
29
+ > 1. Log in to [contentful.com](https://app.contentful.com)
30
+ > 2. Go to **Settings → API keys**
31
+ > 3. Click the **Content management tokens** tab
32
+ > 4. Click **Generate personal token**, name it `Claude Desktop`, and click **Generate**
33
+ > 5. Copy the token — you won't see it again
34
+
35
+ Ask them to confirm they have the token before continuing.
36
+
37
+ ## Step 2: Run the Setup Wizard
38
+
39
+ Tell the user to open a terminal and run:
40
+
41
+ ```bash
42
+ npx @se-studio/contentful-cms@latest setup
43
+ ```
44
+
45
+ Walk them through what each prompt means:
46
+
47
+ | Prompt | What to enter |
48
+ |--------|--------------|
49
+ | **Contentful Management Token** | The token they just copied (input will be hidden) |
50
+ | **Which Contentful space?** | Only appears if the token has multiple spaces — pick the one they want to connect |
51
+ | **Which environment?** | Auto-selects `master`; only asks if no `master` environment exists |
52
+ | **Short name for this project** | A slug like `my-project` or `om1` — used as the key in the config file |
53
+ | **Staging site URL** | Optional — their Vercel preview URL (e.g. `https://my-project.vercel.app`) |
54
+ | **Vercel bypass token** | Optional — only if their staging site has deployment protection |
55
+
56
+ ## Step 3: Restart Claude Desktop
57
+
58
+ After the wizard completes, tell the user:
59
+
60
+ > Fully quit Claude Desktop and reopen it.
61
+ > - **Mac:** Right-click the Dock icon → **Quit** (closing the window isn't enough)
62
+ > - **Windows/Linux:** Close and reopen from the Start menu
63
+
64
+ ## Step 4: Verify
65
+
66
+ Once they've reopened Claude Desktop, verify the setup worked by using the `cms_edit` tool:
67
+
68
+ ```
69
+ cms_edit ["open", "/"]
70
+ ```
71
+
72
+ If it returns a page structure, setup is complete. If it errors, see Troubleshooting below.
73
+
74
+ ## Troubleshooting
75
+
76
+ **"Invalid management token"**
77
+ → The token may have been copied incorrectly or already expired. Generate a new one in Contentful and run the wizard again.
78
+
79
+ **"No spaces found"**
80
+ → The token doesn't have access to any spaces. Check Contentful's token permissions — it needs at least read access to one space.
81
+
82
+ **`cms_edit` tool not available after restart**
83
+ → Check the Claude Desktop config was written correctly:
84
+ - Mac: `~/Library/Application Support/Claude/claude_desktop_config.json`
85
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
86
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
87
+
88
+ It should contain an `mcpServers.cms-edit` entry. If missing, run the wizard again.
89
+
90
+ **Adding another space**
91
+ → Run `npx @se-studio/contentful-cms@latest setup` again — it merges the new space into the existing config.
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: site-workflows-apply-design-snapshot
3
+ description: Reads design.md and applies the design tokens to the project — updating tailwind.config.json (colours + typography), handling custom fonts, and regenerating all downstream files via pnpm codegen. Run after /figma-design-snapshot to sync the codebase with the latest Figma changes.
4
+ license: MIT
5
+ metadata:
6
+ author: se-studio
7
+ version: "1.0.0"
8
+ ---
9
+
10
+ # Apply Design Snapshot
11
+
12
+ Reads `design.md` and applies its design tokens to the project. Run this after `/figma-design-snapshot` to keep the codebase in sync with Figma.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /apply-design-snapshot
18
+ ```
19
+
20
+ No arguments needed. Reads `design.md` and `.design-snapshot.json` from the project root, updates `tailwind.config.json` and `globals.css`, then runs `pnpm codegen` to regenerate all typed token files.
21
+
22
+ ---
23
+
24
+ ## CRITICAL: The token pipeline
25
+
26
+ ```
27
+ tailwind.config.json
28
+ ↓ pnpm codegen
29
+ src/generated/colors.ts ← typed colour lookups (auto-generated)
30
+ src/generated/textStyles.ts ← typed type-scale names (auto-generated)
31
+ src/generated/setailwind.css ← CSS custom properties + utilities (auto-generated)
32
+ ```
33
+
34
+ **Never edit files in `src/generated/` directly** — they are always overwritten by `codegen`. Only edit `tailwind.config.json` and `globals.css`.
35
+
36
+ ---
37
+
38
+ ## Step 1 — Check prerequisites
39
+
40
+ 1. Check that `design.md` exists in the project root (or at `outputPath` from `.design-snapshot.json`).
41
+ - If missing: stop and tell the user to run `/figma-design-snapshot` first.
42
+ 2. Check that `tailwind.config.json` exists.
43
+ - If missing: stop and tell the user this skill requires the SE Studio token pipeline.
44
+
45
+ ---
46
+
47
+ ## Step 2 — Parse design.md
48
+
49
+ Read `design.md` and extract:
50
+
51
+ ### Colours
52
+ Find the `## Colour Palette` section. For every table row matching `| Token | Hex |`, extract the token name and hex value. Ignore swatch columns. Collect all colours regardless of group (Primary / Neutral / etc.).
53
+
54
+ ### Typography
55
+ Find `## Typography`. Extract the **Desktop** table (lines under `### Desktop`) and the **Mobile** table (lines under `### Mobile`). For each row capture: style name, size (strip `px`), weight label, line-height, letter-spacing.
56
+
57
+ Weight label → number mapping:
58
+ - Regular → 400
59
+ - Medium → 500
60
+ - SemiBold → 600
61
+ - Bold → 700
62
+
63
+ Letter-spacing conversion (Figma `%` → CSS `em`): divide by 100. e.g. `−1.3%` → `-0.013em`. If the value is `0` keep it as `0`.
64
+
65
+ Line-height conversion: strip `%` and divide by 100. e.g. `120%` → `1.2`. If already a decimal, keep as-is. If in `px`, keep as the px value.
66
+
67
+ ### Font family
68
+ Find `**Font family:**` in the Typography section. Extract the font name (e.g. `Booton-TRIAL`).
69
+
70
+ ### Breakpoints
71
+ Find `## Breakpoints & Canvas`. Extract rows — identify the desktop canvas width (largest) and mobile canvas width (smallest).
72
+
73
+ ---
74
+
75
+ ## Step 3 — Read current tailwind.config.json
76
+
77
+ Read `tailwind.config.json` in full. Record:
78
+ - `colorOptions` — the current colour map (must preserve all existing keys)
79
+ - `fontTable.font` — the current font family string
80
+ - `fontTable.weight` — the base font weight
81
+ - `fontTable.styles` — the current style map (keys are class names used in the codebase — **never rename or remove them**)
82
+ - `colorOpposites` — existing colour contrast pairs
83
+ - `foregroundColors` — existing foreground colour list
84
+ - `colorFile` — keep unchanged
85
+
86
+ ---
87
+
88
+ ## Step 4 — Ask about fonts
89
+
90
+ Before modifying any file, ask the user this question (use `AskUserQuestion`):
91
+
92
+ > The design uses **[font name from design.md]** (Regular 400, Medium 500, SemiBold 600).
93
+ >
94
+ > How should I handle the font?
95
+ >
96
+ > **A)** I have the font files — tell me the path (relative to project root or absolute) and I'll copy them to `public/fonts/` and wire up `@font-face`.
97
+ > **B)** I don't have the files yet — set up placeholder `@font-face` rules so I can drop files in later.
98
+ > **C)** Skip fonts — only update colours and type sizes.
99
+
100
+ Wait for the answer. Record as `fontStrategy` (A / B / C). If A, also record `fontSourcePath` from their reply.
101
+
102
+ ---
103
+
104
+ ## Step 5 — Build the colour patch
105
+
106
+ Construct the updated `colorOptions` object:
107
+
108
+ 1. **Start with all existing entries** exactly as they are. The `Light` and `Dark` keys are especially critical — they feed `lookupColourString()`, `lookupOpposite()`, and `lookupColourClassNames()` throughout the component system.
109
+
110
+ 2. **Add new entries** from design.md. Skip any name that already exists (case-insensitive match). Use the exact name string from design.md as the key (the codegen tool kebab-cases it for CSS variables automatically).
111
+
112
+ 3. **Compute colour opposites** for each new colour using WCAG relative luminance:
113
+ 1. Parse the hex value into R, G, B as integers 0–255, then normalise to 0–1 by dividing by 255.
114
+ 2. Linearise each channel: if c ≤ 0.03928 → `c / 12.92`, else `((c + 0.055) / 1.055) ^ 2.4`.
115
+ 3. Compute luminance: `L = 0.2126·R + 0.7152·G + 0.0722·B`.
116
+ 4. If `L ≤ 0.179` → the colour is dark; opposite is `"Light"` (white/light text will be legible).
117
+ If `L > 0.179` → the colour is light; opposite is `"Dark"` (dark text will be legible).
118
+
119
+ 4. **Show the user** the full list of colours being added (name + hex + computed opposite) before writing anything. Ask them to confirm or correct any pairs.
120
+
121
+ ---
122
+
123
+ ## Step 6 — Build the typography patch
124
+
125
+ Map Figma's style names to the existing project class names using this table. The left column is how the style appears in design.md; the right is the `fontTable.styles` key to update in `tailwind.config.json`.
126
+
127
+ | design.md style | tailwind.config.json key |
128
+ |---|---|
129
+ | H1 (Desktop) | `h1` |
130
+ | H2 (Desktop) | `h2` |
131
+ | H3 (Desktop) | `h3` |
132
+ | H4 (Desktop) | `h4` |
133
+ | P1 (Desktop) | `p1` |
134
+ | P2 (Desktop) | `p2` |
135
+ | P3 (Desktop) | `p3` |
136
+ | P4 (Desktop) | `p3Med` |
137
+ | Button 1 (Desktop) | `large-button` |
138
+
139
+ > **Note:** If your project uses different `fontTable.styles` keys, adjust the right-hand column to match what is in your `tailwind.config.json`. Keys not present in the table are left exactly as-is.
140
+
141
+ For each mapped style, construct the updated `fontTable.styles` entry following these rules:
142
+
143
+ - `"default"` = the **Mobile** size for that style (from the Mobile table in design.md)
144
+ - `"desktop"` = the **Desktop** size (only include if it differs from `"default"`)
145
+ - `"weight"` = only include when the weight is not the base `fontTable.weight` (typically 400)
146
+ - `"lineHeight"` = converted value (see Step 2 conversion rules)
147
+ - `"letterSpacing"` = converted value (see Step 2 conversion rules); omit if `0`
148
+ - `"additional"` = **preserve exactly** from the existing entry (e.g. `text-transform: uppercase` on `h1`) — do not remove it
149
+ - Style keys not in the mapping table above (e.g. `hHome`, `h2Med`, `h2plus`, `nav`, etc.) → **leave completely unchanged**
150
+
151
+ Example output for `h2`:
152
+ ```json
153
+ "h2": {
154
+ "weight": 500,
155
+ "letterSpacing": "-0.013em",
156
+ "lineHeight": 1.2,
157
+ "default": 40,
158
+ "desktop": 51
159
+ }
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Step 7 — Build the font patch
165
+
166
+ ### Strategy A — font files provided
167
+
168
+ 1. List all font files at `fontSourcePath` matching `*.woff2`, `*.woff`, `*.ttf`, `*.otf`.
169
+ 2. Create `public/fonts/` if it does not exist.
170
+ 3. Copy all matched files into `public/fonts/`.
171
+ 4. For each file, infer the face weight from the filename:
172
+ - Filename contains `Regular` or `400` → weight: 400, style: normal
173
+ - Contains `Medium` or `500` → weight: 500, style: normal
174
+ - Contains `SemiBold` or `Semi` or `600` → weight: 600, style: normal
175
+ - Contains `Bold` or `700` → weight: 700, style: normal
176
+ - Contains `Italic` → add `font-style: italic` alongside the matching weight
177
+ 5. Build `@font-face` blocks — prefer `woff2` format; fall back to `woff` then `ttf`.
178
+ 6. Insert the `@font-face` blocks into `globals.css` **before** the `@import "tailwindcss"` line (font declarations must precede Tailwind).
179
+ 7. Update `tailwind.config.json` → `fontTable.font` to the font family name from design.md.
180
+ 8. Update `globals.css` `@theme` block: replace the `--font-sans` value with `"[FontName]", system-ui, ui-sans-serif, sans-serif`.
181
+
182
+ ### Strategy B — placeholder
183
+
184
+ 1. Add the following block to `globals.css` before the `@import "tailwindcss"` line:
185
+
186
+ ```css
187
+ /* TODO: Replace src with actual font files placed in public/fonts/ */
188
+ @font-face {
189
+ font-family: "[FontName]";
190
+ src: local("[FontName]");
191
+ font-weight: 400;
192
+ font-style: normal;
193
+ font-display: swap;
194
+ }
195
+ @font-face {
196
+ font-family: "[FontName]";
197
+ src: local("[FontName]");
198
+ font-weight: 500;
199
+ font-style: normal;
200
+ font-display: swap;
201
+ }
202
+ @font-face {
203
+ font-family: "[FontName]";
204
+ src: local("[FontName]");
205
+ font-weight: 600;
206
+ font-style: normal;
207
+ font-display: swap;
208
+ }
209
+ ```
210
+
211
+ 2. Update `tailwind.config.json` → `fontTable.font` to the font family name.
212
+ 3. Update `globals.css` `--font-sans` to `"[FontName]", system-ui, ui-sans-serif, sans-serif`.
213
+ 4. After writing, tell the user: *"Place your font files in `public/fonts/` and replace each `src: local(...)` line with `src: url('/fonts/YourFile.woff2') format('woff2')`."*
214
+
215
+ ### Strategy C — skip
216
+
217
+ No font changes. Skip this step entirely.
218
+
219
+ ---
220
+
221
+ ## Step 8 — Apply all changes
222
+
223
+ Write files in this order:
224
+
225
+ 1. **`tailwind.config.json`** — merge in the new `colorOptions`, updated `colorOpposites`, and updated `fontTable.styles`. All other fields (`sizes`, `colorFile`, `foregroundColors`, etc.) must be preserved exactly.
226
+ 2. **`src/app/globals.css`** — apply font changes (strategies A or B only).
227
+ 3. **`public/fonts/`** — copy font files (strategy A only).
228
+
229
+ Before writing `tailwind.config.json`, do a final sanity check:
230
+ - `Light` and `Dark` keys still present with their original hex values
231
+ - No existing `fontTable.styles` keys removed
232
+ - JSON is valid
233
+
234
+ ---
235
+
236
+ ## Step 9 — Regenerate
237
+
238
+ ```bash
239
+ pnpm codegen
240
+ ```
241
+
242
+ If this fails:
243
+ - Show the error output
244
+ - Diagnose the likely cause (invalid JSON in tailwind.config.json, unknown field, etc.)
245
+ - Suggest a fix
246
+ - Do NOT run `pnpm validate` until codegen succeeds
247
+
248
+ ---
249
+
250
+ ## Step 10 — Validate
251
+
252
+ ```bash
253
+ pnpm validate
254
+ ```
255
+
256
+ This runs Biome lint + TypeScript type-check. Report pass or fail. If it fails, show the errors.
257
+
258
+ ---
259
+
260
+ ## Step 11 — Report to user
261
+
262
+ Summarise what happened:
263
+
264
+ ```
265
+ ✓ Colours added: [N] new colours (list names)
266
+ ✓ Typography updated: [list of class names updated]
267
+ ✓ Font: [registered as FontName / placeholder set up / skipped]
268
+ ✓ pnpm codegen: passed
269
+ ✓ pnpm validate: passed (or: ✗ failed — see errors above)
270
+
271
+ Next steps:
272
+ git diff tailwind.config.json ← review the token changes
273
+ git diff src/app/globals.css ← review font changes
274
+ git add -p && git commit -m "design: apply snapshot YYYY-MM-DD"
275
+ ```
276
+
277
+ ---
278
+
279
+ ## What this skill does NOT touch
280
+
281
+ - `design.md` — read-only input, never modified
282
+ - `.design-snapshot.json` — read-only config
283
+ - `src/generated/*` — auto-regenerated by codegen, never edited directly
284
+ - Any files in `src/project/` — components are not updated; only tokens change
285
+ - Existing `fontTable.styles` keys not in the mapping table — left exactly as-is