primitive

Creates stateless, variant-driven UI primitive components for React and Astro design systems.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill primitive-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: primitive
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/primitive
Command: npx skills add https://github.com/gabriellst/codm --skill primitive-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires class-variance-authority, @base-ui/react.

What problem does it solve? Building reusable design system components often leads to inconsistent styling, hardcoded colors, duplicated button variants, and primitives that break when composed with Base UI render props. This Skill enforces a single, consistent way to author primitives so every Button, Card, Input, or Dialog follows the same rules across the React console and the Astro landing app. ## Core Features & Use Cases - Platform routing: Detects the working directory and routes to the React variant (Base UI + Tailwind + CVA) or the Astro variant (static .astro components with optional React islands). - Pattern registry enforcement: Ships registry.yaml files with structural patterns (CVA variants, forwardRef, data-slot, named exports) and mechanical bad-practice detectors for hardcoded colors, missing forwardRef, and closed props interfaces. - Reference-driven implementation: Guides lookup of shadcn/ui and Base UI reference implementations before coding, then adapts them to project conventions. - Use Case: You need a new Pill component for both the landing page and the console. The Skill picks the right platform guide, scaffolds a CVA-driven primitive using design tokens, and checks it against the registry's bad practices. ## Quick Start Ask the agent to create a new primitive component such as a Badge or Card in the current package, and it will route to the correct React or Astro guide and enforce the design system rules.

Frequently Asked Questions about primitive

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

FAQPage Schema
How do I create a reusable Button component with variants in React?

Define variants with class-variance-authority (cva) including variant and size keys plus defaultVariants, then wrap a Base UI Button primitive with React.forwardRef using a named function. Merge classes with cn() so consumer className overrides win, and add a data-slot attribute.

When should an Astro component be a React island instead of a static .astro file?

Use a .tsx React island only when the primitive needs controlled state, reads window or document, handles events that change state, or mounts a portal or popover. Otherwise author a static .astro file, since Astro's value is shipping HTML without JavaScript.

Why does my component break when used with Base UI's render prop?

The component is missing forwardRef, so Base UI cannot attach its ref and behavior. Wrap it with React.forwardRef using a named function and pass the ref to the underlying primitive, which is critical for interactive primitives like Button, Input, and Select triggers.

Can I use Tailwind color classes like bg-blue-500 in design system primitives?

No. Primitives must use semantic tokens such as bg-primary, text-foreground, or border that map to the shared tokens.css. Standard spacing, sizing, and typography utilities like px-2, h-8, and text-sm are allowed; only color scale classes, hex values, and arbitrary value syntax are flagged.

When should I not create a primitive component?

Skip a primitive when the component is route-scoped or feature-specific, when it owns data fetching or business logic, or when an existing primitive already covers the case. Use a feature component or form skill instead, since forms compose primitives rather than define them.