@maccesar/aiskills 1.12.0 → 1.15.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 (59) hide show
  1. package/README.md +42 -7
  2. package/lib/cleanup.js +29 -0
  3. package/lib/commands/skills.js +110 -9
  4. package/lib/config.js +17 -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 +1 -1
  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/stitch-showcase/SKILL.md +24 -232
  25. package/skills/stitch-showcase/references/07-theme-system.md +12 -0
  26. package/skills/stitch-showcase/references/08-type-detection.md +9 -1
  27. package/skills/stitch-showcase/references/10-component-standardization.md +25 -0
  28. package/skills/stitch-showcase/references/12-video-embedding.md +113 -0
  29. package/skills/stitch-showcase/references/13-language-detection.md +82 -0
  30. package/skills/stitch-showcase/references/14-troubleshooting-known-issues.md +122 -0
  31. package/skills/stitch-showcase/references/15-build-flags.md +71 -0
  32. package/skills/stitch-showcase/references/16-design-md-format.md +107 -0
  33. package/skills/stitch-showcase/references/index.html +25 -19
  34. package/skills/stitch-showcase/references/viewer.html +24 -12
  35. package/skills/stitch-showcase/scripts/__pycache__/build_showcase.cpython-314.pyc +0 -0
  36. package/skills/stitch-showcase/scripts/__pycache__/component_utils.cpython-314.pyc +0 -0
  37. package/skills/stitch-showcase/scripts/__pycache__/detect_components.cpython-314.pyc +0 -0
  38. package/skills/stitch-showcase/scripts/__pycache__/extract_catalog.cpython-314.pyc +0 -0
  39. package/skills/stitch-showcase/scripts/__pycache__/extract_text.cpython-314.pyc +0 -0
  40. package/skills/stitch-showcase/scripts/__pycache__/extract_zips.cpython-314.pyc +0 -0
  41. package/skills/stitch-showcase/scripts/__pycache__/parse_design_md.cpython-314.pyc +0 -0
  42. package/skills/stitch-showcase/scripts/__pycache__/slug_demangle.cpython-314.pyc +0 -0
  43. package/skills/stitch-showcase/scripts/build_showcase.py +150 -10
  44. package/skills/stitch-showcase/scripts/parse_design_md.py +145 -12
  45. package/skills/stitch-showcase/scripts/slug_demangle.py +209 -0
  46. package/skills/vscode-extension-dev/SKILL.md +90 -41
  47. package/skills/vscode-extension-dev/references/api-additional.md +168 -0
  48. package/skills/vscode-extension-dev/references/api-progress.md +55 -0
  49. package/skills/vscode-extension-dev/references/api-quickpick.md +75 -0
  50. package/skills/vscode-extension-dev/references/api-secretstorage.md +57 -0
  51. package/skills/vscode-extension-dev/references/api-statusbar.md +38 -0
  52. package/skills/vscode-extension-dev/references/api-treeview.md +78 -0
  53. package/skills/vscode-extension-dev/references/api-webview.md +149 -0
  54. package/skills/vscode-extension-dev/references/architecture.md +67 -0
  55. package/skills/vscode-extension-dev/references/debugger.md +179 -0
  56. package/skills/vscode-extension-dev/references/lsp.md +175 -0
  57. package/skills/vscode-extension-dev/references/notebooks.md +208 -0
  58. package/skills/vscode-extension-dev/references/testing.md +208 -0
  59. package/skills/vscode-extension-dev/references/api-patterns.md +0 -625
@@ -0,0 +1,181 @@
1
+ # Component Patterns: Modals, Forms, Tables
2
+
3
+ > **Scope note**: *Refactoring UI* covers button tiers and label patterns directly (see `02-page-mechanics.md`), but does not have dedicated chapters for modals, forms, or tables. This file applies the book's principles — hierarchy through weight/color, generous spacing, grouping by proximity, finishing with restraint — to these three common components.
4
+
5
+ ---
6
+
7
+ ## Modals
8
+
9
+ ### When to Use a Modal
10
+
11
+ - A focused decision that **blocks** the current task (confirm destructive action, complete a required step)
12
+ - Short content that doesn't deserve a full page
13
+ - Multi-step flows that should preserve the underlying context (the page behind the modal)
14
+
15
+ When **not** to use a modal:
16
+
17
+ - Anything the user might want to consult while doing the surrounding task — modals trap them
18
+ - Long content that scrolls — make it a page
19
+ - Anything that needs to be linkable — modals are stateless to the URL by default
20
+
21
+ ### Layout
22
+
23
+ | Element | Rule |
24
+ |---|---|
25
+ | Width | Fixed pixel max (`max-width: 480px` typical) — never percentage |
26
+ | Vertical position | Anchored ~10–15% from the top of viewport, not centered — feels more stable |
27
+ | Backdrop | Semi-opaque dark overlay (~50–70% opacity) — darkens the page enough to focus attention |
28
+ | Padding | Generous — modal content is usually short; tight padding feels cramped |
29
+ | Close affordance | "Cancel" button in the footer AND an `×` in the top corner — keyboard users use Esc |
30
+
31
+ ### Focus and Keyboard
32
+
33
+ Three keyboard requirements, all non-negotiable:
34
+
35
+ 1. **Focus moves into the modal on open** — typically to the first interactive element, or the close button if the modal is informational
36
+ 2. **Focus traps inside the modal** — Tab/Shift+Tab cycle through modal elements only, never leaking to the page behind
37
+ 3. **Esc closes the modal** AND focus returns to the element that opened it
38
+
39
+ These are the table-stakes of accessibility for modals. Libraries like `focus-trap` or `@radix-ui/react-dialog` solve them — don't roll your own unless you must.
40
+
41
+ ### Button Order
42
+
43
+ The primary action sits on the **right** in left-to-right UIs:
44
+
45
+ ```
46
+ [ Cancel ] [ Save changes ]
47
+ ```
48
+
49
+ Destructive primary actions get an extra confirmation (a typed confirmation, or a secondary modal). Don't bury a destructive button next to a safe one.
50
+
51
+ ## Forms
52
+
53
+ ### Label Placement
54
+
55
+ Top-aligned labels are the default for almost every form:
56
+
57
+ - Fastest to scan top-to-bottom
58
+ - Work on narrow screens without reflow
59
+ - Easier to localize (labels grow in length across languages)
60
+
61
+ Left-aligned labels look formal but force the user's eye to zig-zag and break on mobile. Reserve for dense data-entry screens where users repeatedly fill the same form.
62
+
63
+ ### Validation Timing
64
+
65
+ - **On blur** for individual fields — show the error after the user leaves the field, not while they're typing
66
+ - **On submit** for fields they haven't touched yet
67
+ - **On change** ONLY for fields where the answer is binary and visible (e.g., a password strength meter, a username availability check)
68
+
69
+ Inline validation while the user is mid-typing reads as the form fighting them.
70
+
71
+ ### Error Display
72
+
73
+ A field in error state should have:
74
+
75
+ - A color change (red border, but not the *only* signal)
76
+ - A short message **below** the field, in the same color as the border
77
+ - An icon at the start of the message — color is not enough (≈8% of males can't distinguish red from green)
78
+ - The field's normal label and placeholder stay legible — don't replace them with the error
79
+
80
+ ### Spacing Within a Form
81
+
82
+ Apply the Law of Proximity from `02-page-mechanics.md`:
83
+
84
+ ```
85
+ [Label]
86
+ [Input]
87
+ (small gap, ~8px)
88
+ [Helper text]
89
+
90
+ (large gap, ~24-32px to the next field group)
91
+
92
+ [Label]
93
+ [Input]
94
+ ```
95
+
96
+ Label sits closer to its own input than to anything else. Each field group is clearly separated from the next.
97
+
98
+ ### Button Placement
99
+
100
+ - **Single primary button** at the bottom left or center — never aligned right unless the form sits inside a modal (modals follow the modal rule)
101
+ - **Secondary "Cancel"** to the left of the primary
102
+ - Disable the submit button only when there are concrete errors — disabling it preemptively because the user "hasn't typed everything yet" leaves them guessing
103
+
104
+ ### Required vs Optional
105
+
106
+ If most fields are required, mark only the **optional** ones — less noise overall. If most are optional, mark the required ones with `*`. Either system is fine — pick one and stay consistent.
107
+
108
+ ## Tables
109
+
110
+ ### Density Tiers
111
+
112
+ Pick a row density based on the user's job:
113
+
114
+ | Tier | Row height | Use |
115
+ |---|---|---|
116
+ | Comfortable | 56–64px | Marketing tables, dashboards seen occasionally |
117
+ | Default | 40–48px | Most app tables |
118
+ | Compact | 28–36px | Operator dashboards (CRM, admin, finance) where rows are scanned in bulk |
119
+
120
+ Don't go below 28px unless the data is genuinely homogeneous — eye fatigue scales with row count, not just total height.
121
+
122
+ ### Alignment by Data Type
123
+
124
+ | Data type | Alignment | Reason |
125
+ |---|---|---|
126
+ | Text (names, labels) | Left | Default reading direction |
127
+ | Numbers (counts, money, percentages) | Right | Digits and decimals line up; magnitudes are scannable |
128
+ | Dates | Left or right consistent | Pick one and stick — comparing dates is easier with consistent alignment |
129
+ | Status / chips | Center inside their own column | Visually balanced when the chip is the only content |
130
+ | Actions (icons, kebabs) | Right | Out of the way of the data |
131
+
132
+ ### Column Headers
133
+
134
+ Mirror the column's content alignment. A right-aligned numeric column gets a right-aligned header.
135
+
136
+ Sortable columns get an indicator (arrow up/down) AND show the active sort with stronger contrast — color alone isn't enough.
137
+
138
+ ### Sticky Headers
139
+
140
+ For tables that scroll vertically inside their container, the header should stick. Two ways:
141
+
142
+ 1. `position: sticky; top: 0;` on the `<thead>` — easiest, works inside scrollable containers
143
+ 2. A second fixed header rendered above the scroll area — needed when the table itself scrolls in `<body>` (not its own container)
144
+
145
+ Sticky headers must have a solid (opaque) background, otherwise rows scrolling behind them show through.
146
+
147
+ ### Row Hover and Selection
148
+
149
+ - Subtle row hover background (one shade-step on neutrals) — helps the eye track across wide tables
150
+ - Selection: a left-edge accent stripe **plus** a tinted background — selection should be obvious without screaming
151
+ - Don't animate row hover — adds latency to bulk scanning
152
+
153
+ ### Empty Tables
154
+
155
+ Apply the empty-state rule from `04-polish.md`: don't just show "No data" centered in a blank rectangle. The empty state communicates what could go there and offers a way to start.
156
+
157
+ ## Anti-Patterns
158
+
159
+ ### Modals
160
+
161
+ - ❌ Centering vertically — feels unanchored
162
+ - ❌ No close affordance — Esc users can escape, mouse users get stuck
163
+ - ❌ Modals over modals (nested) — confusing back-stack
164
+ - ❌ Destructive action as primary button without confirmation step
165
+ - ❌ No focus trap — Tab leaks to the page behind
166
+
167
+ ### Forms
168
+
169
+ - ❌ Placeholder as the only label — vanishes on focus, accessibility regression
170
+ - ❌ Inline validation on keystroke — fights the user
171
+ - ❌ Disabling the submit button without explaining why
172
+ - ❌ Red asterisks on every field — visual noise
173
+ - ❌ Forms wider than ~600px — eye tracking degrades
174
+
175
+ ### Tables
176
+
177
+ - ❌ Centered text columns — slow to scan
178
+ - ❌ Left-aligned numeric columns — magnitudes hide
179
+ - ❌ Translucent sticky header — rows show through
180
+ - ❌ Row dividers AND row hover background — over-decorated
181
+ - ❌ A single fixed column width for every column — wastes space; let content determine width within sensible min/max
@@ -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