@maccesar/aiskills 1.12.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +89 -9
  2. package/lib/cleanup.js +29 -0
  3. package/lib/commands/skills.js +110 -9
  4. package/lib/config.js +18 -9
  5. package/lib/installer.js +5 -3
  6. package/lib/symlink.js +45 -3
  7. package/lib/utils.js +41 -0
  8. package/package.json +2 -2
  9. package/skills/audit-codebase/SKILL.md +70 -0
  10. package/skills/audit-codebase/agents/openai.yaml +4 -0
  11. package/skills/audit-codebase/references/comprehensive-audit.md +220 -0
  12. package/skills/audit-codebase/references/report-format.md +119 -0
  13. package/skills/humaniza/SKILL.md +55 -4
  14. package/skills/humaniza/references/ai-patterns-es.md +40 -0
  15. package/skills/humaniza/references/checklist.md +9 -0
  16. package/skills/humaniza/references/examples.md +16 -0
  17. package/skills/humaniza/references/lexicon-es-mx.md +18 -0
  18. package/skills/humaniza/references/structures-es.md +132 -0
  19. package/skills/humaniza/scripts/check_ai_patterns.py +216 -0
  20. package/skills/refactoring-ui/SKILL.md +65 -29
  21. package/skills/refactoring-ui/references/05-motion.md +124 -0
  22. package/skills/refactoring-ui/references/06-dark-mode.md +117 -0
  23. package/skills/refactoring-ui/references/07-component-patterns.md +181 -0
  24. package/skills/session-log/SKILL.md +524 -0
  25. package/skills/session-log/evals/README.md +79 -0
  26. package/skills/session-log/evals/ab-ronda-1.md +115 -0
  27. package/skills/session-log/evals/ab-ronda-2.md +174 -0
  28. package/skills/session-log/evals/defecto-experimento.md +12 -0
  29. package/skills/session-log/evals/evals.json +147 -0
  30. package/skills/session-log/evals/trigger-eval.json +23 -0
  31. package/skills/session-log/references/file-layout.md +336 -0
  32. package/skills/session-log/references/verification.md +173 -0
  33. package/skills/stitch-showcase/SKILL.md +24 -232
  34. package/skills/stitch-showcase/references/07-theme-system.md +12 -0
  35. package/skills/stitch-showcase/references/08-type-detection.md +9 -1
  36. package/skills/stitch-showcase/references/10-component-standardization.md +25 -0
  37. package/skills/stitch-showcase/references/12-video-embedding.md +113 -0
  38. package/skills/stitch-showcase/references/13-language-detection.md +82 -0
  39. package/skills/stitch-showcase/references/14-troubleshooting-known-issues.md +122 -0
  40. package/skills/stitch-showcase/references/15-build-flags.md +71 -0
  41. package/skills/stitch-showcase/references/16-design-md-format.md +107 -0
  42. package/skills/stitch-showcase/references/index.html +25 -19
  43. package/skills/stitch-showcase/references/viewer.html +24 -12
  44. package/skills/stitch-showcase/scripts/__pycache__/build_showcase.cpython-314.pyc +0 -0
  45. package/skills/stitch-showcase/scripts/__pycache__/component_utils.cpython-314.pyc +0 -0
  46. package/skills/stitch-showcase/scripts/__pycache__/detect_components.cpython-314.pyc +0 -0
  47. package/skills/stitch-showcase/scripts/__pycache__/extract_catalog.cpython-314.pyc +0 -0
  48. package/skills/stitch-showcase/scripts/__pycache__/extract_text.cpython-314.pyc +0 -0
  49. package/skills/stitch-showcase/scripts/__pycache__/extract_zips.cpython-314.pyc +0 -0
  50. package/skills/stitch-showcase/scripts/__pycache__/parse_design_md.cpython-314.pyc +0 -0
  51. package/skills/stitch-showcase/scripts/__pycache__/slug_demangle.cpython-314.pyc +0 -0
  52. package/skills/stitch-showcase/scripts/build_showcase.py +150 -10
  53. package/skills/stitch-showcase/scripts/parse_design_md.py +145 -12
  54. package/skills/stitch-showcase/scripts/slug_demangle.py +209 -0
  55. package/skills/vscode-extension-dev/SKILL.md +90 -41
  56. package/skills/vscode-extension-dev/references/api-additional.md +168 -0
  57. package/skills/vscode-extension-dev/references/api-progress.md +55 -0
  58. package/skills/vscode-extension-dev/references/api-quickpick.md +75 -0
  59. package/skills/vscode-extension-dev/references/api-secretstorage.md +57 -0
  60. package/skills/vscode-extension-dev/references/api-statusbar.md +38 -0
  61. package/skills/vscode-extension-dev/references/api-treeview.md +78 -0
  62. package/skills/vscode-extension-dev/references/api-webview.md +149 -0
  63. package/skills/vscode-extension-dev/references/architecture.md +67 -0
  64. package/skills/vscode-extension-dev/references/debugger.md +179 -0
  65. package/skills/vscode-extension-dev/references/lsp.md +175 -0
  66. package/skills/vscode-extension-dev/references/notebooks.md +208 -0
  67. package/skills/vscode-extension-dev/references/testing.md +208 -0
  68. package/skills/vscode-extension-dev/references/api-patterns.md +0 -625
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stitch-showcase
3
- description: Use this skill whenever the user has Google Stitch design exports and wants to do anything with them — build a gallery, organize screens, generate a navigable showcase, process zip files, or browse designs. Triggers on "organiza mis diseños de Stitch", "arma el muestrario", "organize my Stitch designs", "build the showcase", "I have the Stitch zips in X", "process this design folder", "generate the index for my Stitch screens", "tengo los zips de Stitch", "quiero ver mis pantallas", or any mention of Stitch exports, screen.png + code.html pairs, or design zip files. Even if the user just says "I have a zip from Stitch" or "mis exports de Stitch" — use this skill. Also triggers on "optimiza el showcase", "mejora las descripciones", "enrich the showcase", "optimize titles", "optimiza", or any request to improve an existing showcase's content.
3
+ description: 'Use when the user has Google Stitch design exports and wants to do anything with them — build a gallery, organize screens, generate a navigable showcase, process zip files, or browse designs. Triggers: "organiza mis diseños de Stitch", "arma el muestrario", "organize my Stitch designs", "build the showcase", "tengo los zips de Stitch", "mis exports de Stitch", or any mention of Stitch exports, screen.png + code.html pairs, or design zip files. Also: "optimiza el showcase", "mejora las descripciones", "enrich the showcase" to improve an existing showcase.'
4
4
  ---
5
5
 
6
6
  # stitch-showcase
@@ -48,6 +48,7 @@ digraph showcase {
48
48
  This is the default mode. No AI analysis needed — the script handles everything with smart defaults.
49
49
 
50
50
  Steps:
51
+
51
52
  1. Identify the source path from the user's message
52
53
  2. Run the build script — **nothing else**:
53
54
  ```bash
@@ -62,12 +63,7 @@ Steps:
62
63
 
63
64
  **That's it.** No pre-flight questions, no DESIGN.md enrichment, no `--extract-text`, no `--init`.
64
65
 
65
- Only ask `--type` or `--name` if the **script fails** or the **user explicitly wants to override**:
66
- ```bash
67
- # Only if script fails to detect type or user requests it
68
- python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --type mobile
69
- python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --name "My App" --type mobile
70
- ```
66
+ Only ask `--type` or `--name` if the **script fails** or the **user explicitly wants to override**. Full flag reference in [`references/15-build-flags.md`](references/15-build-flags.md).
71
67
 
72
68
  ## Mode 2: Enrich (on-demand — user asks)
73
69
 
@@ -76,6 +72,7 @@ python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --name "My App" --t
76
72
  This mode improves the AI-generated content in DESIGN.md and rebuilds the showcase with enriched data.
77
73
 
78
74
  Steps:
75
+
79
76
  1. Find the source folder (from the user's message or the project's `showcase.json`)
80
77
  2. Run `--extract-text` to get screen summaries:
81
78
  ```bash
@@ -84,9 +81,8 @@ Steps:
84
81
  This generates `screen_summaries.txt` — a compact text file with visible text from all screen HTMLs.
85
82
  3. Read the existing `DESIGN.md` (in the source folder) + `screen_summaries.txt`
86
83
  4. **Keep existing sections as-is** — do NOT re-group screens. Only improve content within each section:
87
- - **De-mangle titles**: `configuraci_n` → "Configuración", `membres_as_y_pagos` → "Membresías y Pagos"
88
84
  - **Write real descriptions**: From the extracted text, write a 1-sentence Spanish description for each screen explaining what it does for the user (NOT just a UI label). Example: "Panel principal del miembro con estado de membresía, próximas clases y accesos rápidos."
89
- - **Fix the `Title | Description` format** for mangled slugs (see format below)
85
+ - **Titles are handled by the script** — `scripts/slug_demangle.py` already converts mangled slugs like `configuraci_n_oscuro` → `"Configuración Oscuro"` and `membres_as` → `"Membresías"`. Use the `Title | Description` override only when the demangler can't infer the right title (rare word) or you want a title different from what the slug would yield.
90
86
  5. **Update the project description** at the top of DESIGN.md — this feeds the hero section. It should describe the full scope of the project based on the screens' content.
91
87
  6. **Verify colors/fonts**: Scan the screen HTMLs for hex colors in CSS variables and font families. Update `## Colors` and `## Typography` sections if they're missing or incomplete.
92
88
  7. Re-run the build to regenerate HTMLs with enriched data:
@@ -95,24 +91,23 @@ Steps:
95
91
  ```
96
92
  8. Done — tell the user the showcase has been updated with improved descriptions
97
93
 
98
- **Mangled slugs (Stitch replaces accented characters with `_`):**
94
+ **Title override format (`Title | Description`):**
99
95
 
100
- Google Stitch strips accent characters from filenames, replacing each with `_`. When you see slugs like `confirmaci_n_de_reserva` or `men_m_s`, reconstruct the correct display title and write it explicitly using the `Title | Description` format:
96
+ When the demangler doesn't cover a slug (uncommon word or composite), provide both pieces explicitly. The parser splits on ` | ` everything before is the display title, everything after is the description:
101
97
 
102
98
  ```markdown
103
99
  ### Cuenta
104
- - configuraci_n_oscuro: Configuración | Ajustes de cuenta, notificaciones y preferencias del usuario.
105
- - notificaci_n_oscuro: Notificación | Centro de alertas y mensajes recibidos.
106
- - esc_ner_oscuro: Escáner | Lector de código QR para acceso o verificación.
100
+ - weird_man_leado_slug: Título Correcto | Descripción de la pantalla.
107
101
  ```
108
102
 
109
- The parser splits on ` | ` — everything before is the display title, everything after is the description. For slugs without mangled characters, the plain `- slug: description` format is fine (title is inferred from the slug automatically).
103
+ For slugs that the demangler already handles correctly, the plain `- slug: description` form is enough. Full DESIGN.md format in [`references/16-design-md-format.md`](references/16-design-md-format.md).
110
104
 
111
105
  ## Mode 3: Update (add new screens to an existing showcase)
112
106
 
113
107
  **Triggers**: "add these new screens", "el cliente pidió una pantalla más", "coloca este zip en el proyecto", "agrégalos al muestrario", or any similar update request.
114
108
 
115
109
  Steps:
110
+
116
111
  1. Copy the new zip(s) into the same source folder as the existing screens
117
112
  2. Run `build_showcase.py /path/to/source --update`
118
113
  - Extracts new zips (existing screens skipped via mtime)
@@ -133,29 +128,12 @@ Steps:
133
128
 
134
129
  **Triggers**: "standardize the navbars", "make all footers the same", "usa el navbar del home", "estandariza los botones", or similar.
135
130
 
136
- Steps:
137
- 1. Open `catalog.html` in the browser — review the comparison view
138
- 2. User decides which variant to use as canonical
139
- 3. Run `apply_canonical.py` to apply the chosen canonical:
140
-
141
- ```bash
142
- # Structural components (navbar, footer, sidebar, tabbar)
143
- python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen
144
-
145
- # Atomic components (button, input, heading, etc.)
146
- python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ button home_screen
147
-
148
- # Target specific screens only
149
- python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen --targets login settings profile
150
- ```
151
-
152
- 4. Rebuild the showcase: `build_showcase.py /path/to/source`
153
- 5. Verify the catalog shows fewer variants / more items in "Already Unified"
154
- 6. Repeat until all components are standardized
131
+ Open `catalog.html` to compare variants, decide a canonical, then run `apply_canonical.py` and rebuild. **Full workflow in [`references/10-component-standardization.md`](references/10-component-standardization.md).**
155
132
 
156
133
  ## Verification
157
134
 
158
135
  Confirm with the user:
136
+
159
137
  - Open `index.html` — thumbnails visible and correct
160
138
  - Design system section shows color relationships and type specimen (not just swatches)
161
139
  - Click a screen → viewer opens with correct default frame (phone for mobile, browser chrome for web)
@@ -168,202 +146,7 @@ Confirm with the user:
168
146
 
169
147
  ## Component Catalog & Comparison (automatic)
170
148
 
171
- The catalog is generated automatically as part of every build. Open `catalog.html` to:
172
-
173
- - **Browse all components** organized by type: Structural (navbars, footers, sidebars), Atomic (buttons, headings, inputs, badges, links, icons), Composite (cards, CTAs, heroes, testimonials)
174
- - **Compare variants** side-by-side with styled previews (original Tailwind CSS), canonical badges, similarity scores, and screen counts
175
- - **See what's unified** — components with only one variant appear in a collapsed "Already Unified" section
176
- - **Copy component HTML** for use in other projects
177
-
178
- ## Build Script Reference
179
-
180
- ### Running the build
181
-
182
- ```bash
183
- # Point to the project root — the script discovers the source automatically
184
- python <SKILL_DIR>/scripts/build_showcase.py /path/to/project
185
-
186
- # Or point directly to the folder with zips/screens
187
- python <SKILL_DIR>/scripts/build_showcase.py /path/to/project/stitch
188
-
189
- # Single mega-zip (zip containing all screens as subfolders)
190
- python <SKILL_DIR>/scripts/build_showcase.py /path/to/export.zip
191
- ```
192
-
193
- ### Flags
194
-
195
- | Flag | Description |
196
- |------|-------------|
197
- | `--type mobile\|web` | Set default view mode instead of auto-detecting |
198
- | `--name "Title"` | Set project name when no DESIGN.md is present |
199
- | `--init` | Generate a DESIGN.md skeleton from detected screen slugs |
200
- | `--update` | Detect new screens not yet in DESIGN.md and append under `### Por Clasificar` |
201
- | `--extract-text` | Extract visible text from screen HTMLs → `screen_summaries.txt` (for LLM consumption) |
202
- | `--context` | (Debug only) Generate showcase_context.json without building HTML — do NOT use for normal builds |
203
- | `--watch` | Auto-rebuild on file changes (Ctrl+C to stop) |
204
-
205
- **Note**: Component detection and catalog generation are now automatic — no `--catalog` or `--components` flags needed. Every build produces `catalog.html` alongside `index.html` and `viewer.html`.
206
-
207
- ### Output structure
208
-
209
- The script creates a single `showcase/` directory next to the source folder:
210
- ```
211
- showcase/ ← single output dir (view mode toggle inside)
212
- ├── index.html ← open this in browser (gallery + design system)
213
- ├── viewer.html ← individual screen viewer
214
- ├── catalog.html ← component catalog with comparison view
215
- ├── component_catalog.json ← atomic + composite + cluster data
216
- ├── shared_components.json ← structural component variants
217
- ├── DESIGN.md ← copy from source
218
- └── assets/
219
- ├── splash_screen.html
220
- ├── splash_screen.png
221
- ├── login.html
222
- ├── login.png
223
- └── ...
224
- ```
225
-
226
- Source folder with original zips is **never touched**.
227
-
228
- ### Source discovery
229
-
230
- The script accepts **any folder in the project** — it doesn't need to be the exact folder with screens. Discovery order:
231
- 1. If the given path has screens (zips or `code.html` folders) → use it directly
232
- 2. If `showcase.json` exists in the given path or its parent → follow its `source` field
233
- 3. Auto-discover: scan one level of subdirectories for screens (skips `showcase`, `showcase-mobile`, `showcase-web` output dirs)
234
- 4. Clear error with a suggestion to create `showcase.json`
235
-
236
- ### Supported input structures
237
-
238
- | Structure | Example |
239
- |-----------|---------|
240
- | Project root with `showcase.json` | `project/showcase.json` → `{"source": "stitch"}` |
241
- | Folder of individual zips | `folder/login.zip`, `folder/home.zip` |
242
- | Folder of pre-extracted screen folders | `folder/login/code.html`, `folder/home/code.html` |
243
- | Single mega-zip (Stitch "Export all") | `export.zip → stitch/screen1/code.html, stitch/screen2/code.html` |
244
- | Single screen zip | `screen.zip → code.html + screen.png` |
245
-
246
- ## Screen Grouping
247
-
248
- Screens are grouped into sections in this priority order:
249
-
250
- 1. **`DESIGN.md` sections** (best result) — explicit `### Section Name` blocks under `## Screens`
251
- 2. **Auto-grouping** (fallback) — keyword overlap between slugs; screens sharing a meaningful word are grouped together
252
-
253
- When auto-grouping applies, offer to improve it:
254
- - List the detected screen names for the user
255
- - Suggest logical section groupings based on the app domain
256
- - Write the sections to `DESIGN.md` in the source folder
257
- - Re-run the script to apply them
258
-
259
- **DESIGN.md section format for explicit grouping:**
260
- ```markdown
261
- ## Screens
262
- ### Onboarding
263
- - splash_screen
264
- - welcome
265
-
266
- ### Login & Registration
267
- - login
268
- - signup
269
- - forgot_password
270
-
271
- ### Home
272
- - home
273
- - home_oscuro
274
- ```
275
-
276
- The script merges DESIGN.md sections with slug auto-detection — slugs not listed in any section appear in an "Other screens" group at the end.
277
-
278
- ## Description Sources (priority)
279
-
280
- 1. `DESIGN.md` — screen list with descriptions
281
- 2. Individual `{num}-{name}.md` in source folder (per-screen prompt files)
282
- 3. `<meta name="description">` or `<meta property="og:description">` inside the HTML
283
- 4. First `<h1>` or `<h2>` visible text in the HTML body
284
- 5. `<title>` tag (skipped if generic: "Untitled", "index", "screen", etc.)
285
- 6. First meaningful visible text phrase found in the HTML body (strips scripts/styles/SVGs)
286
- 7. Formatted slug fallback ("splash_screen" → "Splash Screen")
287
-
288
- Stitch-exported HTML rarely has `<title>` or meta descriptions — steps 4 and 6 are the most useful for those files.
289
-
290
- ## showcase.json
291
-
292
- Optional config file in the project root. Tells the script where to find screens, the project type, and name — so you can point the script at any folder in the project.
293
-
294
- ```json
295
- {
296
- "source": "stitch",
297
- "type": "mobile",
298
- "name": "SNAP Gym"
299
- }
300
- ```
301
-
302
- | Field | Required | Description |
303
- |-------|----------|-------------|
304
- | `source` | yes | Relative path from the JSON file to the folder with screens |
305
- | `type` | no | `"mobile"` or `"web"` (overridden by `--type` CLI flag) |
306
- | `name` | no | Project name (overridden by `--name` CLI flag or DESIGN.md) |
307
-
308
- The `--init` flag generates this file automatically alongside DESIGN.md.
309
-
310
- ## DESIGN.md Format
311
-
312
- ```markdown
313
- # Project Name
314
-
315
- ## Type
316
- mobile ← or "web"
317
-
318
- ## Screens
319
- ### Onboarding
320
- - splash_screen
321
- - login
322
-
323
- ### Home
324
- - home_dashboard
325
-
326
- ## Colors
327
- - Primary: #FDD900
328
- - Background: #0A0A0A
329
-
330
- ## Typography
331
- - **Inter**
332
- ```
333
-
334
- The parser also accepts:
335
- - Free-form bullets/numbered lists under `## Screens`
336
- - Markdown table format: `| slug | title | description |`
337
- - Color tokens in Stitch format: `` `primary-container` (#FDD900) `` or bare `surface (#0B1326)`
338
- - Token named `primary-*` → accent color for tabs and hover
339
- - Token named `surface` or `background` → used to compute smart showcase theme
340
-
341
- The `--init` flag auto-generates a skeleton DESIGN.md from detected slugs.
342
-
343
- ## Color Strategy
344
-
345
- **Do NOT use brand colors for showcase backgrounds** — if the app's background matches the showcase background, thumbnails disappear.
346
-
347
- | Element | Value |
348
- |---------|-------|
349
- | Page background | Smart: dark (`#0d0d0d`) if app surface is light, light (`#f5f5f5`) if app surface is dark |
350
- | Card background | `#1a1a1a` (dark mode) / `#ffffff` (light mode) |
351
- | Accent (tabs, hover, borders) | From context `color_tokens.accent` or `colors.primary` → fallback `#6366f1` |
352
- | Large surfaces | Always neutral — never brand color |
353
-
354
- The smart default theme is computed from the `surface` color token luminance: dark surface (luminance < 100) → showcase opens in light mode for contrast, and vice versa. The user's preference is saved in `localStorage` and overrides the default on subsequent visits.
355
-
356
- ## Mobile vs Web Detection
357
-
358
- ### Project-level (from DESIGN.md):
359
- - Keywords: "mobile", "iOS", "Android", "app"
360
- - If ambiguous → pass `--type` flag
361
-
362
- ### Per-screen (from HTML analysis):
363
- - Viewport meta `user-scalable=no`, `maximum-scale=1` → mobile
364
- - Fixed widths 375-430px → mobile
365
- - Desktop breakpoints, sidebars → web
366
- - Stored as `detected_type` per screen in context JSON
149
+ The catalog is generated automatically as part of every build. Open `catalog.html` to browse components by type (Structural, Atomic, Composite), compare variants side-by-side with similarity scores, see what's already unified, and copy component HTML. Design details in [`references/11-component-catalog.md`](references/11-component-catalog.md).
367
150
 
368
151
  ## Scripts
369
152
 
@@ -376,6 +159,8 @@ The smart default theme is computed from the `surface` color token luminance: da
376
159
  | `scripts/extract_catalog.py` | Extracts atomic + composite components for visual catalog |
377
160
  | `scripts/component_utils.py` | Shared HTML parsing helpers (stdlib html.parser) |
378
161
  | `scripts/parse_design_md.py` | Parses DESIGN.md → metadata dict |
162
+ | `scripts/slug_demangle.py` | De-mangles Stitch slugs back to accented titles (`configuraci_n` → `Configuración`) |
163
+ | `scripts/apply_canonical.py` | Applies a canonical component variant across selected screens |
379
164
 
380
165
  ## Reference Templates
381
166
 
@@ -385,13 +170,20 @@ The smart default theme is computed from the `surface` color token luminance: da
385
170
  | `references/viewer.html` | Unified viewer — phone frame + browser chrome toggled by view mode, prev/next, fullscreen |
386
171
  | `references/catalog-template.html` | Visual component catalog with tabs, previews, code snippets |
387
172
 
388
- ## Reference Guides (design documentation)
173
+ ## Reference Guides
389
174
 
390
175
  | Guide | Purpose |
391
176
  |-------|---------|
392
177
  | `references/01-navbar.md` through `references/09-quality-standards.md` | Design decisions documentation for each section |
393
- | `references/10-component-standardization.md` | Component standardization design doc |
178
+ | `references/07-theme-system.md` | Theme system, smart default, **showcase color strategy** (never use brand colors for surfaces) |
179
+ | `references/08-type-detection.md` | Mobile vs web detection (project-level keywords + per-screen HTML signals) |
180
+ | `references/10-component-standardization.md` | Component standardization design + **Mode 4 workflow** |
394
181
  | `references/11-component-catalog.md` | Component catalog design doc |
182
+ | `references/12-video-embedding.md` | How to embed videos in slots (autoplay, aspect ratio, AV1 → H.264) |
183
+ | `references/13-language-detection.md` | How `<html lang>` is resolved (auto-detect + overrides) |
184
+ | `references/14-troubleshooting-known-issues.md` | Known issues and workarounds |
185
+ | `references/15-build-flags.md` | **Build script reference**: flags, output structure, source discovery, supported input layouts |
186
+ | `references/16-design-md-format.md` | **DESIGN.md & showcase.json formats**: project metadata, screen grouping, description sources priority |
395
187
 
396
188
  ## Common Errors
397
189
 
@@ -70,8 +70,20 @@ document.getElementById('theme-toggle').addEventListener('click', () => {
70
70
  - Tailwind config should extend colors with the project's accent: `colors: { accent: '{{PRIMARY_COLOR}}' }`
71
71
  - The theme initialization script MUST be in `<head>`, not at end of body, to prevent flash
72
72
 
73
+ ## Showcase Color Strategy
74
+
75
+ **Do NOT use brand colors for showcase backgrounds** — if the app's background matches the showcase background, thumbnails disappear.
76
+
77
+ | Element | Value |
78
+ |---------|-------|
79
+ | Page background | Smart default (see above): dark (`#0d0d0d`) if app surface is light; light (`#f5f5f5`) if app surface is dark |
80
+ | Card background | `#1a1a1a` (dark mode) / `#ffffff` (light mode) |
81
+ | Accent (tabs, hover, borders) | From context `color_tokens.accent` or `colors.primary` → fallback `#6366f1` |
82
+ | Large surfaces | Always neutral — never brand color |
83
+
73
84
  ## Anti-Patterns
74
85
 
86
+ - Do NOT use brand colors as large showcase surfaces — thumbnails disappear against matching backgrounds
75
87
  - Do NOT use `prefers-color-scheme` as the only source — the smart default from surface luminance is more important for showcase contrast
76
88
  - Do NOT animate the initial theme application (only transitions after user interaction)
77
89
  - Do NOT forget to sync theme between index and viewer pages
@@ -9,7 +9,15 @@ Intelligent per-screen type detection that ensures web designs open in the web v
9
9
  - `type` — project-level type ("mobile" or "web")
10
10
  - Each screen's `detected_type` — per-screen type ("mobile", "web", or "unknown")
11
11
 
12
- ## How Detection Works (in build_showcase.py)
12
+ ## Project-Level Detection (from DESIGN.md)
13
+
14
+ Before per-screen detection, the script reads `DESIGN.md` for hints about the whole project:
15
+
16
+ - Keywords in the project description: `"mobile"`, `"iOS"`, `"Android"`, `"app"` → likely a mobile project
17
+ - Explicit `## Type` section (`mobile` or `web`) wins over keywords
18
+ - If ambiguous or absent → fall back to per-screen detection (next section) and use `--type` CLI flag to force
19
+
20
+ ## Per-Screen Detection (in build_showcase.py)
13
21
 
14
22
  Each screen's HTML is analyzed for these signals:
15
23
 
@@ -38,3 +38,28 @@ Priority for choosing the canonical (best) version:
38
38
  - `total_screens`: total screens analyzed
39
39
  - `canonical`: the recommended version with slug and HTML snippet
40
40
  - `variants`: list of other versions with similarity scores and difference descriptions
41
+
42
+ ## Workflow (Mode 4: Standardize Components)
43
+
44
+ **Triggers**: "standardize the navbars", "make all footers the same", "usa el navbar del home", "estandariza los botones", or similar.
45
+
46
+ Steps:
47
+
48
+ 1. Open `catalog.html` in the browser — review the comparison view
49
+ 2. User decides which variant to use as canonical
50
+ 3. Run `apply_canonical.py` to apply the chosen canonical:
51
+
52
+ ```bash
53
+ # Structural components (navbar, footer, sidebar, tabbar)
54
+ python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen
55
+
56
+ # Atomic components (button, input, heading, etc.)
57
+ python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ button home_screen
58
+
59
+ # Target specific screens only
60
+ python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen --targets login settings profile
61
+ ```
62
+
63
+ 4. Rebuild the showcase: `build_showcase.py /path/to/source`
64
+ 5. Verify the catalog shows fewer variants / more items in "Already Unified"
65
+ 6. Repeat until all components are standardized
@@ -0,0 +1,113 @@
1
+ # Section: Video Embedding in Slots
2
+
3
+ ## Purpose
4
+
5
+ Sometimes a Stitch slot needs to show a video instead of a still image
6
+ (product demo, animated logo, looping background, recorded screen). This
7
+ document captures the exact pattern that works across browsers and avoids
8
+ the common pitfalls — content recropping, layout shift, AV1 codec, and
9
+ aspect-ratio mismatch with the original wrapper.
10
+
11
+ ## The Tag
12
+
13
+ Use a plain `<video>` element with native `width` and `height` attributes
14
+ plus inline styling for safe defaults:
15
+
16
+ ```html
17
+ <video
18
+ autoplay
19
+ muted
20
+ loop
21
+ playsinline
22
+ width="W"
23
+ height="H"
24
+ preload="metadata"
25
+ style="display:block;width:100%;height:auto;background:#000">
26
+ <source src="../videos/<slug>.mp4" type="video/mp4">
27
+ </video>
28
+ ```
29
+
30
+ Replace `W` / `H` with the **native** video dimensions and `<slug>` with
31
+ the screen slug (or whatever filename you used inside `videos/`).
32
+
33
+ ### Why each attribute
34
+
35
+ | Attribute | Why |
36
+ |-----------|-----|
37
+ | `autoplay muted loop playsinline` | All four are required for in-app autoplay on iOS and Android. Drop any one and mobile browsers refuse to play without a tap. |
38
+ | Native `width` / `height` | Lets the browser compute the aspect ratio from the very first paint — prevents layout shift and CLS regressions. |
39
+ | `preload="metadata"` | Loads just enough to know the dimensions and duration; avoids hammering the user's bandwidth when the screen is offscreen. |
40
+ | `style="display:block"` | Removes the small descender gap inline videos otherwise get. |
41
+ | `style="width:100%;height:auto"` | Scales the video to fit the parent column while keeping its native aspect ratio. **Do NOT use `object-cover`** — it crops the video. |
42
+ | `background:#000` | Hides letterboxing during the brief moment before the first frame paints. |
43
+
44
+ ## File Workflow
45
+
46
+ 1. **Download** the source video. For Facebook/Instagram/YouTube/TikTok we
47
+ recommend `yt-dlp`:
48
+
49
+ ```bash
50
+ yt-dlp "https://www.facebook.com/<...>/videos/<id>" -o "videos/<slug>.%(ext)s"
51
+ ```
52
+
53
+ 2. **Re-encode to H.264** if the source comes down as AV1. AV1 doesn't
54
+ preview in macOS Finder and is rejected by Safari < 17:
55
+
56
+ ```bash
57
+ ffmpeg -i in.mp4 \
58
+ -c:v libx264 -preset fast -crf 23 \
59
+ -c:a aac \
60
+ -movflags +faststart \
61
+ videos/<slug>.mp4
62
+ ```
63
+
64
+ - `-preset fast`: balanced speed/quality.
65
+ - `-crf 23`: visually-lossless default; lower number = bigger file.
66
+ - `-movflags +faststart`: moves the moov atom to the front so the video
67
+ can start playing before fully downloaded.
68
+
69
+ 3. **Place** the encoded `.mp4` in a `videos/` folder at the **project
70
+ level** (the same level as `stitch/` or `showcase/`, not inside
71
+ `assets/`), so the build keeps it out of the screen-extraction pipeline:
72
+
73
+ ```text
74
+ my-project/
75
+ ├── stitch/ ← Stitch exports (zips)
76
+ ├── videos/ ← your videos
77
+ │ └── hero.mp4
78
+ └── showcase/ ← generated
79
+ └── assets/
80
+ └── <slug>.html ← references ../../videos/hero.mp4
81
+ ```
82
+
83
+ 4. **Reference from the screen HTML** with a relative path. From inside
84
+ `showcase/assets/<slug>.html`, `videos/` is two levels up:
85
+
86
+ ```html
87
+ <source src="../../videos/hero.mp4" type="video/mp4">
88
+ ```
89
+
90
+ ## Aspect-Ratio Mismatch
91
+
92
+ The original Stitch wrapper for a video slot usually carries a fixed
93
+ aspect ratio (e.g. `aspect-[4/5]`). If your video is a different shape —
94
+ say 9/16 — keeping the wrapper's aspect locks the video into the wrong
95
+ box, which then forces a choice:
96
+
97
+ | Option | Effect |
98
+ |--------|--------|
99
+ | Keep wrapper's `aspect-*` + `object-cover` | Video crops; logos and edges get chopped. |
100
+ | **Remove wrapper's `aspect-*` + `height:auto`** | Video keeps its native aspect; the slot grows or shrinks vertically to fit. ✅ |
101
+
102
+ The second option is almost always what you want — better to have a
103
+ slightly taller card than to chop the brand logo out of the frame.
104
+
105
+ ## Quick Sanity Checks
106
+
107
+ After embedding, open the screen in a browser and confirm:
108
+
109
+ - The video autoplays without a tap on Chrome, Safari, and Firefox.
110
+ - The video loops cleanly (no flash on rewind).
111
+ - On mobile (iOS Safari), it autoplays silently inline (not fullscreen).
112
+ - The file size is reasonable — re-encode with a higher `-crf` if it's
113
+ more than ~3-5 MB per 10 seconds.
@@ -0,0 +1,82 @@
1
+ # Section: Language Detection
2
+
3
+ ## Purpose
4
+
5
+ The `<html lang="…">` attribute on the generated `index.html` and
6
+ `viewer.html` tells the browser which natural language the content uses.
7
+ If the value disagrees with the actual content, Chrome shows a "Translate
8
+ this page" banner and assistive technologies pronounce words with the
9
+ wrong phoneme set. This document explains how the build picks the value
10
+ and how to override it.
11
+
12
+ ## Resolution Order
13
+
14
+ The `lang` attribute is chosen by the first rule that fires:
15
+
16
+ 1. **CLI flag** (future — not implemented yet): `--lang es` on
17
+ `build_showcase.py`.
18
+ 2. **`showcase.json` field**:
19
+
20
+ ```json
21
+ {
22
+ "source": "stitch",
23
+ "type": "mobile",
24
+ "name": "My App",
25
+ "lang": "es"
26
+ }
27
+ ```
28
+
29
+ 3. **`## Lang` section in `DESIGN.md`** (same shape as `## Type`):
30
+
31
+ ```markdown
32
+ ## Lang
33
+ es
34
+ ```
35
+
36
+ 4. **Auto-detection** from the text content of `DESIGN.md` (project name,
37
+ section names, descriptions). The detector counts Spanish signals:
38
+
39
+ - Accented characters (`á é í ó ú ñ`).
40
+ - Common Spanish stop words (`de`, `el`, `la`, `los`, `las`, `para`,
41
+ `con`, `pantalla`, `aplicación`, `usuario`, etc.).
42
+
43
+ If the Spanish score crosses a small threshold, the lang resolves to
44
+ `"es"`; otherwise it falls through.
45
+
46
+ 5. **Default**: `"en"`.
47
+
48
+ ## When to Override
49
+
50
+ The auto-detector handles obvious cases (a project whose DESIGN.md is
51
+ entirely Spanish or entirely English), but it can be fooled by very
52
+ short DESIGN.md files or by projects where the UI language differs from
53
+ the documentation language. Use an explicit override when:
54
+
55
+ - The DESIGN.md is in English but the actual screen content is Spanish
56
+ (you'd be documenting an es-MX app in English for a client).
57
+ - The DESIGN.md is sparse and the heuristic has nothing to score on.
58
+ - You want a non-Spanish, non-English language (`pt`, `fr`, `de` …) —
59
+ the auto-detector only distinguishes Spanish vs everything else.
60
+
61
+ ## Why It Matters
62
+
63
+ - **Chrome's translate prompt**: with `lang="en"` and Spanish content,
64
+ Chrome offers to translate the page to the user's locale. Users
65
+ perceive this as a bug.
66
+ - **Screen readers**: VoiceOver and TalkBack switch pronunciation
67
+ engines per `lang`. A wrong value makes Spanish text sound like a
68
+ speech synthesizer trying to pronounce "configuración" as English.
69
+ - **Search engines**: the `lang` attribute is a soft signal but it's
70
+ read by indexers when ranking pages by locale.
71
+
72
+ ## Common Mistake: Mismatched Lang and Content
73
+
74
+ The previous template hard-coded `lang="en"` even for Spanish-only
75
+ projects. The fix wasn't to flip the default to `"es"` (that just moves
76
+ the bug to English projects) — it was to detect or accept an override.
77
+ The same logic now lives in `parse_design_md.py` (`_detect_lang`) and
78
+ `build_showcase.py` (the `{{HTML_LANG}}` placeholder substitution).
79
+
80
+ If you ever see Chrome offering to translate one of your showcases:
81
+ that's the signal that the resolved `lang` is wrong. Add an override to
82
+ `showcase.json` or `DESIGN.md` and rebuild.