styling
Guide for CSS and Tailwind styling using project-specific component standards.
Install
mkdir -p .claude/skills/styling && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3313" && unzip -o skill.zip -d .claude/skills/styling && rm skill.zipInstalls to .claude/skills/styling
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
CSS and Tailwind, cn(), flex layouts. Use for "style this", "fix the CSS", "add classes", "not scrolling", "overflow", Tailwind utilities.Key capabilities
- →Suggests semantic alternatives to wrapper divs
- →Enforces Tailwind utility ordering
- →Manages layout behavior for flex/grid structures
- →Handles state-based styling for disabled components
- →Provides context-aware CSS module/class merging
How it works
It evaluates component trees against a rule-set that minimizes HTML nesting and promotes semantic utility usage.
Inputs & outputs
When to use styling
- →Styling UI components
- →Debugging layout issues
- →Optimizing Tailwind usage
- →Managing CSS wrapper elements
About this skill
Styling Guidelines
When styling depends on shadcn-svelte structure, class merging, variants, Bits UI composition, or local wrapper behavior, read ui-design's component-system reference for upstream grounding. Ordinary Tailwind utilities and the repo-local layout rules below need no external lookup.
Minimize Wrapper Elements
Avoid creating unnecessary wrapper divs. If classes can be applied directly to an existing semantic element with the same outcome, prefer that approach.
Good (Direct Application)
<main class="flex-1 mx-auto max-w-7xl">
{@render children()}
</main>
Avoid (Unnecessary Wrapper)
<main class="flex-1">
<div class="mx-auto max-w-7xl">
{@render children()}
</div>
</main>
This principle applies to all elements where the styling doesn't conflict with the element's semantic purpose or create layout issues.
Tailwind Best Practices
- Use the
cn()utility from$lib/utilsfor combining classes conditionally - Prefer utility classes over custom CSS for local layout and state
- Prefer shared scale and semantic-token utilities over arbitrary bracketed values and raw colors
- Use
tailwind-variantsfor component variant systems - Follow the
background/foregroundconvention for colors - Leverage CSS variables for theme consistency
Shared Primitive Overrides
When styling a local @epicenter/ui primitive, use ui-design's component-system reference. Tailwind classes on shared primitives should usually express parent layout or product state, not redefine the primitive's visual budget.
Good primitive overrides:
<Item.Button size="sm" class="w-full justify-start text-left" />
Suspicious primitive overrides:
<Item.Button size="sm" class="gap-2 rounded px-2 py-1.5 text-sm hover:bg-accent/50" />
If an override repeats size, density, radius, gap, padding, typography, hover, focus, or transition classes, ask whether the primitive needs a size, variant, or semantic wrapper instead.
Disabled States: Use HTML disabled + Tailwind Variants
When an interactive element can be non-interactive (empty section, loading state, no items), use the HTML disabled attribute instead of JS conditional guards. Pair it with Tailwind's enabled: and group-disabled: variants.
Why disabled Over JS Guards
disablednatively blocks clicks: noif (!hasItems) returnneeded- Enables the
:disabledCSS pseudo-class for styling - Semantically correct for accessibility (screen readers announce "dimmed" or "unavailable")
- Tailwind's
enabled:andgroup-disabled:variants compose cleanly
Pattern
<!-- The button disables itself when count is 0 -->
<button
class="group enabled:cursor-pointer enabled:hover:opacity-80"
disabled={item.count === 0}
onclick={toggle}
>
{item.label} ({item.count})
<ChevronIcon class="group-disabled:invisible" />
</button>
Key Variants
enabled:cursor-pointer: pointer cursor only when clickableenabled:hover:bg-accent/50: hover effects only when interactivegroup-disabled:invisible: hide child elements (e.g., expand chevron) when parent is disableddisabled:opacity-50: dim the element when disabled
Anti-Pattern
<!-- Don't do this: JS guard duplicates what disabled does natively -->
<button
class="cursor-pointer hover:opacity-80"
onclick={() => { if (item.count > 0) toggle(); }}
>
The JS guard leaves cursor-pointer and hover:opacity-80 active on a non-interactive element. The user sees a clickable button that does nothing. Use disabled and let the browser + CSS handle it.
Flex Column Scroll Trap
When a flex child uses h-full (height: 100%) but shares a flex column with siblings (headers, toolbars, footers), it computes to the full parent height: overflowing past siblings instead of taking the remaining space. The content gets clipped or pushes the layout past the viewport, and scroll areas inside never activate.
This is the single most common layout bug in this codebase. It appears whenever you have:
- A component inside a
Resizable.Pane(paneforge) that needs to scroll - A
ScrollArea.Root(bits-ui) oroverflow-autodiv inside a flex column with a header/toolbar sibling - Any split-pane or panel layout where one section should scroll independently
The Fix: flex-1 min-h-0 overflow-hidden
Replace h-full with these three utilities on the flex child that contains scrollable content. Each solves a distinct problem:
| Utility | What it does | Why it's needed |
|---|---|---|
flex-1 | Take remaining space after siblings | h-full = 100% of parent, ignoring siblings. flex-1 = remaining space. |
min-h-0 | Allow shrinking below content size | Flex items default to min-height: auto, preventing them from being smaller than their content. |
overflow-hidden | Establish a bounded height context | Without this, children with overflow-auto or ScrollArea have no height ceiling to scroll against. |
All three are required. Missing any one breaks the fix:
- Without
flex-1: element is still 100% of parent, overflows siblings - Without
min-h-0: element refuses to shrink, content pushes it taller - Without
overflow-hidden: inner scroll containers have no bounded ancestor, so they expand instead of scrolling
Before / After
<!-- BROKEN: h-full = 100% of parent, ignores the toolbar sibling -->
<main class="flex h-full flex-col overflow-hidden">
<div class="border-b px-4 py-2">Toolbar</div>
<MyScrollableContent class="h-full" /> <!-- overflows past main -->
</main>
<!-- FIXED: flex-1 takes remaining space, overflow-hidden bounds it -->
<main class="flex h-full flex-col overflow-hidden">
<div class="border-b px-4 py-2">Toolbar</div>
<MyScrollableContent class="flex-1 min-h-0 overflow-hidden" />
</main>
Inside Resizable Panes (paneforge)
Paneforge Pane components set width via flex ratios but do not constrain height or clip overflow. Any scrollable content inside a Pane needs the full flex-1 min-h-0 overflow-hidden chain on its root element:
<Resizable.Pane defaultSize={80}>
<!-- Pane provides no height constraint or overflow clipping -->
<div class="flex flex-1 min-h-0 flex-col overflow-hidden">
<div class="border-b">Header</div>
<div class="flex-1 overflow-y-auto">
<!-- this content now scrolls -->
</div>
</div>
</Resizable.Pane>
With ScrollArea (bits-ui)
ScrollArea.Root renders with position: relative and its viewport uses height: 100%. This breaks the flex sizing chain: the viewport's percentage height resolves against the relative parent, which has no explicit height in a flex context. The content expands instead of scrolling.
Two options:
- Prefer plain
overflow-y-autoon a div withflex-1 min-h-0(simpler, always works) - If you need styled scrollbars, wrap
ScrollArea.Rootin a div withflex-1 min-h-0 overflow-hiddento give it a bounded ancestor
<!-- Option 1: Plain overflow (preferred) -->
<div class="flex-1 overflow-y-auto">
{#each items as item}
<div>{item.name}</div>
{/each}
</div>
<!-- Option 2: ScrollArea with bounded wrapper -->
<div class="flex-1 min-h-0 overflow-hidden">
<ScrollArea.Root class="h-full">
{#each items as item}
<div>{item.name}</div>
{/each}
</ScrollArea.Root>
</div>
Rule of Thumb
If you write h-full on a flex child that has siblings in the same flex column, stop and replace it with flex-1 min-h-0 overflow-hidden. The h-full pattern only works when the element is the sole child of its flex parent.
When not to use it
- →Styles outside the Tailwind/CSS ecosystem
- →Legacy CSS projects requiring raw stylesheet files
Limitations
- →Depends on repository-specific design tokens
- →Cannot see the visual output directly
How it compares
It focuses on reducing 'wrapper bloat' while ensuring design system consistency.
Compared to similar skills
styling side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| styling (this skill) | 1 | 2mo | No flags | Beginner |
| frontend-design | 481 | 2mo | No flags | Advanced |
| screenshot-to-code | 204 | 2mo | No flags | Beginner |
| web-artifacts-builder | 49 | 3mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by EpicenterHQ
View all by EpicenterHQ →You might also like
frontend-design
anthropics
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
screenshot-to-code
OneWave-AI
Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.
web-artifacts-builder
anthropics
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
svelte-ui-design
XIYO
ALWAYS use this skill for ANY Svelte component styling, design, or UI work. Svelte 5 UI design system using Tailwind CSS 4, Skeleton Labs design tokens/presets/Tailwind Components, and Bits UI headless components. Covers class composition, color systems, interactive components, forms, overlays, and all visual design.
skeleton-svelte
martinemde
Use this skill when working with Skeleton UI components in Svelte projects. It provides guidelines for Skeleton's component composition pattern, theme-aware color system, design presets, and layout patterns. Trigger when building UI components, styling elements, creating layouts, or working with Skeleton-specific features in Svelte 5 and SvelteKit 2+ projects.
responsive-design
wshobson
Implement modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first breakpoint strategies. Use when building adaptive interfaces, implementing fluid layouts, or creating component-level responsive behavior.