@sunil-dsb/design-md
ADesign MD Generator Cursor Rules
Install
agr install @sunil-dsb/design-md --target cursorWrites 1 file into .cursor/rules/, pinned to git-45b2c730.
- .cursorrules
Document
Design MD Generator Cursor Rules
You have access to a design system extraction tool. When the user asks you to match a website's visual style, build UI that looks like a specific site, or create a DESIGN.md:
Quick Start
# Extract design tokens from any website
pnpm engine:extract https://example.com
# Output appears in output/<domain>/tokens.json
Using an Existing DESIGN.md
If the user has a DESIGN.md file in the project root or provides one:
- Read the DESIGN.md file completely before writing any UI code
- Use ONLY the colors, fonts, sizes, and shadows specified in the DESIGN.md
- Do NOT invent colors or typography not present in the document
- Follow the "Agent Prompt Guide" (Section 13) for quick reference values
- Match interaction states (hover, focus, active) as documented in Section 4
Generating a New DESIGN.md
If no DESIGN.md exists and the user wants to match a site's style:
- Run
pnpm engine:extract <url>to extract design tokens - Read the generated
tokens.jsonfrom the output directory - Use the extraction data to write a DESIGN.md following the 17-section v2 format (see SKILL.md):
- 0. Brand Context
-
- Visual Theme & Atmosphere
-
- Color Palette & Roles
- 2.5. Dark Mode System (when detected)
-
- Typography Rules
-
- Component Stylings
-
- Layout Principles
-
- Depth & Elevation
- 6.5. Motion System
-
- Content & Voice
-
- Do's and Don'ts
-
- Accessibility Contract
-
- Responsive Behavior
-
- State Matrix
-
- Iconography
-
- Agent Prompt Guide
Critical Rules
- ALL numerical values (hex colors, font sizes, weights, shadows) MUST come from the extraction data or DESIGN.md never hallucinate
- Use 6-digit lowercase hex format (#ffffff, not #FFF or #FFFFFF)
- Use numeric font weights (400, 700) not words (regular, bold)
- When the DESIGN.md specifies a custom font, check if it's available; fall back to the documented fallback stack if not
Verification
After generating UI, verify against the DESIGN.md:
- Every hex color used should appear in Section 2
- Every font-size/weight combination should appear in Section 3
- Shadow values should match Section 6
- Spacing should follow Section 5's scale
Post-Extraction Tools
# Visual preview of extracted tokens
pnpm engine:preview output/<domain>/tokens.json output/<domain>/
# Quality report with validation
pnpm engine:report output/<domain>/tokens.json output/<domain>/ DESIGN.md
# Validate DESIGN.md against extraction data
pnpm engine:validate DESIGN.md output/<domain>/tokens.json
Local environment notes
This codebase runs Next.js 16. APIs and conventions may differ from training data read node_modules/next/dist/docs/ before editing app/ or components/. Engine lives at lib/engine/ (not scripts/). See MIRROR.md.
Trustgrade A
- passBody integrity
Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.
- passType matchnot applicable to this artifact type
Whether the artifact is really the kind of thing its metadata claims it is.
- passFreshness
How long since the source repository was last pushed to.
- passPrompt injection
Scans the artifact's own text for instructions aimed at your agent rather than at you.
- passLicense
Whether the source repository declares an SPDX license permissive enough to redistribute.
How the grade is calculated
Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:
- Aevery check passed
- Bone warning
- Ctwo warnings
- Dprompt injection or body integrity failed, or three warnings
- Fone of those failed, and something else is wrong
These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.
Versions
git-45b2c730aecd2026-08-06