styling · devin-axis — Claude Code rule: CSS and components
Rule for consistent React component styling: semantic color tokens instead of raw Tailwind values, built-in component variants, conditional classes via cn(). Prevents improper Tailwind usage and ensures light and dark theme support.
LicenseRef-Proprietary ★ 7,523 updated 2026-10-29
.claude/rules/styling.mdWhat styling does
This rule enforces styling conventions for UI: use semantic tokens (bg-primary, text-muted-foreground) rather than literal colors like bg-blue-500, prefer component variants (variant="outline") over manual class overrides, apply className only for layout (max-w-md, gap-4), not colors or typography.
Key requirements: replace space-x-* and space-y-* with gap-*, use size-10 instead of w-10 h-10, prefer truncate to the full set overflow-hidden text-ellipsis whitespace-nowrap, write conditional classes through cn() from @/lib/utils, never add z-index to overlays (Dialog, Sheet, Drawer).
Common mistake: hard-coded status and indicator colors. Instead of text-red-600 for error, use text-destructive or a Badge variant. When a needed token is missing, suggest adding a CSS variable to customization.md rather than reaching for a raw color.
What it helps with
- pick a semantic color token instead of a hard-coded Tailwind value
- add a conditional class without ternary inside className string
- replace element spacing from
space-*togap - override component styling with built-in variant
- align styles across light and dark themes without manual
dark:prefixes
Example prompts for the agent
- Replace the background color with
bg-primary—this rule blocks rawbg-blue-500 - How do I customize colors for my brand? Check
customization.mdand add a CSS variable - Change
space-y-4toflex flex-col gap-4for me
How to install styling
Manually: put the files in place
.claude/rules/styling.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/styling.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/styling.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/styling.mdManually: put the files in place
.clinerules/styling.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about styling
How do I install styling in Claude Code?
Create or edit .claude/rules/styling.md at your project root and add the rule content. Claude Code loads rules automatically on next run.
What does the styling rule do?
It sets standards for component styling: semantic colors, built-in variants, conditional classes via cn(), no manual z-index, and automatic light/dark theme support. This prevents style inconsistency and makes maintenance easier.
What color should I use instead of text-green-500 for a status indicator?
Use a Badge component with a built-in variant or the text-destructive semantic token for errors. If the token you need doesn't exist, add a CSS variable to customization.md instead of using a raw Tailwind color.
Similar IDE rules
All IDE rules for Frontend and UI →styling by other authors comes first.