agentleFS
ArnavPuriArnavPuri/designskills/skills/layout-composition/SKILL.md

layout-composition

Skill17 starsChanged 8 months agoMITView on GitHub

Grid systems, visual hierarchy, whitespace, and modern CSS layout patterns (grid, flexbox, bento, container queries) for web pages and UI. Use when arranging content on a page or screen. For spacing/radius tokens themselves use design-system; for slide layouts use presentation-design. Trigger phrases: "layout", "grid", "bento grid", "visual hierarchy", "page layout", "flexbox layout", "whitespace", "responsive layout", "composition", "css grid", "container queries"

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read .agents/design-context.md (see design-context) for Spacing System (4px/8px base), Border Radius, style archetype, and platform …

    line 19
  2. Distinctive:

    Place focal points at 1/3 intersections, not dead center.

    line 181
  3. Distinctive:

    Never ship a layout you haven't looked at.

    line 261

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Layout and Composition

Build structured, visually compelling layouts using modern CSS.

Prerequisites

  • Read .agents/design-context.md (see design-context) for Spacing System (4px/8px base), Border Radius, style archetype, and platform priority. Spacing tokens below follow the design-system scale (--space-N = N × 4px); colors use the shared --brand-* / --gray-* primitives from color-palette.
  • Identify the content types (text-heavy, media-heavy, dashboard, marketing) to choose the right patterns.

Step 1: CSS Grid Patterns

12-Column Grid

.grid-12 {
  display: grid; grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem; max-width: 1280px; margin-inline: auto; padding-inline: 1.5rem;
}
.col-full    { grid-column: 1 / -1; }
.col-half    { grid-column: span 6; }
.col-third   { grid-column: span 4; }
.col-quarter { grid-column: span 3; }
@media (max-width: 768px) { .grid-12 > * { grid-column: 1 / -1; } }

Auto-Fit Grid (no media queries needed)

.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

Named Grid Areas

.page-layout {
  display: grid; grid-template-columns: 250px 1fr 300px;
  grid-template-rows: auto 1fr auto; min-height: 100dvh;
  grid-template-areas: "header header header" "sidebar main aside" "footer footer footer";
}
.header { grid-area: header; } .sidebar { grid-area: sidebar; }
.main { grid-area: main; } .aside { grid-area: aside; } .footer { grid-area: footer; }
@media (max-width: 1024px) {
  .page-layout { grid-template-columns: 1fr; grid-template-areas: "header" "main" "sidebar" "aside" "footer"; }
}

Step 2: Flexbox Layout Patterns

Navbar

.navbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; gap: 2rem; }

Centered Content Page

.centered-page { display: flex; flex-direction: column; align-items: center; min-height: 100dvh; }
.centered-page main { flex: 1; width: 100%; max-width: 65ch; padding: 2rem; }

Card Row with Equal Heights

.card-row { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.card-row > * { flex: 1 1 260px; display: flex; flex-direction: column; } /* wraps instead of squashing on mobile */
.card-row .card-footer { margin-top: auto; }

Step 3: Bento Grid Layouts

Basic Bento

.bento { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 200px; gap: 1rem; }
.bento-large { grid-column: span 2; grid-row: span 2; }
.bento-wide  { grid-column: span 2; }
.bento-tall  { grid-row: span 2; }

Feature Showcase Bento

.bento-showcase {
  display: grid; grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 180px); gap: 1rem; padding: 1rem;
}
.bento-showcase > :nth-child(1) { grid-column: 1 / 4; grid-row: 1 / 3; }
.bento-showcase > :nth-child(2) { grid-column: 4 / 7; grid-row: 1 / 2; }
.bento-showcase > :nth-child(5) { grid-column: 1 / 3; grid-row: 3 / 5; }
.bento-showcase > * { border-radius: 1rem; padding: 1.5rem; overflow: hidden; background: var(--gray-100); }
@media (max-width: 768px) {
  .bento-showcase { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .bento-showcase > * { grid-column: auto !important; grid-row: auto !important; }
}

Bento Card Styling

.bento-card { border-radius: 1.25rem; padding: 2rem; overflow: hidden; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.bento-card--gradient { background: linear-gradient(135deg, var(--brand-100), var(--brand-50)); }
.bento-card--dark { background: var(--gray-900); color: var(--gray-50); }

Step 4: Whitespace as a Design Element

Spacing Scale

Same scale as the design-system skill: --space-N = N × 4px. Do not redefine it if the project already has one.

:root {
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;
}
section { padding-block: clamp(4rem, 8vw, 8rem); }
.hero { padding-block: clamp(6rem, 12vw, 12rem); }

Density Guidelines

  • Dense UI (dashboards): 4-8px gaps, 12-16px padding
  • Standard UI (apps): 8-16px gaps, 16-24px padding
  • Marketing / editorial: 16-32px gaps, 32-64px section padding
  • Luxury / premium: double everything

Step 5: Visual Hierarchy Techniques

Ranked by impact (strongest to weakest):

  1. Size -- Make the most important element the largest
  2. Color and Contrast -- High contrast draws the eye; brand color for CTAs, muted grays for secondary
  3. Weight and Typeface -- Bold signals importance
  4. Position -- Top-left gets read first (LTR); place key content above the fold
  5. Proximity and Grouping -- Related items close together, clear separation for unrelated
  6. Negative Space -- Whitespace increases visual weight

Section Header Pattern

.section-header { max-width: 600px; margin-inline: auto; text-align: center; margin-bottom: var(--space-16); }
.section-label { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-600); margin-bottom: var(--space-3); } /* 600: small text needs 4.5:1 */
.section-title { font-size: var(--text-4xl); font-weight: 800; line-height: 1.1; color: var(--gray-900); margin-bottom: var(--space-4); }
.section-description { font-size: var(--text-lg); color: var(--gray-500); line-height: 1.6; }

Step 6: Reading Patterns

F-Pattern (Text-Heavy Pages)

Users scan across the top, partway across the middle, then down the left. Place key info in first two paragraphs, start sections with bold keywords, use left-aligned headings.

Z-Pattern (Landing Pages)

Users scan: top-left logo > top-right nav > diagonal to center CTA > bottom. Build landing pages along this diagonal.


Step 7: Rule of Thirds and Asymmetric Layouts

Place focal points at 1/3 intersections, not dead center. Slightly off-center placement feels more dynamic.

.hero-content { display: grid; grid-template-columns: 2fr 1fr; align-items: center; min-height: 80vh; }

Asymmetric Split (60/40)

.asymmetric { display: grid; grid-template-columns: 1.5fr 1fr; gap: 4rem; align-items: center; }
.asymmetric--reversed { grid-template-columns: 1fr 1.5fr; }

Offset Grid

.offset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.offset-grid > :nth-child(3n+2) { transform: translateY(3rem); }
.offset-grid { padding-bottom: 3rem; } /* transform doesn't reserve space */
@media (max-width: 768px) { .offset-grid { grid-template-columns: 1fr; } .offset-grid > * { transform: none; } }

Step 8: Responsive Strategies

Stack Pattern (auto-responsive)

.layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)); gap: 1.5rem; }

Reflow Pattern

.reflow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 768px) { .reflow { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .reflow { grid-template-columns: 1fr; } }

Step 9: Container Query Layouts

.card-container { container-type: inline-size; container-name: card; }
.card { display: flex; flex-direction: column; }
@container card (min-width: 500px) {
  .card { flex-direction: row; align-items: center; gap: 2rem; }
  .card-image { flex: 0 0 200px; }
}

Step 10: Aspect Ratio for Consistent Media

.thumbnail { aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0.75rem; width: 100%; }
.avatar { aspect-ratio: 1; object-fit: cover; border-radius: 50%; }
/* Common ratios: 1:1 avatars, 4:3 cards, 16:9 video, 3:2 photos, 21:9 cinematic */

Quick Reference: Layout Selection Guide

Content typeRecommended layout
Landing pageSingle column + full-width sections
Blog / articleCentered single column, max 65ch
Dashboard12-column grid or sidebar + main
Feature showcaseBento grid
Card listingAuto-fit grid
PortfolioMasonry or offset grid
DocumentationSidebar nav + centered content
E-commerce product2-col asymmetric (image + details)

Verify the Layout

Never ship a layout you haven't looked at. Render the page and screenshot it at three widths, then view each image with Read:

for w in 375 768 1440; do
  npx playwright screenshot --full-page --viewport-size=$w,900 "file://$PWD/index.html" layout-$w.png
done

Check each screenshot for: one clear focal point per section, consistent left edges and gutters, no horizontal overflow (in the browser: document.documentElement.scrollWidth > innerWidth must be false), sensible stacking order on mobile (DOM order = reading order; don't reorder visually with order/grid placement in a way that breaks keyboard tab order), and no orphaned single card on the last grid row. Fix and re-screenshot until clean.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.