Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
One-time setup that gathers your project's design context and saves it to CLAUDE.md for future sessions.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/spatial-design.md
1# Spatial Design23## Spacing Systems45### Use 4pt Base, Not 8pt678pt systems are too coarse; you'll frequently need 12px (between 8 and 16). Use 4pt for granularity: 4, 8, 12, 16, 24, 32, 48, 64, 96px.89### Name Tokens Semantically1011Name by relationship (`--space-sm`, `--space-lg`), not value (`--spacing-8`). Use `gap` instead of margins for sibling spacing; it eliminates margin collapse and cleanup hacks.1213## Grid Systems1415### The Self-Adjusting Grid1617Use `repeat(auto-fit, minmax(280px, 1fr))` for responsive grids without breakpoints. Columns are at least 280px, as many as fit per row, leftovers stretch. For complex layouts, use named grid areas (`grid-template-areas`) and redefine them at breakpoints.1819## Visual Hierarchy2021### The Squint Test2223Blur your eyes (or screenshot and blur). Can you still identify:24- The most important element?25- The second most important?26- Clear groupings?2728If everything looks the same weight blurred, you have a hierarchy problem.2930### Hierarchy Through Multiple Dimensions3132Don't rely on size alone. Combine:3334| Tool | Strong Hierarchy | Weak Hierarchy |35|------|------------------|----------------|36| **Size** | 3:1 ratio or more | <2:1 ratio |37| **Weight** | Bold vs Regular | Medium vs Regular |38| **Color** | High contrast | Similar tones |39| **Position** | Top/left (primary) | Bottom/right |40| **Space** | Surrounded by white space | Crowded |4142**The best hierarchy uses 2-3 dimensions at once**: A heading that's larger, bolder, AND has more space above it.4344### Cards Are Not Required4546Cards are overused. Spacing and alignment create visual grouping naturally. Use cards only when content is truly distinct and actionable, items need visual comparison in a grid, or content needs clear interaction boundaries. **Never nest cards inside cards.** Use spacing, typography, and subtle dividers for hierarchy within a card.4748## Container Queries4950Viewport queries are for page layouts. **Container queries are for components**:5152```css53.card-container {54container-type: inline-size;55}5657.card {58display: grid;59gap: var(--space-md);60}6162/* Card layout changes based on its container, not viewport */63@container (min-width: 400px) {64.card {65grid-template-columns: 120px 1fr;66}67}68```6970**Why this matters**: A card in a narrow sidebar stays compact, while the same card in a main content area expands automatically, without viewport hacks.7172## Optical Adjustments7374Text at `margin-left: 0` looks indented due to letterform whitespace; use negative margin (`-0.05em`) to optically align. Geometrically centered icons often look off-center; play icons need to shift right, arrows shift toward their direction.7576### Touch Targets vs Visual Size7778Buttons can look small but need large touch targets (44px minimum). Use padding or pseudo-elements:7980```css81.icon-button {82width: 24px; /* Visual size */83height: 24px;84position: relative;85}8687.icon-button::before {88content: '';89position: absolute;90inset: -10px; /* Expand tap target to 44px */91}92```9394## Depth & Elevation9596Create semantic z-index scales (dropdown → sticky → modal-backdrop → modal → toast → tooltip) instead of arbitrary numbers. For shadows, create a consistent elevation scale (sm → md → lg → xl). **Key insight**: Shadows should be subtle. If you can clearly see it, it's probably too strong.9798---99100**Avoid**: Arbitrary spacing values outside your scale. Making all spacing equal (variety creates hierarchy). Creating hierarchy through size alone - combine size, weight, color, and space.101