styling
CSS and Tailwind styling guidelines. Use when writing styles, creating UI components, reviewing CSS/Tailwind code, or deciding on wrapper element structure.
When & Why to Use This Skill
This Claude skill provides expert CSS and Tailwind CSS styling guidelines to optimize UI component development. It focuses on minimizing DOM complexity by reducing unnecessary wrapper elements and enforcing Tailwind best practices—such as utility-first styling, conditional class management with the cn() utility, and consistent theme variables—to ensure scalable and maintainable web projects.
Use Cases
- UI Component Development: Streamline the creation of semantic, high-performance UI components by avoiding redundant wrapper elements and applying styles directly to semantic tags.
- Tailwind CSS Optimization: Implement industry-standard best practices, including the use of tailwind-variants for component systems and standardized color conventions.
- Code Quality Review: Serve as a benchmark for reviewing CSS and Tailwind code to ensure adherence to clean code principles and architectural consistency across a team.
- Frontend Refactoring: Identify and eliminate 'div soup' in existing codebases to improve maintainability, readability, and browser rendering efficiency.
| name | styling |
|---|---|
| description | CSS and Tailwind styling guidelines. Use when writing styles, creating UI components, reviewing CSS/Tailwind code, or deciding on wrapper element structure. |
Styling Guidelines
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
- Use
tailwind-variantsfor component variant systems - Follow the
background/foregroundconvention for colors - Leverage CSS variables for theme consistency