real-prototypes-skill 0.1.1 → 0.1.3

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.
@@ -4,6 +4,34 @@ description: Capture an existing web platform's visual design and generate featu
4
4
  allowed-tools: Bash(agent-browser:*), Bash(npm:*), Bash(npx:*), Bash(mkdir:*), Bash(node:*)
5
5
  ---
6
6
 
7
+ ## MANDATORY: EXTEND EXISTING PLATFORMS ONLY
8
+
9
+ **This skill adds features to EXISTING platforms. It does NOT create new designs.**
10
+
11
+ ### Before ANY code generation, these MUST exist:
12
+ - `references/design-tokens.json` - Captured colors from existing platform
13
+ - `references/manifest.json` - Captured pages from existing platform
14
+ - `references/screenshots/` - Visual references from existing platform
15
+
16
+ ### If captures don't exist:
17
+ **STOP** - Do not proceed with code generation
18
+ Run capture on the existing platform first:
19
+ ```bash
20
+ node cli.js capture --project <name> --url <PLATFORM_URL>
21
+ ```
22
+ NEVER create new designs, colors, or layouts from scratch
23
+
24
+ ### If prototype already exists:
25
+ Use **EXTEND MODE** - Modify existing files only
26
+ NEVER replace or recreate existing pages
27
+
28
+ ### CLI Enforcement:
29
+ - `new` command requires `--force-create` flag (blocks by default)
30
+ - `generate` command runs pre-flight check (blocks if captures missing)
31
+ - `plan` command validates captures exist before generating plan
32
+
33
+ ---
34
+
7
35
  # Platform Prototype Skill
8
36
 
9
37
  Enterprise-grade tool for capturing web platforms and generating pixel-perfect prototypes.
@@ -104,26 +132,37 @@ node cli.js list
104
132
 
105
133
  ## Project Structure
106
134
 
107
- All projects are stored in the `projects/` directory:
135
+ All projects are stored in the `projects/` directory at the repository root:
136
+
137
+ ```
138
+ <repository-root>/
139
+ └── projects/
140
+ └── <project-name>/
141
+ ├── project.json # Project metadata
142
+ ├── references/ # Captured platform assets (READ from here)
143
+ │ ├── manifest.json
144
+ │ ├── design-tokens.json
145
+ │ ├── screenshots/
146
+ │ └── html/
147
+ └── prototype/ # Generated prototype (WRITE here)
148
+ ├── src/
149
+ └── package.json
150
+ ```
151
+
152
+ ### CRITICAL: File Output Location
108
153
 
154
+ **ALL generated prototype files MUST be created in:**
109
155
  ```
110
- real-prototypes-skill/
111
- ├── projects/
112
- │ ├── my-app/
113
- │ │ ├── project.json # Project metadata
114
- │ │ ├── references/ # Captured platform assets
115
- │ │ │ ├── manifest.json
116
- │ │ │ ├── design-tokens.json
117
- │ │ │ ├── screenshots/
118
- │ │ │ └── html/
119
- │ │ └── prototype/ # Generated Next.js prototype
120
- │ │ ├── src/
121
- │ │ └── package.json
122
- │ └── another-project/
123
- │ └── ...
124
- └── .claude/skills/real-prototypes-skill/
156
+ projects/<project-name>/prototype/
125
157
  ```
126
158
 
159
+ **Run `generate` command to see the exact absolute path:**
160
+ ```bash
161
+ node cli.js generate --project <project-name>
162
+ ```
163
+
164
+ This will output the full path where prototype files should be created.
165
+
127
166
  ---
128
167
 
129
168
  ## Capture Engine
@@ -203,6 +242,17 @@ node cli.js list
203
242
  Lists all projects with their status.
204
243
  ```
205
244
 
245
+ ### detect
246
+ ```bash
247
+ node cli.js detect --project <name>
248
+
249
+ Detects existing prototype in project.
250
+ - Identifies framework (Next.js, React, Vue, Angular)
251
+ - Detects styling approach (Tailwind, CSS modules, etc.)
252
+ - Maps captured pages to existing prototype files
253
+ - Recommends EXTEND vs CREATE mode
254
+ ```
255
+
206
256
  ### capture
207
257
  ```bash
208
258
  node cli.js capture --project <name> --url <URL> [options]
@@ -232,6 +282,82 @@ Phases:
232
282
  all Run all validations
233
283
  ```
234
284
 
285
+ ### validate-colors
286
+ ```bash
287
+ node cli.js validate-colors --project <name>
288
+
289
+ Validates all colors in prototype against design-tokens.json.
290
+ - Scans TSX/JSX/CSS files for color values
291
+ - Reports violations with line numbers
292
+ - Suggests closest matching design token colors
293
+ - Flags Tailwind default colors (bg-blue-500, etc.)
294
+ ```
295
+
296
+ ### convert
297
+ ```bash
298
+ node cli.js convert --project <name> --page <page>
299
+
300
+ Converts captured HTML to React components.
301
+ - Parses HTML using jsdom
302
+ - Extracts component tree structure
303
+ - Converts to JSX (class→className, for→htmlFor)
304
+ - Preserves exact class names and inline styles
305
+ - Outputs to prototype/src/components/extracted/
306
+ ```
307
+
308
+ ### extract-css
309
+ ```bash
310
+ node cli.js extract-css --project <name> --page <page>
311
+
312
+ Extracts and analyzes CSS from captured HTML.
313
+ - Parses <style> tags and inline styles
314
+ - Detects styling paradigm (Tailwind, SLDS, Bootstrap, etc.)
315
+ - Shows most used CSS classes
316
+ - Recommends styling approach for prototype
317
+ ```
318
+
319
+ ### extract-lib
320
+ ```bash
321
+ node cli.js extract-lib --project <name>
322
+
323
+ Extracts reusable component library from all captured HTML.
324
+ - Identifies common patterns (buttons, cards, inputs, tables)
325
+ - Detects component variants (primary, secondary, disabled)
326
+ - Generates TypeScript React components
327
+ - Creates component registry (registry.json)
328
+ - Outputs to prototype/src/components/extracted/
329
+ ```
330
+
331
+ ### visual-diff
332
+ ```bash
333
+ node cli.js visual-diff --project <name> --page <page>
334
+ node cli.js visual-diff --project <name> --list
335
+
336
+ Compares generated screenshots with reference captures.
337
+ - Pixel-level comparison using pixelmatch
338
+ - Generates diff images highlighting differences
339
+ - Calculates similarity score (target: >95%)
340
+ - Use --list to see available reference screenshots
341
+ ```
342
+
343
+ ### plan
344
+ ```bash
345
+ node cli.js plan --project <name> --feature "description"
346
+
347
+ Generates implementation plan with exact details.
348
+ - Analyzes existing prototype structure
349
+ - Specifies EXTEND vs CREATE mode
350
+ - Provides exact file paths for modifications
351
+ - Includes injection points with selectors
352
+ - Lists validation checkpoints
353
+ - Outputs plan.json to project directory
354
+
355
+ Options:
356
+ --feature Description of feature to implement
357
+ --target Target page for modification
358
+ --output Custom output path for plan.json
359
+ ```
360
+
235
361
  ### pipeline
236
362
  ```bash
237
363
  node cli.js pipeline --project <name> --url <URL> [options]
@@ -248,6 +374,76 @@ Creates capture-config.json template
248
374
 
249
375
  ---
250
376
 
377
+ ## Extended Workflow (RECOMMENDED)
378
+
379
+ For best results, follow this extended workflow that addresses common issues:
380
+
381
+ ### Phase 0: Pre-Implementation
382
+ ```bash
383
+ # 1. Check for existing prototype FIRST
384
+ node cli.js detect --project my-app
385
+
386
+ # 2. Generate implementation plan
387
+ node cli.js plan --project my-app --feature "Add health score widget"
388
+
389
+ # 3. Review plan.json before proceeding
390
+ ```
391
+
392
+ ### Phase 1: Analysis
393
+ ```bash
394
+ # 4. Extract component library from captured HTML
395
+ node cli.js extract-lib --project my-app
396
+
397
+ # 5. Analyze CSS patterns
398
+ node cli.js extract-css --project my-app --page homepage
399
+
400
+ # 6. Convert specific pages to React
401
+ node cli.js convert --project my-app --page account-detail
402
+ ```
403
+
404
+ ### Phase 2: Implementation
405
+ - Read the generated plan.json
406
+ - Use EXTEND mode if prototype exists (modify, don't replace)
407
+ - Use ONLY colors from design-tokens.json
408
+ - Match styling approach detected by extract-css
409
+
410
+ ### Phase 3: Validation
411
+ ```bash
412
+ # 7. Validate colors
413
+ node cli.js validate-colors --project my-app
414
+
415
+ # 8. Visual comparison (if screenshots available)
416
+ node cli.js visual-diff --project my-app --page homepage
417
+
418
+ # 9. Full validation
419
+ node cli.js validate --project my-app --phase post-gen
420
+ ```
421
+
422
+ ---
423
+
424
+ ## Critical Rules
425
+
426
+ ### NEVER:
427
+ 1. ❌ Create new design systems or color schemes
428
+ 2. ❌ Deviate from captured design tokens
429
+ 3. ❌ Use colors not in design-tokens.json
430
+ 4. ❌ Create new prototype if one exists (use EXTEND mode)
431
+ 5. ❌ Replace existing pages - always extend
432
+ 6. ❌ Introduce new styling paradigms (don't add styled-components if using CSS modules)
433
+
434
+ ### ALWAYS:
435
+ 1. ✅ Run `detect` first to check for existing prototype
436
+ 2. ✅ Run `plan` to get implementation guidance
437
+ 3. ✅ Parse captured HTML for exact structure
438
+ 4. ✅ Validate colors against design-tokens.json
439
+ 5. ✅ Use screenshot for visual reference
440
+ 6. ✅ Preserve 100% of existing functionality
441
+ 7. ✅ Match framework and styling of existing code
442
+ 8. ✅ Insert at exact location specified in plan
443
+ 9. ✅ Verify visual output matches reference >95%
444
+
445
+ ---
446
+
251
447
  ## Configuration
252
448
 
253
449
  ```json