grid-systems/SKILL.md
Use when laying out any screen, page, dashboard, or editorial surface that needs disciplined alignment, rhythm, and proportion. Covers Swiss-style grid construction (manuscript, column, modular, baseline, hierarchical), column math, baseline grids, type-on-grid alignment, image-field alignment, and mapping these to 4/8/12-col responsive web and mobile grids. Load alongside practical-ui-design and responsive-design whenever layout discipline matters.
npx skillsauth add peterbamuhigire/skills-web-dev grid-systemsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
practical-ui-design, responsive-design, webapp-gui-design, swiftui-design, jetpack-compose-ui, or healthcare-ui-design and want their visual tokens to sit on a real grid.jetpack-compose-ui, swiftui-design, webapp-gui-design) already encodes a fixed grid and the task is only to use it; load this skill only when the grid itself is being chosen or stress-tested.references/01-grid-types.md.references/02-column-math.md.references/03-baseline-grid.md.references/04-responsive-mapping.md.references/07-checklist.md (squint test, module fidelity, baseline alignment, no orphans).line-height values that break baseline rhythm; headings must sit on N baseline units.margin: auto for layout without a container max-width tied to line-length.references/01-grid-types.md — manuscript, column, modular, baseline, hierarchical grids; when each applies; detection.references/02-column-math.md — formulae for column width, gutter, margin; worked desktop/tablet/mobile examples; fluid grids and container queries.references/03-baseline-and-type.md — vertical rhythm, type-on-grid alignment, spacing-scale derivation, cap-height compensation.references/04-responsive-and-hierarchy.md — 12/8/4-col responsive ladder, collapse rules, container queries, hierarchy through span and whitespace, focal points.references/05-examples-and-checklist.md — worked examples (editorial, dashboard, landing, mobile feed, chart) and the grid review checklist + launch gate.A grid is a repeating system of reference lines that keeps type, image, and space in predictable proportion. In Swiss typography (Müller-Brockmann) the grid is built from:
page format -> type area -> margins -> columns -> modules -> gutters -> baseline -> fields
line-height that carry vertical rhythm.Digital adapts this: margin, gap, and grid-template-columns map directly to margin, gutter, and columns. Baseline rhythm maps to line-height and padding multiples.
Pick the grid type before touching CSS. Load references/01-grid-types.md for trade-offs.
| Surface | Grid Type | Typical Columns | Body Line Length | |---|---|---|---| | Long-form article, essay, documentation | Manuscript + optional 2-col | 1 (text) + 1 (notes) | 60-75ch | | Magazine, editorial, marketing site | Column (2-6) | 2, 3, 4, 5, 6 | 45-75ch | | SaaS app, dashboard, admin panel | Modular refined 12-col | 12 (24 sub) | 40-60ch in panels | | Data-dense analytics, charts, tables | Modular 12 or 24-col | 12 or 24 | n/a | | Product landing hero + sections | Hierarchical (hero) + 12-col below | 12 | 50-70ch | | Mobile feed, card list, POS screen | 4-col | 4 | 30-50ch | | Tablet app | 8-col | 8 | 40-60ch |
baseline = body line-height. Example: body 16px, line-height 1.5 = 24px -> baseline 8pt (24 is a clean multiple of 8).For a container width W, column count n, gutter g, side margin m:
usable = W - 2 * m
columnWidth = (usable - (n - 1) * g) / n
Worked common values (desktop-first, 8pt scale):
| Container | Columns | Gutter | Margin | Column Width | |---|---|---|---|---| | 1440 | 12 | 32 | 96 | 88 | | 1280 | 12 | 24 | 64 | 80.67 | | 1024 | 8 | 24 | 48 | 99 | | 768 | 8 | 16 | 32 | 72 | | 390 (iPhone) | 4 | 16 | 16 | 79.5 | | 360 (Android) | 4 | 16 | 16 | 72 |
Full derivations, non-square containers, and asymmetrical layouts: references/02-column-math.md.
:root {
--baseline: 8px;
--grid-cols: 12;
--grid-gap: calc(var(--baseline) * 4); /* 32 */
--grid-margin: calc(var(--baseline) * 12); /* 96 on wide desktop */
--container-max: 1440px;
}
.grid {
display: grid;
grid-template-columns: repeat(var(--grid-cols), 1fr);
gap: var(--grid-gap);
max-width: var(--container-max);
padding-inline: var(--grid-margin);
margin-inline: auto;
}
@media (max-width: 1024px) {
:root { --grid-cols: 8; --grid-gap: 24px; --grid-margin: 48px; }
}
@media (max-width: 640px) {
:root { --grid-cols: 4; --grid-gap: 16px; --grid-margin: 16px; }
}
Tailwind analogue:
<div class="mx-auto max-w-[1440px] px-24 grid grid-cols-12 gap-8
lg:px-12 lg:gap-6 md:grid-cols-8 md:px-8 md:gap-4 sm:grid-cols-4">
<article class="col-span-8">...</article>
<aside class="col-span-4">...</aside>
</div>
SwiftUI analogue (4-col mobile, 8-col tablet):
let columns: [GridItem] = Array(
repeating: GridItem(.flexible(), spacing: 16),
count: horizontalSizeClass == .regular ? 8 : 4
)
LazyVGrid(columns: columns, spacing: 16) { /* cells */ }
.padding(.horizontal, 16)
Jetpack Compose:
LazyVerticalGrid(
columns = GridCells.Fixed(if (isTablet) 8 else 4),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(16.dp),
) { /* items */ }
line-height = baseline unit (or 2x baseline); do not invent fractional values.line-height in integer baseline multiples. Round up, never down.padding-top absorbs the difference between cap-height and x-height if needed).Details, cap-height compensation, and fluid scaling: references/03-baseline-grid.md.
4*80 + 3*24 = 392px wide; pick image aspect (e.g. 16:9 -> 220.5px ~ 220px height, re-snap to baseline).Size and span, not decoration, create editorial hierarchy:
Deeper patterns: references/05-hierarchy-through-grid.md.
| Breakpoint | Columns | Gutter | Margin | Notes | |---|---|---|---|---| | >= 1440 | 12 | 32 | 96 | Full editorial / app canvas | | 1024-1439 | 12 | 24 | 64 | Compact desktop | | 768-1023 | 8 | 24 | 48 | Tablet landscape; collapse 3-col into 2-col | | 640-767 | 8 | 16 | 32 | Tablet portrait | | 375-639 | 4 | 16 | 16 | Phone; single-column stacks are common | | < 375 | 4 | 12 | 12 | Small phones (iPhone SE) |
Content-query patterns (container queries) for component-level grids: references/04-responsive-mapping.md.
line-height is an integer baseline multiple.| Skill | When to Load |
|---|---|
| practical-ui-design | Visual tokens — colour, typography, spacing — that ride on this grid. |
| responsive-design | Breakpoint philosophy, container queries, pointer/hover detection. |
| webapp-gui-design | Tabler/Bootstrap web apps needing 12-col grid enforcement. |
| swiftui-design / ios-development | iOS layouts using LazyVGrid and GridItem. |
| jetpack-compose-ui / android-development | Android layouts using LazyVerticalGrid. |
| healthcare-ui-design | High-density clinical screens built on refined 24-col modular grids. |
| design-audit | Runs grid adherence as part of the UI quality audit. |
| data-visualization | Chart composition on a shared grid for dashboards. |
| mobile-reports / mobile-report-tables | Table and report rhythm on 4-col phones. |
Josef Müller-Brockmann, Grid Systems in Graphic Design (1981). Adapted for digital screens with guidance from Swiss modernist typography, Bringhurst's Elements of Typographic Style, Material Design, Apple Human Interface Guidelines, and the 8pt/4pt community spacing conventions.
data-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...