conventions-css
Apply when writing styles. Ensures consistency with design system and project patterns.
When & Why to Use This Skill
This Claude skill streamlines frontend development by enforcing professional CSS conventions and design system integration. It automates the creation of scoped, maintainable styles using native CSS features and design tokens, eliminating the need for utility frameworks while ensuring project-wide visual consistency and architectural integrity.
Use Cases
- Consistent Component Styling: Generate CSS for new UI components that automatically adheres to predefined design tokens for colors, spacing, and typography.
- Architectural Enforcement: Ensure all styles follow strict scoping rules (Atoms vs. Scoped) and native CSS nesting to prevent style leakage and maintain a clean codebase.
- Legacy Code Refactoring: Systematically replace hardcoded hex codes and magic numbers with semantic CSS custom properties to align existing styles with a modern design system.
- Framework-Free Development: Maintain a high-performance, dependency-free CSS architecture by enforcing the use of native CSS features over utility-first frameworks or CSS-in-JS.
| name | conventions-css |
|---|---|
| description | Apply when writing styles. Ensures consistency with design system and project patterns. |
CSS Conventions
No Utility Frameworks
No Tailwind, no utility classes, no CSS-in-JS. Custom CSS only.
Scoping Rules
- Atoms: Unscoped
<style>— allows design token inheritance - Everything else:
<style scoped>
Design Tokens
CSS custom properties exclusively. Never hardcode colors, spacing, typography.
.base-input {
padding: var(--input-padding);
border-color: var(--input-border-color);
font-family: var(--input-font-family);
}
Color System
- Semantic:
--color-primary-{100-400},--color-error-{100-400} - Named:
--color-blue-{100-400},--color-amber-{100-400} - Contextual:
--text-primary,--input-focus-border
Native CSS Nesting
.base-input {
&:focus {
border-color: var(--input-focus-border);
}
&:disabled {
opacity: var(--input-disabled-opacity);
}
}
Inline Styles
Only for truly dynamic values (calculated at runtime). Otherwise use CSS custom properties.