ui-mirror-skill 1.0.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.
- package/README.md +95 -0
- package/bin/cli.mjs +121 -0
- package/package.json +34 -0
- package/skill/SKILL.md +751 -0
- package/skill/references/analysis-dimensions.md +382 -0
- package/skill/references/component-catalog.md +758 -0
- package/skill/references/css-token-mapping.md +359 -0
- package/skill/references/output-template.md +249 -0
- package/skill/scripts/compare_tokens.py +741 -0
- package/skill/scripts/download_screenshot.py +125 -0
- package/skill/scripts/extract_design_tokens.py +617 -0
- package/skill/scripts/generate_migration.py +580 -0
- package/skill/scripts/generate_radar_chart.py +267 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# ui-mirror-skill
|
|
2
|
+
|
|
3
|
+
Claude Code skill for benchmarking website UI analysis and design token extraction.
|
|
4
|
+
|
|
5
|
+
Capture screenshots and extract design tokens (colors, typography, spacing, border-radius, shadows, components, layout) from any website, then compare against your project's UI across **7 analysis axes**. Generates CSS token overrides, component snippets, and a prioritized migration plan.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx ui-mirror-skill
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This installs the skill to `~/.agents/skills/ui-mirror/` (global).
|
|
14
|
+
|
|
15
|
+
### Options
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx ui-mirror-skill --local # Project-level: .claude/skills/ui-mirror/
|
|
19
|
+
npx ui-mirror-skill --both # Both global and project-level
|
|
20
|
+
npx ui-mirror-skill --uninstall # Remove installed files
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage in Claude Code
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/ui-mirror https://example.com
|
|
27
|
+
/mirror https://example.com
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or natural language:
|
|
31
|
+
- "이 사이트처럼 만들어줘"
|
|
32
|
+
- "Benchmark this site's design"
|
|
33
|
+
- "이 디자인 따라해줘"
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
1. **Capture** — Screenshots + computed CSS extraction from benchmark site
|
|
38
|
+
2. **Extract** — Normalize design tokens (colors → OKLCH, spacing → Tailwind scale)
|
|
39
|
+
3. **Compare** — 7-axis analysis (Color, Typography, Spacing, Radius, Shadows, Components, Motion)
|
|
40
|
+
4. **Generate** — CSS overrides, component TSX snippets, SVG radar chart, migration plan
|
|
41
|
+
|
|
42
|
+
### Output
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
docs/ui-mirror/{name}/
|
|
46
|
+
├── analysis.md # 7-axis comparison report
|
|
47
|
+
├── tokens-override.css # CSS custom property overrides
|
|
48
|
+
├── migration-plan.md # Prioritized migration plan
|
|
49
|
+
├── radar-chart.svg # Visual score chart
|
|
50
|
+
├── components/ # Mirror component TSX snippets
|
|
51
|
+
├── screenshots/ # Captured screenshots
|
|
52
|
+
└── raw/ # Raw JSON data
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
- **Python 3.10+** — for token extraction and comparison scripts
|
|
58
|
+
- **One screenshot tool** (in priority order):
|
|
59
|
+
1. `agent-browser` (recommended)
|
|
60
|
+
2. Chrome DevTools MCP
|
|
61
|
+
3. Jina MCP
|
|
62
|
+
|
|
63
|
+
## 7-Axis Analysis
|
|
64
|
+
|
|
65
|
+
| Axis | What it compares |
|
|
66
|
+
|------|-----------------|
|
|
67
|
+
| Color | Palette, OKLCH tokens, semantic roles, gradients |
|
|
68
|
+
| Typography | Font families, size scale, weights, line-height |
|
|
69
|
+
| Spacing | Padding, margin, gap patterns (4px grid alignment) |
|
|
70
|
+
| Radius | Border-radius scale, component differentiation |
|
|
71
|
+
| Shadows | Shadow layers, elevation hierarchy |
|
|
72
|
+
| Components | Button, Card, Input, Nav, Table, Dialog, Badge styling |
|
|
73
|
+
| Motion | Transitions, hover states, animations, focus indicators |
|
|
74
|
+
|
|
75
|
+
Each axis is scored 1-5 with a detailed rubric.
|
|
76
|
+
|
|
77
|
+
## Design System Awareness
|
|
78
|
+
|
|
79
|
+
The skill auto-detects your project's design system documentation (`FRONTEND_CONSISTENCY.md`, `DESIGN_SYSTEM.md`, etc.) and flags conflicts between benchmark styles and your existing rules. Every proposed change includes conflict resolution proposals.
|
|
80
|
+
|
|
81
|
+
## Python Scripts
|
|
82
|
+
|
|
83
|
+
All scripts use Python 3 standard library only (no pip dependencies):
|
|
84
|
+
|
|
85
|
+
| Script | Purpose |
|
|
86
|
+
|--------|---------|
|
|
87
|
+
| `extract_design_tokens.py` | Parse computed styles → normalized OKLCH tokens |
|
|
88
|
+
| `compare_tokens.py` | Structured diff with delta-E color distance |
|
|
89
|
+
| `generate_migration.py` | Token diff → prioritized migration plan |
|
|
90
|
+
| `generate_radar_chart.py` | SVG/Mermaid radar chart for 7-axis scores |
|
|
91
|
+
| `download_screenshot.py` | URL/base64 screenshot downloader |
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ui-mirror-skill installer
|
|
5
|
+
*
|
|
6
|
+
* Installs the ui-mirror skill for Claude Code.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx ui-mirror-skill # Install globally to ~/.agents/skills/
|
|
10
|
+
* npx ui-mirror-skill --local # Install to ./.claude/skills/ (project-level)
|
|
11
|
+
* npx ui-mirror-skill --both # Install both global and local
|
|
12
|
+
* npx ui-mirror-skill --uninstall # Remove installed skill files
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
|
|
16
|
+
import { dirname, join, resolve } from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { homedir } from "node:os";
|
|
19
|
+
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
const SKILL_SRC = join(__dirname, "..", "skill");
|
|
23
|
+
|
|
24
|
+
const GLOBAL_TARGET = join(homedir(), ".agents", "skills", "ui-mirror");
|
|
25
|
+
const LOCAL_TARGET = join(process.cwd(), ".claude", "skills", "ui-mirror");
|
|
26
|
+
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
const isLocal = args.includes("--local");
|
|
29
|
+
const isBoth = args.includes("--both");
|
|
30
|
+
const isUninstall = args.includes("--uninstall");
|
|
31
|
+
const isHelp = args.includes("--help") || args.includes("-h");
|
|
32
|
+
|
|
33
|
+
if (isHelp) {
|
|
34
|
+
console.log(`
|
|
35
|
+
ui-mirror-skill — Claude Code UI benchmarking skill installer
|
|
36
|
+
|
|
37
|
+
Usage:
|
|
38
|
+
npx ui-mirror-skill Install globally (~/.agents/skills/ui-mirror/)
|
|
39
|
+
npx ui-mirror-skill --local Install to project (.claude/skills/ui-mirror/)
|
|
40
|
+
npx ui-mirror-skill --both Install both global and project-level
|
|
41
|
+
npx ui-mirror-skill --uninstall Remove installed skill files
|
|
42
|
+
npx ui-mirror-skill --help Show this help
|
|
43
|
+
|
|
44
|
+
What it does:
|
|
45
|
+
Copies SKILL.md, reference docs, and Python scripts to the target directory.
|
|
46
|
+
Claude Code will auto-detect the skill from .claude/skills/ or ~/.agents/skills/.
|
|
47
|
+
|
|
48
|
+
Requirements:
|
|
49
|
+
- Python 3.10+ (for token extraction/comparison scripts)
|
|
50
|
+
- One of: agent-browser, Chrome DevTools MCP, or Jina MCP (for screenshots)
|
|
51
|
+
`);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function install(target, label) {
|
|
56
|
+
if (existsSync(target)) {
|
|
57
|
+
console.log(` Updating existing installation at ${target}`);
|
|
58
|
+
rmSync(target, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
mkdirSync(target, { recursive: true });
|
|
62
|
+
cpSync(SKILL_SRC, target, { recursive: true });
|
|
63
|
+
console.log(` ✓ Installed to ${target}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function uninstall(target, label) {
|
|
67
|
+
if (existsSync(target)) {
|
|
68
|
+
rmSync(target, { recursive: true });
|
|
69
|
+
console.log(` ✓ Removed ${label}: ${target}`);
|
|
70
|
+
} else {
|
|
71
|
+
console.log(` - ${label} not found: ${target}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log("");
|
|
76
|
+
console.log("┌─────────────────────────────────────┐");
|
|
77
|
+
console.log("│ ui-mirror-skill installer │");
|
|
78
|
+
console.log("└─────────────────────────────────────┘");
|
|
79
|
+
console.log("");
|
|
80
|
+
|
|
81
|
+
if (isUninstall) {
|
|
82
|
+
console.log("Uninstalling ui-mirror skill...");
|
|
83
|
+
uninstall(GLOBAL_TARGET, "Global");
|
|
84
|
+
uninstall(LOCAL_TARGET, "Local");
|
|
85
|
+
console.log("");
|
|
86
|
+
console.log("Done.");
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const targets = [];
|
|
91
|
+
if (isBoth) {
|
|
92
|
+
targets.push([GLOBAL_TARGET, "Global"]);
|
|
93
|
+
targets.push([LOCAL_TARGET, "Local"]);
|
|
94
|
+
} else if (isLocal) {
|
|
95
|
+
targets.push([LOCAL_TARGET, "Local"]);
|
|
96
|
+
} else {
|
|
97
|
+
targets.push([GLOBAL_TARGET, "Global"]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
console.log("Installing ui-mirror skill...");
|
|
101
|
+
console.log("");
|
|
102
|
+
|
|
103
|
+
for (const [target, label] of targets) {
|
|
104
|
+
install(target, label);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log("");
|
|
108
|
+
console.log("── Setup complete ──");
|
|
109
|
+
console.log("");
|
|
110
|
+
console.log("Trigger in Claude Code:");
|
|
111
|
+
console.log(" /ui-mirror <url> Analyze a website's design");
|
|
112
|
+
console.log(" /mirror <url> Short alias");
|
|
113
|
+
console.log(' "이 사이트처럼 만들어줘" Natural language trigger');
|
|
114
|
+
console.log("");
|
|
115
|
+
console.log("The skill will:");
|
|
116
|
+
console.log(" 1. Capture screenshots & extract design tokens");
|
|
117
|
+
console.log(" 2. Compare against your project's UI (7-axis analysis)");
|
|
118
|
+
console.log(" 3. Generate CSS overrides + component snippets + migration plan");
|
|
119
|
+
console.log("");
|
|
120
|
+
console.log("Output: docs/ui-mirror/{name}/");
|
|
121
|
+
console.log("");
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ui-mirror-skill",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Claude Code skill for benchmarking website UI analysis and design token extraction with 7-axis comparison",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"skill",
|
|
8
|
+
"ui-mirror",
|
|
9
|
+
"design-tokens",
|
|
10
|
+
"benchmark",
|
|
11
|
+
"ui-analysis",
|
|
12
|
+
"shadcn-ui",
|
|
13
|
+
"tailwind",
|
|
14
|
+
"oklch"
|
|
15
|
+
],
|
|
16
|
+
"author": "mulkib",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bin": {
|
|
19
|
+
"ui-mirror-skill": "bin/cli.mjs"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/",
|
|
23
|
+
"skill/",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/mulkib/ui-mirror-skill.git"
|
|
33
|
+
}
|
|
34
|
+
}
|