Shadcn Code Review
by @anderskev
Reviews shadcn/ui components for CVA patterns, composition with asChild, accessibility states, and data-slot usage. Use when reviewing React components using...
clawhub install shadcn-code-reviewπ About This Skill
name: shadcn-code-review description: Reviews shadcn/ui components for CVA patterns, composition with asChild, accessibility states, and data-slot usage. Use when reviewing React components using shadcn/ui, Radix primitives, or Tailwind styling.
shadcn/ui Code Review
Quick Reference
| Issue Type | Reference | |------------|-----------| | className in CVA, missing VariantProps, compound variants | references/cva-patterns.md | | asChild without Slot, missing Context, component composition | references/composition.md | | Missing focus-visible, aria-invalid, disabled states | references/accessibility.md | | Missing data-slot, incorrect CSS targeting | references/data-slot.md |
Review Checklist
cn() receives className, not CVA variantsVariantProps exported for consumersasChild pattern uses @radix-ui/react-slotfocus-visible: states, not just :focusaria-invalid, aria-disabled for form statesdisabled: variants for all interactive elementssr-only for screen reader textdata-slot attributes for targetable composition partshas() selectors for state-based stylingHard gates (before writing findings)
Run these in order. Do not draft user-facing findings until every gate passes for the batch you are about to report.
1. Location evidence β Pass: Each issue lists a repo path and either a line range or a short verbatim quote from the file you read (not from memory or diff-only guesswork).
2. Exemption check β Pass: For each issue, you can state in one line why it is *not* covered by Valid Patterns (Do NOT Flag).
3. Context-sensitive claims β Pass: For accessibility or Radix-related flags, you checked the file for imports/wrappers showing what actually runs (or you cite the concrete gap).
4. Protocol β Pass: You completed the Pre-Report Verification Checklist in review-verification-protocol for this review.
Valid Patterns (Do NOT Flag)
These are correct patterns that should NOT be flagged as issues:
max-h-(--var) - correct Tailwind v4 CSS variable syntax (NOT v3 bracket notation)text-[color:var(--x)] - valid arbitrary value syntaxContext-Sensitive Rules
Apply these rules with appropriate context awareness:
Library Convention Note
shadcn/ui components are designed to be copied and modified. Code review should focus on:
Do NOT flag:
When to Load References
Review Questions
1. Are CVA variants properly separated from className props? 2. Does asChild composition work correctly with Slot? 3. Are all accessibility states (focus, invalid, disabled) handled? 4. Are data-slot attributes used for component part targeting? 5. Can consumers extend variants without breaking composition?
Before Submitting Findings
Complete Hard gates (especially gate 4), then report only issues that still pass the review-verification-protocol pre-report checks.