Bulletproof Frontend Design
CSS is king. Semantic, maintainable CSS over utility-class frameworks. When you encounter Tailwind, refactor it to proper CSS.
Design Values: For spacing scales, typography sizes, color palettes, contrast ratios, and component specifications, see ui-design-fundamentals. This skill focuses on CSS implementation patterns.
Core Philosophy
"Always ask: What happens if...?" — Design for the unexpected. Build interfaces that remain functional and readable regardless of content length, text size, browser, or device.
The Three Pillars
1. Bulletproof Design
- Design for flexibility, not fixed scenarios
- Test with varying text sizes and content lengths
- Use relative units (em, %, rem) over fixed pixels
2. Progressive Enrichment
- Reward capable browsers with advanced CSS
- Websites don't need to look identical in every browser — they need to be functional
- Use modern CSS with appropriate fallbacks
3. Reevaluate Past Methods
- Question whether old hacks are still necessary
- Simplify where new CSS features allow
- Refactor utility frameworks to semantic CSS
Quick Reference
| Pattern |
When to Use |
| CSS custom properties |
Theming, spacing, colors |
| BEM naming |
Component class structure |
| Cascade layers |
Managing specificity |
| Container queries |
Component-based responsiveness |
| :has() selector |
Parent/sibling selection |
| CSS nesting |
Organizing related styles |
Modern CSS Essentials
/* :has() — Style based on children */
.card:has(img) { padding-top: 0; }
.form:has(:invalid) { border-color: var(--color-error); }
/* Container queries — Component responsiveness */
.container { container-type: inline-size; }
@container (min-width: 400px) { .card { display: flex; } }
/* CSS nesting — Clean organization */
.card {
padding: var(--space-md);
&:hover { box-shadow: var(--shadow-lg); }
& .card__title { font-weight: var(--font-bold); }
}
/* Cascade layers — Controlled specificity */
@layer reset, base, components, utilities;
Tailwind → Semantic CSS
{{-- BEFORE: Utility classes --}}
<div class="flex items-center p-4 bg-white rounded-lg shadow">
{{-- AFTER: Semantic CSS --}}
<div class="card">
.card {
display: flex;
align-items: center;
padding: var(--space-md);
background: var(--color-surface);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
}
| CSS Approach |
Tailwind |
| Readable HTML |
Bloated class attributes |
| Styles in one place |
Scattered in markup |
| Easy to refactor |
Find-and-replace nightmare |
| Cacheable stylesheets |
Repeated classes |
Reference Files
| File |
Content |
| css-architecture.md |
Custom properties, BEM, layers, file organization |
| accessibility-patterns.md |
Focus, screen readers, motion, dark mode |
| responsive-patterns.md |
Breakpoints, container queries, fluid sizing |
| reference.md |
Complete patterns and Blade components |
Project Style Guide
Project-specific implementation: docs/STYLEGUIDE.md
Contains the complete design system for the application:
- Design tokens (colors, spacing, typography)
- Component patterns (buttons, cards, alerts, tables)
- Blade component documentation
- Dark mode implementation
- Accessibility requirements
Always consult the style guide when implementing UI to ensure consistency with existing patterns.
Related Skills
- ui-design-fundamentals — Design values: spacing scales, type scales, colors, contrast ratios, component anatomy (buttons, forms, cards, etc.)
1---2name: bulletproof-frontend3description: Bulletproof CSS and frontend design principles from "Handcrafted CSS" by Dan Cederholm. Apply when writing CSS, HTML, Blade templates, or reviewing frontend code. CSS is king — refactor Tailwind when encountered.4metadata:5 source: https://skillmd.com/skills/aaddrick/bulletproof-frontend6---78# Bulletproof Frontend Design910**CSS is king.** Semantic, maintainable CSS over utility-class frameworks. When you encounter Tailwind, refactor it to proper CSS.1112> **Design Values:** For spacing scales, typography sizes, color palettes, contrast ratios, and component specifications, see `ui-design-fundamentals`. This skill focuses on CSS implementation patterns.1314## Core Philosophy1516**"Always ask: What happens if...?"** — Design for the unexpected. Build interfaces that remain functional and readable regardless of content length, text size, browser, or device.1718## The Three Pillars1920### 1. Bulletproof Design21- Design for flexibility, not fixed scenarios22- Test with varying text sizes and content lengths23- Use relative units (em, %, rem) over fixed pixels2425### 2. Progressive Enrichment26- Reward capable browsers with advanced CSS27- **Websites don't need to look identical in every browser** — they need to be functional28- Use modern CSS with appropriate fallbacks2930### 3. Reevaluate Past Methods31- Question whether old hacks are still necessary32- Simplify where new CSS features allow33- **Refactor utility frameworks to semantic CSS**3435## Quick Reference3637| Pattern | When to Use |38|---------|-------------|39| CSS custom properties | Theming, spacing, colors |40| BEM naming | Component class structure |41| Cascade layers | Managing specificity |42| Container queries | Component-based responsiveness |43| :has() selector | Parent/sibling selection |44| CSS nesting | Organizing related styles |4546## Modern CSS Essentials4748```css49/* :has() — Style based on children */50.card:has(img) { padding-top: 0; }51.form:has(:invalid) { border-color: var(--color-error); }5253/* Container queries — Component responsiveness */54.container { container-type: inline-size; }55@container (min-width: 400px) { .card { display: flex; } }5657/* CSS nesting — Clean organization */58.card {59 padding: var(--space-md);60 &:hover { box-shadow: var(--shadow-lg); }61 & .card__title { font-weight: var(--font-bold); }62}6364/* Cascade layers — Controlled specificity */65@layer reset, base, components, utilities;66```6768## Tailwind → Semantic CSS6970```blade71{{-- BEFORE: Utility classes --}}72<div class="flex items-center p-4 bg-white rounded-lg shadow">7374{{-- AFTER: Semantic CSS --}}75<div class="card">76```7778```css79.card {80 display: flex;81 align-items: center;82 padding: var(--space-md);83 background: var(--color-surface);84 border-radius: var(--radius-lg);85 box-shadow: var(--shadow-md);86}87```8889| CSS Approach | Tailwind |90|--------------|----------|91| Readable HTML | Bloated class attributes |92| Styles in one place | Scattered in markup |93| Easy to refactor | Find-and-replace nightmare |94| Cacheable stylesheets | Repeated classes |9596## Reference Files9798| File | Content |99|------|---------|100| [css-architecture.md](css-architecture.md) | Custom properties, BEM, layers, file organization |101| [accessibility-patterns.md](accessibility-patterns.md) | Focus, screen readers, motion, dark mode |102| [responsive-patterns.md](responsive-patterns.md) | Breakpoints, container queries, fluid sizing |103| [reference.md](reference.md) | Complete patterns and Blade components |104105## Project Style Guide106107**Project-specific implementation:** `docs/STYLEGUIDE.md`108109Contains the complete design system for the application:110- Design tokens (colors, spacing, typography)111- Component patterns (buttons, cards, alerts, tables)112- Blade component documentation113- Dark mode implementation114- Accessibility requirements115116Always consult the style guide when implementing UI to ensure consistency with existing patterns.117118## Related Skills119120- **ui-design-fundamentals** — Design values: spacing scales, type scales, colors, contrast ratios, component anatomy (buttons, forms, cards, etc.)