Harness Design Web
Token-bound web component generation. Scaffold from design tokens and aesthetic intent, implement with Tailwind/CSS and React/Vue/Svelte patterns, and verify every value references the token set — no hardcoded colors, fonts, or spacing.
When to Use
- Generating new web components that must conform to the project's design system tokens
- When
on_new_feature triggers fire with web UI scope requiring token-bound component generation
- When
on_commit triggers fire and new components contain hardcoded design values that should reference tokens
- Implementing design intent from
design-system/DESIGN.md into concrete Tailwind classes, CSS custom properties, or CSS-in-JS theme values
- Converting mockups or wireframes into token-bound component code for React, Vue, or Svelte
- NOT for generating design tokens themselves (use harness-design-system)
- NOT for establishing aesthetic direction or anti-patterns (use harness-design)
- NOT for accessibility auditing (use harness-accessibility)
- NOT for mobile platform components (use harness-design-mobile)
Process
Phase 1: SCAFFOLD — Read Tokens, Detect Framework, Plan Structure
Read design tokens. Load design-system/tokens.json (W3C DTCG format). Extract:
- Color tokens: primary, secondary, accent, neutral ramps, semantic colors (success, warning, error, info)
- Typography tokens: heading and body font families, font weights, font sizes, line heights
- Spacing tokens: spacing scale values (xs through 2xl or equivalent)
- If
design-system/tokens.json does not exist, stop and instruct the user to run harness-design-system first.
Read design intent. Load design-system/DESIGN.md for:
- Aesthetic direction (style, tone, differentiator) from harness-design output
- Anti-patterns to avoid (e.g., "no gradients on data elements," "no decorative borders")
- Platform-specific web notes (CSS strategy preferences, animation guidelines, responsive behavior)
- If
design-system/DESIGN.md does not exist, warn the user and proceed with tokens only. Recommend running harness-design for richer output.
Check harness configuration. Read harness.config.json for:
design.strictness — enforcement level (strict, standard, permissive). Default to standard.
design.platforms — confirm web is in the platforms list.
design.tokenPath — custom token path (default: design-system/tokens.json).
Detect web framework. Scan the project for:
- React:
package.json contains react or next dependency, .tsx/.jsx files exist
- Vue:
package.json contains vue or nuxt dependency, .vue files exist
- Svelte:
package.json contains svelte or @sveltejs/kit, .svelte files exist
- Vanilla: No framework detected, output plain HTML/CSS
- If the user specified
--framework, use that override.
Detect CSS strategy. Scan for:
- Tailwind:
tailwind.config.* exists, @tailwind directives in CSS, class= with Tailwind utility patterns
- CSS Modules:
.module.css or .module.scss files exist
- CSS-in-JS:
styled-components, @emotion/styled, stitches imports detected
- Vanilla CSS: Global
.css/.scss files with no module or utility pattern
- If the user specified
--cssStrategy, use that override.
Load platform-specific web rules. Read agents/skills/shared/design-knowledge/platform-rules/web.yaml for web-specific design rules including responsive breakpoints, browser compatibility considerations, and CSS best practices.
Load anti-pattern definitions. Read anti-pattern files from agents/skills/shared/design-knowledge/anti-patterns/:
typography.yaml — typographic anti-patterns (too many fonts, inconsistent scales)
color.yaml — color anti-patterns (hardcoded hex, insufficient contrast)
layout.yaml — layout anti-patterns (magic numbers, inconsistent spacing)
motion.yaml — motion anti-patterns (excessive animation, missing reduced-motion)
Build token-to-CSS mapping. Create a lookup table that maps each token to its CSS representation based on the detected strategy:
- Tailwind:
color.primary.500 maps to text-primary-500 / bg-primary-500 (requires tailwind.config theme extension)
- CSS custom properties:
color.primary.500 maps to var(--color-primary-500)
- CSS-in-JS:
color.primary.500 maps to theme.color.primary[500]
Plan component structure. For the requested component(s), define:
- Component file path(s) following project conventions
- Props interface / type definition
- Which tokens will be consumed (colors, typography, spacing)
- Responsive behavior (breakpoints, layout changes)
- Present the scaffold plan to the user before proceeding.
Phase 2: IMPLEMENT — Generate Token-Bound Components
Generate framework-specific component code. Based on detected framework:
React (TSX):
- Functional component with TypeScript props interface
- All color values reference tokens (via Tailwind classes, CSS variables, or theme object)
- All typography values reference tokens (font family, weight, size from token set)
- All spacing values reference tokens (padding, margin, gap from spacing scale)
- Export component with display name
Vue (SFC):
- Single File Component with
<script setup lang="ts">
- Props defined with
defineProps and TypeScript interface
- Scoped styles reference CSS custom properties mapped from tokens
- Template uses token-derived classes or inline styles via CSS variables
Svelte:
- Component with TypeScript
<script lang="ts">
- Props exported with
export let declarations
- Styles reference CSS custom properties mapped from tokens
- Reactive declarations for computed style values
Vanilla HTML/CSS:
- Semantic HTML structure
- CSS custom properties for all design values
- No inline styles with hardcoded values
Generate CSS strategy artifacts. Based on detected CSS strategy:
Tailwind:
- Extend
tailwind.config theme with token values (if not already present)
- Map tokens to Tailwind utility classes in components
- Use
@apply sparingly — prefer utility classes in markup
- Generate token-to-Tailwind mapping comment block at top of component
CSS Custom Properties:
- Generate
:root declarations for all consumed tokens
- Components reference
var(--token-name) exclusively
- No hardcoded hex, rgb, hsl, or font values in component styles
CSS-in-JS:
- Generate theme object from tokens
- Components consume theme via provider/hook pattern
- All style values reference theme properties
Apply design intent constraints. For each generated component:
- Check against anti-patterns from
design-system/DESIGN.md and agents/skills/shared/design-knowledge/anti-patterns/
- Enforce style guidelines (e.g., minimal style means no decorative effects)
- Apply tone-appropriate color usage (e.g., cool tone means no warm accents in neutral UI)
- Respect platform-specific web notes (animation preferences, responsive behavior)
Add USES_TOKEN annotations. Insert comments in generated code documenting which tokens are consumed:
/* @design-token color.primary.500 — primary action background */
/* @design-token typography.heading.fontFamily — section heading */
/* @design-token spacing.md — card internal padding */
These annotations enable the knowledge graph to create USES_TOKEN edges from this component to the consumed DesignToken nodes.
Phase 3: VERIFY — Check Token Binding and Design Constraints
Scan for hardcoded values. Use Grep to search generated files for:
- Hardcoded color values: hex (
#[0-9a-fA-F]{3,8}), rgb(), hsl(), named colors
- Hardcoded font families:
font-family: declarations not referencing tokens
- Hardcoded spacing: pixel/rem values in margin/padding/gap not from the token scale
- Each finding is a violation: the component uses a value not bound to a token.
Verify token coverage. For every design value in the generated component:
- Confirm it resolves to a token in
design-system/tokens.json
- Confirm the token path is valid (e.g.,
color.primary.500 exists in the token tree)
- Report orphan references (token annotations pointing to non-existent tokens)
Check anti-pattern compliance. Cross-reference generated code against anti-patterns declared in design-system/DESIGN.md and the anti-pattern definitions in agents/skills/shared/design-knowledge/anti-patterns/:
- Grep for patterns matching each declared anti-pattern
- Flag violations with file path, line number, and the specific anti-pattern violated
Query the knowledge graph. If a graph exists at .harness/graph/:
- Use
DesignIngestor to verify DesignToken nodes exist for all referenced tokens
- Verify
PLATFORM_BINDING edges exist for web platform tokens
- Use
DesignConstraintAdapter to check for VIOLATES_DESIGN edges
- Report any constraint violations with severity based on
design.strictness
Assign severity based on designStrictness:
permissive — all findings are info
standard — hardcoded values and anti-pattern violations are warn, accessibility violations are error
strict — hardcoded values are error (blocks), anti-pattern violations are warn, accessibility violations are error
Report verification results. Present:
WEB-001 [warn] Hardcoded color #3b82f6 — should reference token "color.primary.500"
File: src/components/Button.tsx:12
Fix: Replace with Tailwind class "bg-primary-500" or var(--color-primary-500)
WEB-002 [info] Anti-pattern: gradient on card background
File: src/components/MetricCard.tsx:28
Fix: Use solid background from token "color.neutral.50"
Run harness validate. After verification, run project-level validation to confirm the new components integrate cleanly.
Harness Integration
harness validate — Run after generating components to verify project health. New files must not break existing constraints.
harness scan — Run after component generation to update the knowledge graph with new USES_TOKEN edges from generated components to consumed tokens.
DesignIngestor (packages/graph/src/ingest/DesignIngestor.ts) — Verifies that DesignToken nodes exist for all tokens referenced by generated components. If tokens are missing from the graph, run harness scan to re-ingest.
DesignConstraintAdapter (packages/graph/src/constraints/DesignConstraintAdapter.ts) — Checks for VIOLATES_DESIGN edges during the VERIFY phase. Reports constraint violations at the configured strictness level.
harness-design-system — Dependency. This skill reads tokens generated by harness-design-system. If tokens do not exist, instruct the user to run harness-design-system first.
harness-design — Dependency. This skill reads aesthetic intent from harness-design output (design-system/DESIGN.md). Anti-pattern enforcement and style constraints come from the design intent document.
harness-impact-analysis — When tokens change, impact analysis traces which components consume affected tokens via USES_TOKEN edges. Use this to identify components that need regeneration after token updates.
Graph naming convention: This skill uses PascalCase for node types (DesignToken, DesignConstraint) and UPPER_SNAKE for edge types (USES_TOKEN, PLATFORM_BINDING, VIOLATES_DESIGN) as conceptual labels. The graph schema registers these as snake_case identifiers (design_token, design_constraint, uses_token, platform_binding, violates_design). The adapter classes (DesignIngestor, DesignConstraintAdapter) handle the mapping — always use the adapters rather than constructing graph queries with raw type names.
Success Criteria
- Generated components reference design tokens exclusively — no hardcoded color, font, or spacing values
- Framework detection correctly identifies React, Vue, Svelte, or vanilla projects
- CSS strategy detection correctly identifies Tailwind, CSS Modules, CSS-in-JS, or vanilla CSS
- Token-to-CSS mapping produces correct output for each CSS strategy (Tailwind classes, CSS custom properties, theme object references)
@design-token annotations are present for every consumed token
- Anti-pattern compliance check catches violations declared in
design-system/DESIGN.md
- Verification report uses severity levels matching
design.strictness configuration
harness validate passes after component generation
Examples
Example: React + Tailwind Button Component
Context: SaaS dashboard project. React with Tailwind CSS. Tokens generated by harness-design-system. Design intent established by harness-design (minimal style, cool professional tone).
SCAFFOLD output:
Framework detected: React (Next.js)
CSS strategy: Tailwind CSS (tailwind.config.ts)
Tokens loaded: 42 tokens from design-system/tokens.json
Design intent: Minimal, cool professional (from DESIGN.md)
Component plan: Button with primary/secondary/ghost variants
Token consumption: color.primary.*, color.neutral.*, typography.body, spacing.sm/md
IMPLEMENT output (Button.tsx):
/* @design-token color.primary.500 — primary variant background */
/* @design-token color.primary.700 — primary variant hover */
/* @design-token color.neutral.50 — ghost variant background */
/* @design-token color.neutral.900 — ghost variant text */
/* @design-token typography.body.fontFamily — button label */
/* @design-token typography.body.fontWeight — button label weight */
/* @design-token spacing.sm — button horizontal padding */
/* @design-token spacing.xs — button vertical padding */
import type { ButtonHTMLAttributes } from 'react';
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
}
export function Button({
variant = 'primary',
size = 'md',
className = '',
children,
...props
}: ButtonProps) {
const baseClasses =
'inline-flex items-center justify-center font-body font-medium rounded-md transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500';
const variantClasses = {
primary: 'bg-primary-500 text-white hover:bg-primary-700',
secondary: 'border border-primary-500 text-primary-700 hover:bg-primary-50',
ghost: 'text-neutral-900 hover:bg-neutral-100',
};
const sizeClasses = {
sm: 'px-spacing-sm py-spacing-xs text-sm',
md: 'px-spacing-md py-spacing-sm text-base',
lg: 'px-spacing-lg py-spacing-md text-lg',
};
return (
<button
className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}
{...props}
>
{children}
</button>
);
}
VERIFY output:
Verification Results
--------------------
Hardcoded values: PASS (0 hardcoded colors, fonts, or spacing)
Token coverage: PASS (8/8 referenced tokens exist in tokens.json)
Anti-pattern check: PASS (no gradients, no decorative borders)
Design constraints: PASS (no VIOLATES_DESIGN edges)
Harness validate: PASS
Example: Vue + CSS Custom Properties Card Component
Context: E-commerce project. Vue 3 with CSS custom properties. Tokens from harness-design-system.
IMPLEMENT output (ProductCard.vue):
<!-- @design-token color.neutral.50 — card background -->
<!-- @design-token color.neutral.200 — card border -->
<!-- @design-token color.neutral.900 — card text -->
<!-- @design-token typography.heading.fontFamily — product title -->
<!-- @design-token typography.body.fontFamily — product description -->
<!-- @design-token spacing.md — card padding -->
<!-- @design-token spacing.sm — content gap -->
<script setup lang="ts">
interface Props {
title: string;
description: string;
price: string;
imageUrl: string;
imageAlt: string;
}
defineProps<Props>();
</script>
<template>
<article class="product-card">
<img :src="imageUrl" :alt="imageAlt" class="product-card__image" />
<div class="product-card__content">
<h3 class="product-card__title">{{ title }}</h3>
<p class="product-card__description">{{ description }}</p>
<span class="product-card__price">{{ price }}</span>
</div>
</article>
</template>
<style scoped>
.product-card {
background: var(--color-neutral-50);
border: 1px solid var(--color-neutral-200);
border-radius: var(--radius-md);
overflow: hidden;
}
.product-card__content {
padding: var(--spacing-md);
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.product-card__title {
font-family: var(--typography-heading-fontFamily);
font-weight: var(--typography-heading-fontWeight);
color: var(--color-neutral-900);
}
.product-card__description {
font-family: var(--typography-body-fontFamily);
color: var(--color-neutral-700);
}
</style>
Rationalizations to Reject
| Rationalization |
Reality |
| "The tokens file doesn't exist yet, but I know the brand colors — I'll hardcode them as a placeholder and note they should be replaced later." |
Hardcoded values in generated output are the exact problem this skill exists to prevent. There is no placeholder exception. If design-system/tokens.json does not exist, instruct the user to run harness-design-system first and stop. |
| "The framework is obviously React — everything in this project is React. I don't need to run detection." |
Detection also identifies the CSS strategy (Tailwind vs CSS Modules vs CSS-in-JS), which determines how tokens map to code. Skipping detection produces components that may reference non-existent Tailwind classes or wrong theme paths. |
| "The user hasn't confirmed the scaffold plan, but the component structure is straightforward — I'll just generate it." |
The scaffold plan confirmation is a gate. The user must see which tokens will be consumed and what the component structure will be before code is written. Generating first and explaining later inverts the review opportunity. |
| "This component only uses one hardcoded hex value for a shadow — that's not really a design value, so I'll leave it." |
Every color, font, and spacing value must reference a token. Shadows use color tokens. "Not really a design value" is not a category the verification phase recognizes. The VERIFY phase will flag it; the IMPLEMENT phase should not introduce it. |
"The @design-token annotations are just comments — skipping them on a few components won't affect anything." |
These annotations are how harness scan creates USES_TOKEN edges in the knowledge graph. Missing annotations mean harness-impact-analysis cannot trace token changes to affected components. They are structural metadata, not decorative comments. |
Gates
These are hard stops. Violating any gate means the process has broken down.
- No component generation without reading tokens from harness-design-system. The SCAFFOLD phase requires
design-system/tokens.json to exist. If tokens have not been generated, instruct the user to run harness-design-system first. Do not generate components with hardcoded values as a fallback.
- No hardcoded design values in generated output. Every color, font, and spacing value must reference a token. If a needed token does not exist, instruct the user to add it via harness-design-system rather than hardcoding the value.
- No framework-specific code without framework detection. The SCAFFOLD phase must detect or receive the target framework before generating components. Do not guess or default to React.
- No generation without scaffold plan confirmation. The SCAFFOLD phase must present a component plan to the user. Do not generate code without the user confirming the structure and token consumption plan.
- No graph mutations without validating node types. When creating
USES_TOKEN or PLATFORM_BINDING edges, verify the node and edge types are registered in the graph schema before writing.
Escalation
- When
design-system/tokens.json does not exist: Instruct the user: "Design tokens have not been generated. Run harness-design-system first to create design-system/tokens.json, then re-run harness-design-web for token-bound component generation."
- When the project uses an undetected framework: Ask the user to specify via the
--framework CLI argument. Log: "Could not auto-detect web framework. Please specify: harness skill run harness-design-web --framework react|vue|svelte|vanilla."
- When tokens are insufficient for the requested component: Report which tokens are missing: "Component requires a
color.accent.500 token but it does not exist in tokens.json. Run harness-design-system to add the missing token, or choose an existing alternative." Do not hardcode a fallback.
- When anti-patterns conflict with the requested design: Present the conflict: "The requested gradient background violates the 'no gradients on data elements' anti-pattern from DESIGN.md. Options: (1) Remove the gradient and use a solid token color, (2) Update the anti-pattern list via
harness-design if the intent has changed."
- When the knowledge graph is unavailable: Skip graph operations in SCAFFOLD and VERIFY phases. Log: "Graph not available at
.harness/graph/ — skipping token node verification and USES_TOKEN edge creation. Run harness scan later to populate." Continue with file-based operations.
1---2name: harness-design-web3description: Harness Design Web4metadata:5 source: https://skillmd.com/skills/intense-visions/harness-design-web6---7# Harness Design Web89> Token-bound web component generation. Scaffold from design tokens and aesthetic intent, implement with Tailwind/CSS and React/Vue/Svelte patterns, and verify every value references the token set — no hardcoded colors, fonts, or spacing.1011## When to Use1213- Generating new web components that must conform to the project's design system tokens14- When `on_new_feature` triggers fire with web UI scope requiring token-bound component generation15- When `on_commit` triggers fire and new components contain hardcoded design values that should reference tokens16- Implementing design intent from `design-system/DESIGN.md` into concrete Tailwind classes, CSS custom properties, or CSS-in-JS theme values17- Converting mockups or wireframes into token-bound component code for React, Vue, or Svelte18- NOT for generating design tokens themselves (use harness-design-system)19- NOT for establishing aesthetic direction or anti-patterns (use harness-design)20- NOT for accessibility auditing (use harness-accessibility)21- NOT for mobile platform components (use harness-design-mobile)2223## Process2425### Phase 1: SCAFFOLD — Read Tokens, Detect Framework, Plan Structure26271. **Read design tokens.** Load `design-system/tokens.json` (W3C DTCG format). Extract:28 - Color tokens: primary, secondary, accent, neutral ramps, semantic colors (success, warning, error, info)29 - Typography tokens: heading and body font families, font weights, font sizes, line heights30 - Spacing tokens: spacing scale values (xs through 2xl or equivalent)31 - If `design-system/tokens.json` does not exist, stop and instruct the user to run `harness-design-system` first.32332. **Read design intent.** Load `design-system/DESIGN.md` for:34 - Aesthetic direction (style, tone, differentiator) from harness-design output35 - Anti-patterns to avoid (e.g., "no gradients on data elements," "no decorative borders")36 - Platform-specific web notes (CSS strategy preferences, animation guidelines, responsive behavior)37 - If `design-system/DESIGN.md` does not exist, warn the user and proceed with tokens only. Recommend running `harness-design` for richer output.38393. **Check harness configuration.** Read `harness.config.json` for:40 - `design.strictness` — enforcement level (`strict`, `standard`, `permissive`). Default to `standard`.41 - `design.platforms` — confirm `web` is in the platforms list.42 - `design.tokenPath` — custom token path (default: `design-system/tokens.json`).43444. **Detect web framework.** Scan the project for:45 - **React:** `package.json` contains `react` or `next` dependency, `.tsx`/`.jsx` files exist46 - **Vue:** `package.json` contains `vue` or `nuxt` dependency, `.vue` files exist47 - **Svelte:** `package.json` contains `svelte` or `@sveltejs/kit`, `.svelte` files exist48 - **Vanilla:** No framework detected, output plain HTML/CSS49 - If the user specified `--framework`, use that override.50515. **Detect CSS strategy.** Scan for:52 - **Tailwind:** `tailwind.config.*` exists, `@tailwind` directives in CSS, `class=` with Tailwind utility patterns53 - **CSS Modules:** `.module.css` or `.module.scss` files exist54 - **CSS-in-JS:** `styled-components`, `@emotion/styled`, `stitches` imports detected55 - **Vanilla CSS:** Global `.css`/`.scss` files with no module or utility pattern56 - If the user specified `--cssStrategy`, use that override.57586. **Load platform-specific web rules.** Read `agents/skills/shared/design-knowledge/platform-rules/web.yaml` for web-specific design rules including responsive breakpoints, browser compatibility considerations, and CSS best practices.59607. **Load anti-pattern definitions.** Read anti-pattern files from `agents/skills/shared/design-knowledge/anti-patterns/`:61 - `typography.yaml` — typographic anti-patterns (too many fonts, inconsistent scales)62 - `color.yaml` — color anti-patterns (hardcoded hex, insufficient contrast)63 - `layout.yaml` — layout anti-patterns (magic numbers, inconsistent spacing)64 - `motion.yaml` — motion anti-patterns (excessive animation, missing reduced-motion)65668. **Build token-to-CSS mapping.** Create a lookup table that maps each token to its CSS representation based on the detected strategy:67 - **Tailwind:** `color.primary.500` maps to `text-primary-500` / `bg-primary-500` (requires `tailwind.config` theme extension)68 - **CSS custom properties:** `color.primary.500` maps to `var(--color-primary-500)`69 - **CSS-in-JS:** `color.primary.500` maps to `theme.color.primary[500]`70719. **Plan component structure.** For the requested component(s), define:72 - Component file path(s) following project conventions73 - Props interface / type definition74 - Which tokens will be consumed (colors, typography, spacing)75 - Responsive behavior (breakpoints, layout changes)76 - Present the scaffold plan to the user before proceeding.7778### Phase 2: IMPLEMENT — Generate Token-Bound Components79801. **Generate framework-specific component code.** Based on detected framework:8182 **React (TSX):**83 - Functional component with TypeScript props interface84 - All color values reference tokens (via Tailwind classes, CSS variables, or theme object)85 - All typography values reference tokens (font family, weight, size from token set)86 - All spacing values reference tokens (padding, margin, gap from spacing scale)87 - Export component with display name8889 **Vue (SFC):**90 - Single File Component with `<script setup lang="ts">`91 - Props defined with `defineProps` and TypeScript interface92 - Scoped styles reference CSS custom properties mapped from tokens93 - Template uses token-derived classes or inline styles via CSS variables9495 **Svelte:**96 - Component with TypeScript `<script lang="ts">`97 - Props exported with `export let` declarations98 - Styles reference CSS custom properties mapped from tokens99 - Reactive declarations for computed style values100101 **Vanilla HTML/CSS:**102 - Semantic HTML structure103 - CSS custom properties for all design values104 - No inline styles with hardcoded values1051062. **Generate CSS strategy artifacts.** Based on detected CSS strategy:107108 **Tailwind:**109 - Extend `tailwind.config` theme with token values (if not already present)110 - Map tokens to Tailwind utility classes in components111 - Use `@apply` sparingly — prefer utility classes in markup112 - Generate token-to-Tailwind mapping comment block at top of component113114 **CSS Custom Properties:**115 - Generate `:root` declarations for all consumed tokens116 - Components reference `var(--token-name)` exclusively117 - No hardcoded hex, rgb, hsl, or font values in component styles118119 **CSS-in-JS:**120 - Generate theme object from tokens121 - Components consume theme via provider/hook pattern122 - All style values reference theme properties1231243. **Apply design intent constraints.** For each generated component:125 - Check against anti-patterns from `design-system/DESIGN.md` and `agents/skills/shared/design-knowledge/anti-patterns/`126 - Enforce style guidelines (e.g., minimal style means no decorative effects)127 - Apply tone-appropriate color usage (e.g., cool tone means no warm accents in neutral UI)128 - Respect platform-specific web notes (animation preferences, responsive behavior)1291304. **Add USES_TOKEN annotations.** Insert comments in generated code documenting which tokens are consumed:131 ```132 /* @design-token color.primary.500 — primary action background */133 /* @design-token typography.heading.fontFamily — section heading */134 /* @design-token spacing.md — card internal padding */135 ```136 These annotations enable the knowledge graph to create `USES_TOKEN` edges from this component to the consumed `DesignToken` nodes.137138### Phase 3: VERIFY — Check Token Binding and Design Constraints1391401. **Scan for hardcoded values.** Use Grep to search generated files for:141 - Hardcoded color values: hex (`#[0-9a-fA-F]{3,8}`), `rgb()`, `hsl()`, named colors142 - Hardcoded font families: `font-family:` declarations not referencing tokens143 - Hardcoded spacing: pixel/rem values in margin/padding/gap not from the token scale144 - Each finding is a violation: the component uses a value not bound to a token.1451462. **Verify token coverage.** For every design value in the generated component:147 - Confirm it resolves to a token in `design-system/tokens.json`148 - Confirm the token path is valid (e.g., `color.primary.500` exists in the token tree)149 - Report orphan references (token annotations pointing to non-existent tokens)1501513. **Check anti-pattern compliance.** Cross-reference generated code against anti-patterns declared in `design-system/DESIGN.md` and the anti-pattern definitions in `agents/skills/shared/design-knowledge/anti-patterns/`:152 - Grep for patterns matching each declared anti-pattern153 - Flag violations with file path, line number, and the specific anti-pattern violated1541554. **Query the knowledge graph.** If a graph exists at `.harness/graph/`:156 - Use `DesignIngestor` to verify `DesignToken` nodes exist for all referenced tokens157 - Verify `PLATFORM_BINDING` edges exist for web platform tokens158 - Use `DesignConstraintAdapter` to check for `VIOLATES_DESIGN` edges159 - Report any constraint violations with severity based on `design.strictness`1601615. **Assign severity based on `designStrictness`:**162 - `permissive` — all findings are `info`163 - `standard` — hardcoded values and anti-pattern violations are `warn`, accessibility violations are `error`164 - `strict` — hardcoded values are `error` (blocks), anti-pattern violations are `warn`, accessibility violations are `error`1651666. **Report verification results.** Present:167168 ```169 WEB-001 [warn] Hardcoded color #3b82f6 — should reference token "color.primary.500"170 File: src/components/Button.tsx:12171 Fix: Replace with Tailwind class "bg-primary-500" or var(--color-primary-500)172173 WEB-002 [info] Anti-pattern: gradient on card background174 File: src/components/MetricCard.tsx:28175 Fix: Use solid background from token "color.neutral.50"176 ```1771787. **Run `harness validate`.** After verification, run project-level validation to confirm the new components integrate cleanly.179180## Harness Integration181182- **`harness validate`** — Run after generating components to verify project health. New files must not break existing constraints.183- **`harness scan`** — Run after component generation to update the knowledge graph with new `USES_TOKEN` edges from generated components to consumed tokens.184- **`DesignIngestor`** (`packages/graph/src/ingest/DesignIngestor.ts`) — Verifies that `DesignToken` nodes exist for all tokens referenced by generated components. If tokens are missing from the graph, run `harness scan` to re-ingest.185- **`DesignConstraintAdapter`** (`packages/graph/src/constraints/DesignConstraintAdapter.ts`) — Checks for `VIOLATES_DESIGN` edges during the VERIFY phase. Reports constraint violations at the configured strictness level.186- **`harness-design-system`** — Dependency. This skill reads tokens generated by harness-design-system. If tokens do not exist, instruct the user to run harness-design-system first.187- **`harness-design`** — Dependency. This skill reads aesthetic intent from harness-design output (`design-system/DESIGN.md`). Anti-pattern enforcement and style constraints come from the design intent document.188- **`harness-impact-analysis`** — When tokens change, impact analysis traces which components consume affected tokens via `USES_TOKEN` edges. Use this to identify components that need regeneration after token updates.189190**Graph naming convention:** This skill uses PascalCase for node types (`DesignToken`, `DesignConstraint`) and UPPER_SNAKE for edge types (`USES_TOKEN`, `PLATFORM_BINDING`, `VIOLATES_DESIGN`) as conceptual labels. The graph schema registers these as snake_case identifiers (`design_token`, `design_constraint`, `uses_token`, `platform_binding`, `violates_design`). The adapter classes (`DesignIngestor`, `DesignConstraintAdapter`) handle the mapping — always use the adapters rather than constructing graph queries with raw type names.191192## Success Criteria193194- Generated components reference design tokens exclusively — no hardcoded color, font, or spacing values195- Framework detection correctly identifies React, Vue, Svelte, or vanilla projects196- CSS strategy detection correctly identifies Tailwind, CSS Modules, CSS-in-JS, or vanilla CSS197- Token-to-CSS mapping produces correct output for each CSS strategy (Tailwind classes, CSS custom properties, theme object references)198- `@design-token` annotations are present for every consumed token199- Anti-pattern compliance check catches violations declared in `design-system/DESIGN.md`200- Verification report uses severity levels matching `design.strictness` configuration201- `harness validate` passes after component generation202203## Examples204205### Example: React + Tailwind Button Component206207**Context:** SaaS dashboard project. React with Tailwind CSS. Tokens generated by harness-design-system. Design intent established by harness-design (minimal style, cool professional tone).208209**SCAFFOLD output:**210211```212Framework detected: React (Next.js)213CSS strategy: Tailwind CSS (tailwind.config.ts)214Tokens loaded: 42 tokens from design-system/tokens.json215Design intent: Minimal, cool professional (from DESIGN.md)216Component plan: Button with primary/secondary/ghost variants217Token consumption: color.primary.*, color.neutral.*, typography.body, spacing.sm/md218```219220**IMPLEMENT output (Button.tsx):**221222```tsx223/* @design-token color.primary.500 — primary variant background */224/* @design-token color.primary.700 — primary variant hover */225/* @design-token color.neutral.50 — ghost variant background */226/* @design-token color.neutral.900 — ghost variant text */227/* @design-token typography.body.fontFamily — button label */228/* @design-token typography.body.fontWeight — button label weight */229/* @design-token spacing.sm — button horizontal padding */230/* @design-token spacing.xs — button vertical padding */231232import type { ButtonHTMLAttributes } from 'react';233234interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {235 variant?: 'primary' | 'secondary' | 'ghost';236 size?: 'sm' | 'md' | 'lg';237}238239export function Button({240 variant = 'primary',241 size = 'md',242 className = '',243 children,244 ...props245}: ButtonProps) {246 const baseClasses =247 'inline-flex items-center justify-center font-body font-medium rounded-md transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-500';248249 const variantClasses = {250 primary: 'bg-primary-500 text-white hover:bg-primary-700',251 secondary: 'border border-primary-500 text-primary-700 hover:bg-primary-50',252 ghost: 'text-neutral-900 hover:bg-neutral-100',253 };254255 const sizeClasses = {256 sm: 'px-spacing-sm py-spacing-xs text-sm',257 md: 'px-spacing-md py-spacing-sm text-base',258 lg: 'px-spacing-lg py-spacing-md text-lg',259 };260261 return (262 <button263 className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}264 {...props}265 >266 {children}267 </button>268 );269}270```271272**VERIFY output:**273274```275Verification Results276--------------------277Hardcoded values: PASS (0 hardcoded colors, fonts, or spacing)278Token coverage: PASS (8/8 referenced tokens exist in tokens.json)279Anti-pattern check: PASS (no gradients, no decorative borders)280Design constraints: PASS (no VIOLATES_DESIGN edges)281Harness validate: PASS282```283284### Example: Vue + CSS Custom Properties Card Component285286**Context:** E-commerce project. Vue 3 with CSS custom properties. Tokens from harness-design-system.287288**IMPLEMENT output (ProductCard.vue):**289290```vue291<!-- @design-token color.neutral.50 — card background -->292<!-- @design-token color.neutral.200 — card border -->293<!-- @design-token color.neutral.900 — card text -->294<!-- @design-token typography.heading.fontFamily — product title -->295<!-- @design-token typography.body.fontFamily — product description -->296<!-- @design-token spacing.md — card padding -->297<!-- @design-token spacing.sm — content gap -->298299<script setup lang="ts">300interface Props {301 title: string;302 description: string;303 price: string;304 imageUrl: string;305 imageAlt: string;306}307308defineProps<Props>();309</script>310311<template>312 <article class="product-card">313 <img :src="imageUrl" :alt="imageAlt" class="product-card__image" />314 <div class="product-card__content">315 <h3 class="product-card__title">{{ title }}</h3>316 <p class="product-card__description">{{ description }}</p>317 <span class="product-card__price">{{ price }}</span>318 </div>319 </article>320</template>321322<style scoped>323.product-card {324 background: var(--color-neutral-50);325 border: 1px solid var(--color-neutral-200);326 border-radius: var(--radius-md);327 overflow: hidden;328}329330.product-card__content {331 padding: var(--spacing-md);332 display: flex;333 flex-direction: column;334 gap: var(--spacing-sm);335}336337.product-card__title {338 font-family: var(--typography-heading-fontFamily);339 font-weight: var(--typography-heading-fontWeight);340 color: var(--color-neutral-900);341}342343.product-card__description {344 font-family: var(--typography-body-fontFamily);345 color: var(--color-neutral-700);346}347</style>348```349350## Rationalizations to Reject351352| Rationalization | Reality |353| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |354| "The tokens file doesn't exist yet, but I know the brand colors — I'll hardcode them as a placeholder and note they should be replaced later." | Hardcoded values in generated output are the exact problem this skill exists to prevent. There is no placeholder exception. If `design-system/tokens.json` does not exist, instruct the user to run harness-design-system first and stop. |355| "The framework is obviously React — everything in this project is React. I don't need to run detection." | Detection also identifies the CSS strategy (Tailwind vs CSS Modules vs CSS-in-JS), which determines how tokens map to code. Skipping detection produces components that may reference non-existent Tailwind classes or wrong theme paths. |356| "The user hasn't confirmed the scaffold plan, but the component structure is straightforward — I'll just generate it." | The scaffold plan confirmation is a gate. The user must see which tokens will be consumed and what the component structure will be before code is written. Generating first and explaining later inverts the review opportunity. |357| "This component only uses one hardcoded hex value for a shadow — that's not really a design value, so I'll leave it." | Every color, font, and spacing value must reference a token. Shadows use color tokens. "Not really a design value" is not a category the verification phase recognizes. The VERIFY phase will flag it; the IMPLEMENT phase should not introduce it. |358| "The `@design-token` annotations are just comments — skipping them on a few components won't affect anything." | These annotations are how `harness scan` creates `USES_TOKEN` edges in the knowledge graph. Missing annotations mean harness-impact-analysis cannot trace token changes to affected components. They are structural metadata, not decorative comments. |359360## Gates361362These are hard stops. Violating any gate means the process has broken down.363364- **No component generation without reading tokens from harness-design-system.** The SCAFFOLD phase requires `design-system/tokens.json` to exist. If tokens have not been generated, instruct the user to run harness-design-system first. Do not generate components with hardcoded values as a fallback.365- **No hardcoded design values in generated output.** Every color, font, and spacing value must reference a token. If a needed token does not exist, instruct the user to add it via harness-design-system rather than hardcoding the value.366- **No framework-specific code without framework detection.** The SCAFFOLD phase must detect or receive the target framework before generating components. Do not guess or default to React.367- **No generation without scaffold plan confirmation.** The SCAFFOLD phase must present a component plan to the user. Do not generate code without the user confirming the structure and token consumption plan.368- **No graph mutations without validating node types.** When creating `USES_TOKEN` or `PLATFORM_BINDING` edges, verify the node and edge types are registered in the graph schema before writing.369370## Escalation371372- **When `design-system/tokens.json` does not exist:** Instruct the user: "Design tokens have not been generated. Run `harness-design-system` first to create `design-system/tokens.json`, then re-run `harness-design-web` for token-bound component generation."373- **When the project uses an undetected framework:** Ask the user to specify via the `--framework` CLI argument. Log: "Could not auto-detect web framework. Please specify: `harness skill run harness-design-web --framework react|vue|svelte|vanilla`."374- **When tokens are insufficient for the requested component:** Report which tokens are missing: "Component requires a `color.accent.500` token but it does not exist in `tokens.json`. Run `harness-design-system` to add the missing token, or choose an existing alternative." Do not hardcode a fallback.375- **When anti-patterns conflict with the requested design:** Present the conflict: "The requested gradient background violates the 'no gradients on data elements' anti-pattern from DESIGN.md. Options: (1) Remove the gradient and use a solid token color, (2) Update the anti-pattern list via `harness-design` if the intent has changed."376- **When the knowledge graph is unavailable:** Skip graph operations in SCAFFOLD and VERIFY phases. Log: "Graph not available at `.harness/graph/` — skipping token node verification and USES_TOKEN edge creation. Run `harness scan` later to populate." Continue with file-based operations.