From harness-claude
Discovers existing design patterns, curates palettes and typography intent, generates W3C DTCG tokens, and validates WCAG color compliance for design systems. Triggers on project init or new features.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Token-first design management. Discover existing design patterns, define intent through curated palettes and typography, generate W3C DTCG tokens, and validate every color pair for WCAG compliance.
Manages design tokens for colors, typography, spacing, borders, shadows in CSS variables, JSON, Tailwind configs. Generates palettes, checks WCAG contrast, converts formats.
Bootstraps design systems by generating design tokens, Tailwind configs, CSS variables, typography scales, spacing systems, and component inventories from project context.
Builds scalable design systems using token hierarchies, semantic tokens, component APIs, theme switching, and documentation. For component libraries and UI foundations.
Share bugs, ideas, or general feedback.
Token-first design management. Discover existing design patterns, define intent through curated palettes and typography, generate W3C DTCG tokens, and validate every color pair for WCAG compliance.
on_project_init triggers fire and the project has no design-system/tokens.jsonon_new_feature triggers fire with design scope (new theme, new component library, rebrand)Read existing design files. Search for:
design-system/tokens.json -- existing W3C DTCG tokensdesign-system/DESIGN.md -- existing design intent documentationtailwind.config.* -- Tailwind CSS configuration with theme overrides--color-*, --font-*, --space-*)theme.ts, theme.js, styles/variables.* -- CSS-in-JS or preprocessor variablesCheck harness configuration. Read harness.config.json and apply the design.enabled short-circuit before doing anything else in Phase 1:
design.enabled is false: the project explicitly declined a design system during init. Log "design.enabled is false in harness.config.json — project explicitly declined the design system. Skipping." and stop. Do not run the rest of Phase 1 or any subsequent phase.design.enabled is true: proceed normally with the rest of Phase 1.design.enabled is absent (the field does not appear under design): the project has not decided yet. Surface a gentle prompt: "This project has not configured a design system. Would you like to enable one now? (yes / no / not sure)". On yes, proceed with Phase 1 — note that this answer is not persisted to harness.config.json (the init skill is the canonical writer of that field), so this prompt will fire again on the next on_new_feature invocation; run harness init --migrate to make the choice permanent. On no or not sure, stop without writing anything to harness.config.json.After the gate, read the remaining design configuration fields:
design.strictness -- enforcement level (strict, standard, permissive)design.platforms -- which platforms are enabled (web, mobile)design.tokenPath -- path to tokens file (default: design-system/tokens.json)design.aestheticIntent -- path to design intent doc (default: design-system/DESIGN.md)Detect framework. Identify the CSS strategy in use:
tailwind.config.*).module.css or .module.scss files)Identify existing patterns. Use Grep to find:
#[0-9a-fA-F]{3,8}), rgb/hsl functionsfont-family properties, @font-face rulesLoad industry recommendations. If an industry is specified (via CLI arg or config), read the industry profile from agents/skills/shared/design-knowledge/industries/{industry}.yaml. This provides sector-specific guidance on color psychology, typography conventions, and regulatory considerations.
Report findings before proceeding. Present a summary:
Present palette options. Load curated palettes from agents/skills/shared/design-knowledge/palettes/curated.yaml. Filter by industry tags if an industry is specified. Present 3-5 palette options with:
Present typography pairings. Load pairings from agents/skills/shared/design-knowledge/typography/pairings.yaml. Present 3-5 options with:
Define spacing scale. Default: 4px base with multipliers [0.25, 0.5, 1, 1.5, 2, 3, 4, 6, 8, 12, 16]. Allow customization of:
Capture design intent. Ask the user to define:
Confirm all choices. Present a complete summary of palette, typography, spacing, and intent. Wait for user confirmation before generating. This is a hard gate -- no generation without confirmation.
Generate design-system/tokens.json in W3C Design Token Community Group (DTCG) format. Structure:
{
"color": {
"primary": {
"50": { "$value": "#eff6ff", "$type": "color", "$description": "Lightest primary" },
"500": { "$value": "#3b82f6", "$type": "color", "$description": "Base primary" },
"900": { "$value": "#1e3a5f", "$type": "color", "$description": "Darkest primary" }
},
"semantic": {
"success": {
"$value": "{color.green.500}",
"$type": "color",
"$description": "Success state"
},
"error": { "$value": "{color.red.500}", "$type": "color", "$description": "Error state" }
}
},
"typography": {
"heading": {
"fontFamily": { "$value": "Inter, system-ui, sans-serif", "$type": "fontFamily" },
"fontWeight": { "$value": 600, "$type": "fontWeight" }
},
"body": {
"fontFamily": { "$value": "Source Sans 3, system-ui, sans-serif", "$type": "fontFamily" },
"fontSize": { "$value": "1rem", "$type": "dimension" }
}
},
"spacing": {
"xs": { "$value": "4px", "$type": "dimension", "$description": "Extra small spacing" },
"sm": { "$value": "8px", "$type": "dimension", "$description": "Small spacing" },
"md": { "$value": "16px", "$type": "dimension", "$description": "Medium spacing" },
"lg": { "$value": "24px", "$type": "dimension", "$description": "Large spacing" },
"xl": { "$value": "32px", "$type": "dimension", "$description": "Extra large spacing" }
}
}
Generate design-system/DESIGN.md with:
design.strictness)Populate the knowledge graph. If a graph exists at .harness/graph/, run DesignIngestor from packages/graph/src/ingest/DesignIngestor.ts to create graph nodes for:
design_token, subtype: color)design_token, subtype: typography)design_token, subtype: spacing)aesthetic_intent) with style, tone, differentiator, and strictness propertiesdeclares_intent edges from the project to the aesthetic intent nodeParse tokens.json against W3C DTCG structure. Verify:
$value and $type fields{color.primary.500}) resolve to existing tokensCheck color contrast compliance. For every declared contrast pair:
Verify typography completeness. Check that:
system-ui or sans-serif/serif/monospace)Verify spacing scale. Check that:
Run project health check. Execute harness validate to ensure the new files do not break any existing constraints.
Report validation results. Present a summary:
harness validate -- Run after generating tokens to verify project health. Token generation must not break existing constraints.harness scan -- Run after token changes to refresh the knowledge graph. Updated graph enables impact analysis when tokens are modified later.DesignIngestor (packages/graph/src/ingest/DesignIngestor.ts) -- Parses tokens.json and DESIGN.md to create graph nodes representing the design system. Called during the GENERATE phase.DesignConstraintAdapter (packages/graph/src/constraints/DesignConstraintAdapter.ts) -- Enforces design constraints by checking for VIOLATES edges in the graph. Used during validation to detect constraint violations.harness-impact-analysis -- When tokens change, impact analysis traces which components consume affected tokens, enabling targeted re-validation.design-system/tokens.json exists and is valid W3C DTCG format (every token has $value and $type)design-system/DESIGN.md exists with aesthetic direction, usage guidelines, anti-patterns, and platform notes.harness/graph/)harness validate passes after token generationContext: New SaaS analytics dashboard. Industry: saas. No existing design system.
DISCOVER output:
Design System Discovery Report
-------------------------------
Existing token file: No
Framework detected: Tailwind CSS (tailwind.config.ts)
Unique colors found: 23 (high debt -- colors scattered across components)
Unique fonts found: 4 (medium debt -- inconsistent font usage)
Industry profile: Loaded (saas) -- recommends professional blues, clean sans-serif
Design debt assessment: High -- no centralized design system, ad-hoc color usage
DEFINE choices:
Selected palette: "Ocean Professional" (blue primary, slate neutral, emerald accent)
Selected typography: Inter (headings, 600 weight) + Source Sans 3 (body, 400 weight)
Spacing base: 4px with standard multipliers
Style: Minimal, data-focused
Tone: Cool, professional
Differentiator: Dense information display with generous whitespace between sections
Anti-patterns: No gradients on data elements, no decorative borders on cards
GENERATE output (tokens.json snippet):
{
"color": {
"primary": {
"50": { "$value": "#eff6ff", "$type": "color", "$description": "Background tint" },
"100": { "$value": "#dbeafe", "$type": "color", "$description": "Hover state" },
"500": { "$value": "#3b82f6", "$type": "color", "$description": "Primary action" },
"700": { "$value": "#1d4ed8", "$type": "color", "$description": "Primary text on light" },
"900": { "$value": "#1e3a5f", "$type": "color", "$description": "Darkest primary" }
},
"neutral": {
"50": { "$value": "#f8fafc", "$type": "color", "$description": "Page background" },
"900": { "$value": "#0f172a", "$type": "color", "$description": "Primary text" }
}
},
"typography": {
"heading": {
"fontFamily": { "$value": "Inter, system-ui, sans-serif", "$type": "fontFamily" }
},
"body": {
"fontFamily": { "$value": "Source Sans 3, system-ui, sans-serif", "$type": "fontFamily" }
}
}
}
VALIDATE output:
Validation Results
------------------
DTCG structure: PASS (42 tokens, all have $value and $type)
Contrast pairs: PASS (12/12 pairs meet WCAG AA)
- primary-700 on neutral-50: 8.1:1 PASS (normal text)
- neutral-900 on neutral-50: 15.4:1 PASS (normal text)
- neutral-50 on primary-500: 4.7:1 PASS (normal text)
Typography: PASS (all fonts have fallback stacks)
Spacing: PASS (monotonically increasing, no gaps)
Harness validate: PASS
| Rationalization | Reality |
|---|---|
| "The project already has a tailwind.config with colors — I can derive the token set from that and skip the DEFINE phase." | Existing Tailwind config represents design debt, not design intent. The DEFINE phase exists to make deliberate choices about palette and typography. Deriving tokens from scattered config perpetuates the inconsistency the skill is meant to resolve. |
| "One of the contrast pairs is 4.3:1 — close enough to 4.5:1 to pass. I'll mark it as passing." | 4.3:1 fails WCAG AA for normal text. There is no "close enough." Flag the failure and ask the user to choose an alternative. Silently accepting sub-threshold contrast is a compliance defect. |
| "The user confirmed the palette in our conversation, so I can skip the formal confirmation gate and generate immediately." | The confirmation gate exists as a structural checkpoint, not a courtesy. Generate only after presenting the full palette + typography + spacing summary and receiving explicit approval. Conversation context can drift. |
| "There are no existing design files, so I can skip the DISCOVER phase and go straight to defining." | The DISCOVER phase also detects the CSS framework and existing color/font usage. Skipping it means the generated tokens may not map to the actual CSS strategy and the design debt assessment is lost. |
| "Fonts without fallback stacks are probably fine — modern browsers handle missing fonts gracefully." | A missing fallback stack is a token validation failure regardless of browser behavior. Every fontFamily token must include at least one generic fallback. This is a VALIDATE phase gate, not a style preference. |
These are hard stops. Violating any gate means the process has broken down.
tokens.json written without passing DTCG schema validation. Every token must have $value and $type. Malformed tokens are rejected before writing to disk.fontFamily token must include at least one generic fallback (sans-serif, serif, monospace, or system-ui).md is larger than lg.design.strictness is set to permissive but contrast fails: Still report the failure as a warning. Permissive mode does not suppress contrast checks -- it only changes the severity from error to warning.harness scan later to populate." Continue with file generation.