real-prototypes-skill 0.1.3 → 1.0.2

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.
@@ -6,6 +6,23 @@ allowed-tools: Bash(agent-browser:*)
6
6
 
7
7
  # Browser Automation with agent-browser
8
8
 
9
+ ## Installation
10
+
11
+ `agent-browser` is a **Vercel Labs npm package** for headless browser automation.
12
+
13
+ ```bash
14
+ # Install globally
15
+ npm install -g agent-browser
16
+
17
+ # Download Chromium (required after npm install)
18
+ agent-browser install
19
+
20
+ # Verify installation
21
+ agent-browser --version
22
+ ```
23
+
24
+ **Repository:** https://github.com/vercel-labs/agent-browser
25
+
9
26
  ## Quick start
10
27
 
11
28
  ```bash
@@ -38,6 +38,38 @@ Enterprise-grade tool for capturing web platforms and generating pixel-perfect p
38
38
 
39
39
  ---
40
40
 
41
+ ## Prerequisites
42
+
43
+ ### Required: agent-browser
44
+ This skill requires **agent-browser** for browser automation.
45
+
46
+ `agent-browser` is a **Vercel Labs npm package** for headless browser automation.
47
+
48
+ **Installation:**
49
+ ```bash
50
+ # Install globally
51
+ npm install -g agent-browser
52
+
53
+ # Download Chromium (required after npm install)
54
+ agent-browser install
55
+ ```
56
+
57
+ **Verify installation:**
58
+ ```bash
59
+ agent-browser --version
60
+ ```
61
+
62
+ **Note:** The `npx real-prototypes-skill` installer will attempt to install agent-browser automatically.
63
+
64
+ ### Alternative: Manual Capture
65
+ If you can't install `agent-browser`, you can still use this skill by:
66
+ 1. Manually taking screenshots and saving to `references/screenshots/`
67
+ 2. Manually saving HTML to `references/html/`
68
+ 3. Running `node cli.js extract-tokens` to generate design tokens from HTML
69
+ 4. Then using `generate`, `plan`, and other commands
70
+
71
+ ---
72
+
41
73
  ## 🏢 ENTERPRISE PIPELINE - MANDATORY FOR ALL PROTOTYPES
42
74
 
43
75
  **This pipeline MUST be followed. Validation gates will BLOCK generation if prerequisites are missing.**
@@ -16,6 +16,41 @@ const fs = require('fs');
16
16
  const path = require('path');
17
17
  const { execSync } = require('child_process');
18
18
 
19
+ // Check for required dependencies
20
+ function checkDependencies() {
21
+ const required = ['jsdom'];
22
+ const missing = [];
23
+
24
+ for (const dep of required) {
25
+ try {
26
+ require.resolve(dep);
27
+ } catch (e) {
28
+ missing.push(dep);
29
+ }
30
+ }
31
+
32
+ if (missing.length > 0) {
33
+ console.log(`
34
+ \x1b[31m════════════════════════════════════════════════════════════\x1b[0m
35
+ \x1b[31m MISSING DEPENDENCIES\x1b[0m
36
+ \x1b[31m════════════════════════════════════════════════════════════\x1b[0m
37
+
38
+ The following required packages are not installed:
39
+ ${missing.join(', ')}
40
+
41
+ \x1b[1mTo fix, run:\x1b[0m
42
+ cd ${__dirname} && npm install
43
+
44
+ \x1b[1mOr reinstall the skill:\x1b[0m
45
+ npx real-prototypes-skill@latest --force
46
+ `);
47
+ process.exit(1);
48
+ }
49
+ }
50
+
51
+ // Run dependency check before anything else
52
+ checkDependencies();
53
+
19
54
  const SKILL_DIR = __dirname;
20
55
  const PROJECTS_DIR = path.resolve(SKILL_DIR, '../../../projects');
21
56
  const VERSION = '1.4.0';
@@ -4,6 +4,22 @@ Copy this to your project's CLAUDE.md and fill in your platform details.
4
4
 
5
5
  ---
6
6
 
7
+ ## ⚠️ IMPORTANT: This Skill Extends EXISTING Platforms
8
+
9
+ This skill is for **adding features to existing platforms**, NOT creating new designs.
10
+
11
+ **Before generating any code:**
12
+ 1. You MUST have an existing platform to capture
13
+ 2. Run `capture` to get screenshots, HTML, and design tokens
14
+ 3. Only then can you generate prototype code
15
+
16
+ **The CLI will BLOCK you if:**
17
+ - You try to create a new project without `--force-create`
18
+ - You try to generate code without captures
19
+ - You try to generate a plan without captures
20
+
21
+ ---
22
+
7
23
  ## Platform Credentials
8
24
 
9
25
  ```
@@ -45,29 +61,33 @@ VIEWPORT_HEIGHT=1080
45
61
  WAIT_AFTER_LOAD=2000
46
62
  ```
47
63
 
48
- ## Advanced Settings (Optional)
64
+ ## Workflow
49
65
 
50
- ```
51
- # Maximum wait timeout (milliseconds)
52
- MAX_WAIT_TIMEOUT=10000
66
+ ```bash
67
+ # 1. Create a new project (requires --force-create)
68
+ node cli.js new --project my-app --force-create
69
+
70
+ # 2. Capture the existing platform
71
+ node cli.js capture --project my-app --url https://your-platform.com
72
+
73
+ # 3. Check for existing prototype (if any)
74
+ node cli.js detect --project my-app
53
75
 
54
- # Retry settings
55
- MAX_RETRIES=3
56
- TIMEOUT_RETRIES=2
57
- RETRY_DELAY_BASE=1000
76
+ # 4. Generate implementation plan
77
+ node cli.js plan --project my-app --feature "Add chatbot widget"
58
78
 
59
- # Validation thresholds
60
- MIN_SCREENSHOT_SIZE=102400
61
- MIN_HTML_SIZE=10240
62
- MIN_PAGE_HEIGHT=500
79
+ # 5. Generate prototype guidance (shows paths and colors)
80
+ node cli.js generate --project my-app
63
81
 
64
- # Exclude URL patterns from capture (comma-separated)
65
- # EXCLUDE_PATTERNS=/logout,/signout,/delete,/admin
82
+ # 6. Validate colors after implementation
83
+ node cli.js validate-colors --project my-app
66
84
  ```
67
85
 
68
86
  ## Usage Notes
69
87
 
70
- - The skill will read these values when running the capture phase
88
+ - The skill will read credentials when running the capture phase
71
89
  - Credentials are only used locally for browser automation
72
90
  - Never commit this file to version control with real credentials
73
- - Add CLAUDE.md to your .gitignore
91
+ - Add CLAUDE.md to your .gitignore if it contains credentials
92
+ - ALL prototype files must be created in `projects/<project>/prototype/`
93
+ - Use ONLY colors from `design-tokens.json` - no Tailwind defaults
@@ -0,0 +1,93 @@
1
+ # Real Prototypes - Example CLAUDE.md Configuration
2
+
3
+ Copy this to your project's CLAUDE.md and fill in your platform details.
4
+
5
+ ---
6
+
7
+ ## ⚠️ IMPORTANT: This Skill Extends EXISTING Platforms
8
+
9
+ This skill is for **adding features to existing platforms**, NOT creating new designs.
10
+
11
+ **Before generating any code:**
12
+ 1. You MUST have an existing platform to capture
13
+ 2. Run `capture` to get screenshots, HTML, and design tokens
14
+ 3. Only then can you generate prototype code
15
+
16
+ **The CLI will BLOCK you if:**
17
+ - You try to create a new project without `--force-create`
18
+ - You try to generate code without captures
19
+ - You try to generate a plan without captures
20
+
21
+ ---
22
+
23
+ ## Platform Credentials
24
+
25
+ ```
26
+ # Your platform's base URL (no trailing slash)
27
+ PLATFORM_URL=https://app.example.com
28
+
29
+ # Login credentials (if the platform requires authentication)
30
+ PLATFORM_EMAIL=your-email@example.com
31
+ PLATFORM_PASSWORD=your-secure-password
32
+ ```
33
+
34
+ ## Capture Settings
35
+
36
+ ```
37
+ # Pages to capture
38
+ # Option 1: Specify pages manually (comma-separated paths)
39
+ PAGES_TO_CAPTURE=/dashboard,/settings,/profile,/users
40
+
41
+ # Option 2: Auto-discover all pages
42
+ # PAGES_TO_CAPTURE=auto
43
+
44
+ # Option 3: Disable auto-capture (only capture specified pages)
45
+ # PAGES_TO_CAPTURE=off
46
+
47
+ # Capture mode
48
+ # "full" = capture all discovered pages up to MAX_PAGES
49
+ # "manual" = only capture pages listed in PAGES_TO_CAPTURE
50
+ CAPTURE_MODE=manual
51
+
52
+ # Maximum pages to capture in auto/full mode
53
+ MAX_PAGES=50
54
+
55
+ # Viewport dimensions (pixels)
56
+ VIEWPORT_WIDTH=1920
57
+ VIEWPORT_HEIGHT=1080
58
+
59
+ # Wait time after page load before capturing (milliseconds)
60
+ # Increase this if pages have slow-loading content or animations
61
+ WAIT_AFTER_LOAD=2000
62
+ ```
63
+
64
+ ## Workflow
65
+
66
+ ```bash
67
+ # 1. Create a new project (requires --force-create)
68
+ node cli.js new --project my-app --force-create
69
+
70
+ # 2. Capture the existing platform
71
+ node cli.js capture --project my-app --url https://your-platform.com
72
+
73
+ # 3. Check for existing prototype (if any)
74
+ node cli.js detect --project my-app
75
+
76
+ # 4. Generate implementation plan
77
+ node cli.js plan --project my-app --feature "Add chatbot widget"
78
+
79
+ # 5. Generate prototype guidance (shows paths and colors)
80
+ node cli.js generate --project my-app
81
+
82
+ # 6. Validate colors after implementation
83
+ node cli.js validate-colors --project my-app
84
+ ```
85
+
86
+ ## Usage Notes
87
+
88
+ - The skill will read credentials when running the capture phase
89
+ - Credentials are only used locally for browser automation
90
+ - Never commit this file to version control with real credentials
91
+ - Add CLAUDE.md to your .gitignore if it contains credentials
92
+ - ALL prototype files must be created in `projects/<project>/prototype/`
93
+ - Use ONLY colors from `design-tokens.json` - no Tailwind defaults
package/README.md CHANGED
@@ -117,18 +117,32 @@ design. Include payment selection and order summary.
117
117
 
118
118
  ### Required
119
119
 
120
- - **Claude Code CLI** (v0.5.0+)
120
+ - **agent-browser** - Vercel Labs browser automation package
121
121
  ```bash
122
- # Install from https://claude.ai/code
123
- npm install -g @anthropic-ai/claude-code
122
+ # Install globally
123
+ npm install -g agent-browser
124
+
125
+ # Download Chromium (required after npm install)
126
+ agent-browser install
127
+
128
+ # Verify installation
129
+ agent-browser --version
124
130
  ```
125
131
 
132
+ **Note:** The `npx real-prototypes-skill` installer will attempt to install agent-browser automatically.
133
+
126
134
  - **Node.js 18+**
127
135
  ```bash
128
136
  node --version # Should be v18.0.0 or higher
129
137
  ```
130
138
 
131
- - **agent-browser-skill** (installed automatically with npx)
139
+ ### If You Can't Install agent-browser
140
+
141
+ You can still use this skill with **manual capture**:
142
+ 1. Take screenshots manually and save to `references/screenshots/`
143
+ 2. Save HTML files to `references/html/`
144
+ 3. Run `node cli.js extract-tokens` to generate design tokens
145
+ 4. Then use `generate`, `plan`, and other commands
132
146
 
133
147
  ### Optional (Enhances Features)
134
148
 
@@ -377,12 +391,48 @@ npm run dev
377
391
 
378
392
  ## Troubleshooting
379
393
 
380
- ### "agent-browser-skill not found"
394
+ ### "agent-browser not found"
395
+
396
+ `agent-browser` is a **Vercel Labs npm package** that needs to be installed separately.
381
397
 
382
- The npx installer should install this automatically. If not:
398
+ **Install agent-browser:**
383
399
  ```bash
384
- cd ~/.claude/skills
385
- git clone https://github.com/anthropics/agent-browser-skill.git
400
+ # Install globally
401
+ npm install -g agent-browser
402
+
403
+ # Download Chromium (required after npm install)
404
+ agent-browser install
405
+
406
+ # Verify installation
407
+ agent-browser --version
408
+ ```
409
+
410
+ **Alternative - Manual capture workflow:**
411
+ ```bash
412
+ # 1. Take screenshots manually, save to:
413
+ projects/<name>/references/screenshots/
414
+
415
+ # 2. Save HTML files to:
416
+ projects/<name>/references/html/
417
+
418
+ # 3. Extract design tokens from HTML:
419
+ node cli.js extract-tokens --project <name>
420
+
421
+ # 4. Continue with generate/plan commands
422
+ node cli.js generate --project <name>
423
+ ```
424
+
425
+ ### "Missing dependencies (jsdom, etc.)"
426
+
427
+ The skill requires dependencies to be installed:
428
+ ```bash
429
+ cd .claude/skills/real-prototypes-skill
430
+ npm install
431
+ ```
432
+
433
+ Or reinstall the skill:
434
+ ```bash
435
+ npx real-prototypes-skill@latest --force
386
436
  ```
387
437
 
388
438
  ### "Colors don't match the captured design"
package/bin/cli.js CHANGED
@@ -215,6 +215,71 @@ function install(options) {
215
215
 
216
216
  log(`Skill installed to ${targetDir}`, 'success');
217
217
 
218
+ // Install dependencies in the skill directory
219
+ const skillPackageJson = {
220
+ "name": "real-prototypes-skill-deps",
221
+ "private": true,
222
+ "dependencies": {
223
+ "jsdom": "^27.4.0",
224
+ "@babel/parser": "^7.29.0",
225
+ "@babel/traverse": "^7.29.0",
226
+ "@babel/generator": "^7.29.0",
227
+ "class-variance-authority": "^0.7.1",
228
+ "clsx": "^2.1.1",
229
+ "tailwind-merge": "^3.4.0"
230
+ }
231
+ };
232
+
233
+ const skillPkgPath = path.join(targetDir, 'package.json');
234
+ fs.writeFileSync(skillPkgPath, JSON.stringify(skillPackageJson, null, 2));
235
+ log('Installing skill dependencies...', 'info');
236
+
237
+ try {
238
+ const { execSync } = require('child_process');
239
+ execSync('npm install --production', {
240
+ cwd: targetDir,
241
+ stdio: 'pipe'
242
+ });
243
+ log('Dependencies installed', 'success');
244
+ } catch (e) {
245
+ log('Warning: Could not auto-install dependencies', 'warning');
246
+ log(`Run manually: cd ${targetDir} && npm install`, 'info');
247
+ }
248
+
249
+ // Install agent-browser globally (required for browser automation)
250
+ log('Installing agent-browser (Vercel Labs browser automation)...', 'info');
251
+ try {
252
+ const { execSync } = require('child_process');
253
+ // Check if already installed
254
+ try {
255
+ execSync('agent-browser --version', { stdio: 'pipe' });
256
+ log('agent-browser already installed', 'success');
257
+ } catch {
258
+ // Not installed, install it
259
+ execSync('npm install -g agent-browser', { stdio: 'pipe' });
260
+ log('agent-browser installed globally', 'success');
261
+
262
+ // Download Chromium browser
263
+ log('Downloading Chromium for agent-browser...', 'info');
264
+ execSync('agent-browser install', { stdio: 'pipe' });
265
+ log('Chromium downloaded', 'success');
266
+ }
267
+ } catch (e) {
268
+ log('Warning: Could not install agent-browser automatically', 'warning');
269
+ log('Install manually: npm install -g agent-browser && agent-browser install', 'info');
270
+ log('Without agent-browser, you can still use manual capture mode', 'info');
271
+ }
272
+
273
+ // Copy CLAUDE.md.example to current directory if local install
274
+ if (!options.global) {
275
+ const exampleSource = path.join(path.dirname(__dirname), 'CLAUDE.md.example');
276
+ const exampleTarget = path.join(process.cwd(), 'CLAUDE.md.example');
277
+ if (fs.existsSync(exampleSource) && !fs.existsSync(exampleTarget)) {
278
+ fs.copyFileSync(exampleSource, exampleTarget);
279
+ log('CLAUDE.md.example copied to project root', 'success');
280
+ }
281
+ }
282
+
218
283
  // Also copy the agent-browser-skill if it exists and not already present
219
284
  const agentBrowserSource = path.join(path.dirname(skillSource), 'agent-browser-skill');
220
285
  const agentBrowserTarget = path.join(targetBase, 'agent-browser-skill');
@@ -271,7 +336,8 @@ function install(options) {
271
336
  ${targetDir}/QUICKSTART.md
272
337
 
273
338
  \x1b[1mExample Config:\x1b[0m
274
- See .claude/skills/real-prototypes-skill/examples/CLAUDE.md.example for a complete configuration template.
339
+ See CLAUDE.md.example in the package root for a complete configuration template.
340
+ Or copy from: ${path.join(path.dirname(__dirname), 'CLAUDE.md.example')}
275
341
 
276
342
  \x1b[1mNeed Help?\x1b[0m
277
343
  https://github.com/kaidhar/real-prototypes-skill
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "real-prototypes-skill",
3
- "version": "0.1.3",
3
+ "version": "1.0.2",
4
4
  "description": "Capture any web platform and generate pixel-perfect prototypes that match its design. A Claude Code skill for rapid feature prototyping.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -30,10 +30,14 @@
30
30
  ".claude/skills/real-prototypes-skill/",
31
31
  ".claude/skills/agent-browser-skill/",
32
32
  ".env.example",
33
+ "CLAUDE.md.example",
33
34
  "README.md",
34
35
  "LICENSE"
35
36
  ],
36
37
  "scripts": {
38
+ "release:patch": "npm version patch && npm publish && git push && git push --tags",
39
+ "release:minor": "npm version minor && npm publish && git push && git push --tags",
40
+ "release:major": "npm version major && npm publish && git push && git push --tags",
37
41
  "test:visual": "node scripts/visual-regression-test.js",
38
42
  "test:visual:ci": "node scripts/visual-regression-test.js --ci",
39
43
  "test:components": "node scripts/test-components.js --all",
@@ -47,6 +51,14 @@
47
51
  "playwright": "^1.58.0",
48
52
  "pngjs": "^7.0.0"
49
53
  },
54
+ "peerDependencies": {
55
+ "agent-browser": ">=0.1.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "agent-browser": {
59
+ "optional": true
60
+ }
61
+ },
50
62
  "dependencies": {
51
63
  "@babel/generator": "^7.29.0",
52
64
  "@babel/parser": "^7.29.0",