From ux-harness
Review new or modified files against the 8 UX Harness rules. Checks file length, Tailwind-only styling, strong types, Component → Hook → Service → API layering, design system token usage, test file existence, and Storybook duplication. Outputs a violation report with severity and fix suggestions. The micro lens — checks individual files. For codebase-wide health reports use ux-audit. Works on any React/Tailwind frontend codebase. Triggers on: "ux-guard", "check this against the standard", "review this file", "does this pass the harness", or before any PR or commit.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ux-harness:ux-guardThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Review files against the 8 UX Harness rules. The micro lens.
Review files against the 8 UX Harness rules. The micro lens.
Announce at start: "Running UX Harness guard check..."
Run ux-prime to load:
What files to check:
--staged → run git diff --name-only --cached to get staged files--diff → run git diff main...HEAD --name-only.ts and .tsx files in src/For each file in scope, run these checks:
style={{ → FAIL (inline styles).module.css imports → FAIL (CSS modules)styled. or @emotion → FAIL (CSS-in-JS)bg-[, text-[, w-[, h-[, p-[, m-[ → FAIL (arbitrary values — use token classes)bg-blue-, bg-red-, bg-green-, bg-gray-, bg-slate-, etc. → Should be bg-background-*text-blue-, text-red-, text-green-, text-gray-, etc. → Should be text-text-*border-blue-, border-red-, border-gray-, etc. → Should be border-border-*bg-blue-500 → bg-background-primarytext-gray-500 → text-text-weakborder-gray-200 → border-border-defaultbg-red-100 → bg-background-criticalSubtletext-green-600 → text-text-success.tsx files, search for ternary expressions or && in JSX that span 5+ lines: any → FAIL if in business logic, WARN if at API boundaryas any → FAIL always.tsx files, search for fetch(, axios., .get(, .post( → FAIL (direct API call in component)fetch(, axios. → WARN (should be in service layer).tsx files, check for hardcoded color hex values → FAIL: "Use a semantic token class instead"bg-gray-50, text-blue-700 should be semantic (bg-background-weak, text-text-primary)p-4, gap-2 → WARN: "Use named spacing (p-lg, gap-sm) instead of numeric"; p-[23px] → FAILStorybook style enforcement (uses the Storybook Style Reference from ux-prime Step 3e):
Compare every class in the file against the established patterns from Storybook. Check ALL elements, not just spacing:
bg-gray-800 but Storybook uses bg-bg-default for containers → WARNtext-white but Storybook uses text-tx-strong for headings → WARNborder-gray-600 but Storybook uses border-bd-default → WARNp-3 but similar Storybook components use p-5 → WARNrounded-md on a card but Storybook cards use rounded-xl → WARNtext-base where Storybook uses text-sm font-medium for the same element type → WARNw-6 h-6 but Storybook uses w-4 h-4 / w-5 h-5 → WARNtransition-colors → WARNFor each warning, cite the specific Storybook component and story that establishes the pattern:
→ Storybook reference: MetricCard (Widget Garage/Metric Card) uses bg-bg-default, rounded-xl, p-5
.tsx or .ts file, check if a corresponding .test.tsx or .test.ts exists[ComponentName] already exists in Storybook at [import path] (story: [story file]). Use it."[ComponentName] in Storybook. Import it instead of re-implementing."[ComponentName]: file uses [X], Storybook uses [Y]"src/utils/Run all checks with actual grep/search commands. Do NOT guess at results.
UX Harness Guard Report
════════════════════════
Files checked: [count]
[filename.tsx]
✗ FAIL Rule 1: 247 lines (200 hard cap)
✗ FAIL Rule 4: `as any` on line 58
⚠ WARN Rule 3: Conditional JSX block on lines 120-145
⚠ WARN Rule 7: No test file found
✓ PASS Rule 2: Tailwind only
✓ PASS Rule 5: No direct API calls
✓ PASS Rule 6: Design system tokens used
✓ PASS Rule 8: No Storybook duplication
[filename2.tsx]
✓ PASS All rules
Summary:
FAIL: [count] violations across [count] files
WARN: [count] warnings across [count] files
PASS: [count] files fully compliant
Suggested fixes:
1. [filename.tsx] line 58: Replace `as any` with proper type
2. [filename.tsx]: Extract lines 120-145 into a separate component
3. [filename.tsx]: Add test file [filename.test.tsx]
| Severity | Meaning | Action |
|---|---|---|
| FAIL | Hard rule violation — must be fixed before merge | Block PR |
| WARN | Soft violation — should be fixed, not blocking | Fix if possible |
| PASS | Rule satisfied | No action |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub jakecjones/ux-harness --plugin ux-harness