shadcn-agents-cva-validator

Validate shadcn cva components with a seven-check audit.

Updated May 19, 2026
One-click install
npx skills add https://github.com/Impertio-Studio/shadcn-ui-Claude-Skill-Package --skill shadcn-agents-cva-validator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn-agents-cva-validator
Source: https://github.com/Impertio-Studio/shadcn-ui-Claude-Skill-Package/tree/main/skills/source/shadcn-agents/shadcn-agents-cva-validator
Command: npx skills add https://github.com/Impertio-Studio/shadcn-ui-Claude-Skill-Package --skill shadcn-agents-cva-validator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Prevents shadcn-ui cva-driven components from silently shipping incorrect variant APIs by providing a deterministic, checklist-based validator that returns PASS or FAIL.

Core Features & Use Cases

  • 7-Point cva Variant API Validator: Verifies the canonical cva structure (base classes, variants shape, compoundVariants order, defaultVariants completeness, VariantProps export, cn() className merging, asChild Slot usage).
  • Code-Review / Pre-Commit Guardrails: Stops at the first failure and emits an exact verdict block with a line reference and the canonical fix pointer.
  • Debugs AI-generated or hand-edited cva mistakes: Catches frequent regressions like nested cn inside cva, compoundVariants before variants, defaultVariants typos, VariantProps drift, raw className concatenation, and missing Slot branching.

Quick Start

Use this validator to audit the diff of a shadcn component that uses class-variance-authority (cva) and quickly confirm the variant API matches shadcn conventions before accepting the change.

Frequently Asked Questions about shadcn-agents-cva-validator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate shadcn UI cva variant APIs in code review?

To validate shadcn UI cva variant APIs during code review, run a deterministic seven-check audit that verifies base classes, variants shape, compoundVariants order, defaultVariants completeness, VariantProps export, cn() class merging, and Radix Slot usage, returning a clear PASS or FAIL verdict.

Why does my shadcn component variant fail when merging caller className?

Shadcn component variant merging fails when raw className concatenation is used instead of the cn() utility; the validator checks that caller className is properly merged with cva base classes using cn() to prevent silent style overrides.

What is the correct structure for class-variance-authority variants in shadcn ui?

The correct cva structure for shadcn ui requires proper base classes, a valid variants shape, compoundVariants placed after variants, complete defaultVariants, an exported VariantProps type, and correct Radix Slot branching for asChild composition.

Does this cva validator catch AI-generated component mistakes?

Yes, this cva validator catches frequent AI-generated component regressions like nested cn inside cva, compoundVariants declared before variants, defaultVariants typos, VariantProps drift, and missing Slot branching by stopping at the first failure with an exact verdict block.

Can I use this validator for pre-commit hooks in TypeScript projects?

You can use this validator as a pre-commit guardrail in TypeScript projects to audit shadcn component diffs, stopping at the first structural failure and emitting an exact verdict block with a line reference and canonical fix pointer before accepting the change.