shadcn-code-review

Review shadcn/ui React components for CVA patterns, asChild composition, accessibility states, and data-slot usage.

75|9|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/anderskev/beagle --skill shadcn-code-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn-code-review
Source: https://github.com/anderskev/beagle/tree/main/skills/shadcn-code-review
Command: npx skills add https://github.com/anderskev/beagle --skill shadcn-code-review

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps ensure CVA usage, component composition, accessibility, and data-slot correctness in ShadCN UI components.

Core Features & Use Cases

  • CV A Pattern Checks: CVA variant handling, variantProps export, and compoundVariants.
  • Composition & Accessibility: asChild usage, focus-visible, aria-invalid, disabled states.
  • Data-slot & Targeting: Verify data-slot usage for stable styling.

Quick Start

Run through the provided review checklist to validate a ShadCN component against CVA patterns and accessibility rules.

Frequently Asked Questions about shadcn-code-review

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

FAQPage Schema
How do I review shadcn/ui components for CVA pattern correctness?

CVA pattern reviews check variant handling, VariantProps exports, and compound variants in shadcn/ui components. Use the review checklist to validate that variants are correctly defined, exported, and applied through CVA utilities, ensuring type-safe styling and predictable behavior.

What accessibility states should I verify in shadcn/ui components?

Key accessibility states include focus-visible for keyboard navigation, aria-invalid for validation states, disabled attribute handling, sr-only text for screen readers, and proper ARIA attributes. Data-slot attributes enable stable selectors for these states without brittle CSS dependencies.

Can I use asChild with shadcn/ui components for composition?

Yes, asChild enables composition by forwarding Slot props to child elements, allowing polymorphic rendering without wrapper divs. Verify asChild usage respects Radix primitives and maintains accessibility context across composed components.

Why use data-slot attributes in shadcn/ui styling?

Data-slot attributes provide stable, semantic selectors for targeting component parts in CSS and has() selectors without relying on fragile class name structures. They improve maintainability and enable scoped styling that survives refactoring.

What's the difference between CVA variants and Tailwind classes in shadcn/ui?

CVA provides type-safe, composable variant management with VariantProps and compound variants, while raw Tailwind classes lack structure. CVA integrates with Tailwind in shadcn/ui to deliver predictable, maintainable variants across complex component hierarchies.

Do I need to export VariantProps from my shadcn/ui components?

Yes, exporting VariantProps enables type inference and documentation for component variant props, allowing consumers to compose variants safely. This pattern is essential for polymorphic components built with CVA and asChild.