$npx -y skills add dylantarre/design-system-skills --skill breakpointsGenerates responsive breakpoint tokens for media queries and container queries. Use when setting up responsive design, mobile-first layouts, or viewport-based styling. Outputs CSS, Tailwind, or JSON.
| 1 | # Breakpoints Generator |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Generate consistent responsive breakpoint tokens for mobile-first or desktop-first design. Includes common device-based presets and custom configuration options. |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - Setting up responsive design tokens |
| 10 | - Standardizing media queries across a project |
| 11 | - Creating container query breakpoints |
| 12 | - Migrating from arbitrary breakpoints to tokens |
| 13 | |
| 14 | ## Quick Reference: Common Breakpoints |
| 15 | |
| 16 | | Name | Min Width | Target Devices | |
| 17 | |------|-----------|----------------| |
| 18 | | xs | 0 | Small phones | |
| 19 | | sm | 640px | Large phones, small tablets | |
| 20 | | md | 768px | Tablets portrait | |
| 21 | | lg | 1024px | Tablets landscape, laptops | |
| 22 | | xl | 1280px | Desktops | |
| 23 | | 2xl | 1536px | Large desktops | |
| 24 | |
| 25 | ## The Process |
| 26 | |
| 27 | 1. **Ask approach**: Mobile-first (min-width) or desktop-first (max-width)? |
| 28 | 2. **Ask preset or custom**: |
| 29 | - Preset: Tailwind, Bootstrap, Material, or Custom |
| 30 | - Custom: Define your own values |
| 31 | 3. **Ask steps**: How many breakpoints (4-6 typical) |
| 32 | 4. **Ask container queries**: Include container query tokens? |
| 33 | 5. **Ask format**: CSS, Tailwind, JSON, or SCSS? |
| 34 | 6. **Generate**: Create breakpoint scale with media query helpers |
| 35 | |
| 36 | ## Breakpoint Presets |
| 37 | |
| 38 | | Preset | Values | Character | |
| 39 | |--------|--------|-----------| |
| 40 | | Tailwind | 640, 768, 1024, 1280, 1536 | Content-focused | |
| 41 | | Bootstrap | 576, 768, 992, 1200, 1400 | Traditional | |
| 42 | | Material | 600, 905, 1240, 1440 | Google spec | |
| 43 | | Minimal | 640, 1024, 1440 | Simple 3-tier | |
| 44 | |
| 45 | ## Output Formats |
| 46 | |
| 47 | **CSS Custom Properties + Media Queries:** |
| 48 | ```css |
| 49 | :root { |
| 50 | --breakpoint-sm: 640px; |
| 51 | --breakpoint-md: 768px; |
| 52 | --breakpoint-lg: 1024px; |
| 53 | --breakpoint-xl: 1280px; |
| 54 | --breakpoint-2xl: 1536px; |
| 55 | } |
| 56 | |
| 57 | /* Mobile-first media queries (use with @media) */ |
| 58 | /* @media (min-width: 640px) - sm and up */ |
| 59 | /* @media (min-width: 768px) - md and up */ |
| 60 | /* @media (min-width: 1024px) - lg and up */ |
| 61 | /* @media (min-width: 1280px) - xl and up */ |
| 62 | /* @media (min-width: 1536px) - 2xl and up */ |
| 63 | ``` |
| 64 | |
| 65 | **Tailwind Config:** |
| 66 | ```js |
| 67 | module.exports = { |
| 68 | theme: { |
| 69 | screens: { |
| 70 | 'sm': '640px', |
| 71 | 'md': '768px', |
| 72 | 'lg': '1024px', |
| 73 | 'xl': '1280px', |
| 74 | '2xl': '1536px', |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | ``` |
| 79 | |
| 80 | **JSON Tokens:** |
| 81 | ```json |
| 82 | { |
| 83 | "breakpoint": { |
| 84 | "sm": { "value": "640px", "type": "dimension" }, |
| 85 | "md": { "value": "768px", "type": "dimension" }, |
| 86 | "lg": { "value": "1024px", "type": "dimension" }, |
| 87 | "xl": { "value": "1280px", "type": "dimension" }, |
| 88 | "2xl": { "value": "1536px", "type": "dimension" } |
| 89 | } |
| 90 | } |
| 91 | ``` |
| 92 | |
| 93 | **SCSS Variables + Mixins:** |
| 94 | ```scss |
| 95 | $breakpoint-sm: 640px; |
| 96 | $breakpoint-md: 768px; |
| 97 | $breakpoint-lg: 1024px; |
| 98 | $breakpoint-xl: 1280px; |
| 99 | $breakpoint-2xl: 1536px; |
| 100 | |
| 101 | @mixin sm-up { |
| 102 | @media (min-width: $breakpoint-sm) { @content; } |
| 103 | } |
| 104 | @mixin md-up { |
| 105 | @media (min-width: $breakpoint-md) { @content; } |
| 106 | } |
| 107 | @mixin lg-up { |
| 108 | @media (min-width: $breakpoint-lg) { @content; } |
| 109 | } |
| 110 | @mixin xl-up { |
| 111 | @media (min-width: $breakpoint-xl) { @content; } |
| 112 | } |
| 113 | @mixin 2xl-up { |
| 114 | @media (min-width: $breakpoint-2xl) { @content; } |
| 115 | } |
| 116 | |
| 117 | // Usage: @include md-up { .element { width: 50%; } } |
| 118 | ``` |
| 119 | |
| 120 | ## Container Queries |
| 121 | |
| 122 | Modern CSS container queries for component-level responsiveness: |
| 123 | |
| 124 | ```css |
| 125 | /* Container query breakpoints */ |
| 126 | :root { |
| 127 | --container-sm: 320px; |
| 128 | --container-md: 480px; |
| 129 | --container-lg: 640px; |
| 130 | --container-xl: 800px; |
| 131 | } |
| 132 | |
| 133 | /* Define container */ |
| 134 | .card-container { |
| 135 | container-type: inline-size; |
| 136 | container-name: card; |
| 137 | } |
| 138 | |
| 139 | /* Query container */ |
| 140 | @container card (min-width: 480px) { |
| 141 | .card-content { |
| 142 | display: grid; |
| 143 | grid-template-columns: 1fr 1fr; |
| 144 | } |
| 145 | } |
| 146 | ``` |
| 147 | |
| 148 | ## Mobile-First vs Desktop-First |
| 149 | |
| 150 | | Approach | Media Query | Write Styles For | |
| 151 | |----------|-------------|------------------| |
| 152 | | Mobile-first | `min-width` | Small screens first, enhance up | |
| 153 | | Desktop-first | `max-width` | Large screens first, reduce down | |
| 154 | |
| 155 | **Mobile-first** (recommended): |
| 156 | ```css |
| 157 | .element { width: 100%; } |
| 158 | @media (min-width: 768px) { .element { width: 50%; } } |
| 159 | @media (min-width: 1024px) { .element { width: 33%; } } |
| 160 | ``` |
| 161 | |
| 162 | **Desktop-first**: |
| 163 | ```css |
| 164 | .element { width: 33%; } |
| 165 | @media (max-width: 1023px) { .element { width: 50%; } } |
| 166 | @media (max-width: 767px) { .element { width: 100%; } } |
| 167 | ``` |
| 168 | |
| 169 | ## Best Practices |
| 170 | |
| 171 | 1. **Content-driven breakpoints**: Let content determine where layout breaks, not device sizes |
| 172 | 2. **Fewer is better**: 4-6 breakpoints handles most cases |
| 173 | 3. **Test in-between**: Don't just test at exact breakpoints |
| 174 | 4. **Use container queries** for component-level responsiveness |
| 175 | 5. **Avoid pixel-perfect**: Focus on fluid layouts between breakpoints |
| 176 | |
| 177 | ## Utility Classes (Tailwind-style) |
| 178 | |
| 179 | ```css |
| 180 | /* Visibility utilities */ |
| 181 | .hidden { display: none; } |
| 182 | .sm\:block { @media (min-width: 640px) { display: block; } } |
| 183 | .md\:hidden { @media (min-width: 768px) { display: none; } } |
| 184 | |
| 185 | /* Responsive grid */ |
| 186 | .grid-cols-1 { grid-t |