agentleFS
NikoxkxNikoxkx/Agent-Skills/skills/web-development/responsive-layout-system/SKILL.md

responsive-layout-system

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Creates a responsive layout using CSS Grid and Flexbox with mobile-first breakpoints. Use when building page layouts that must work across all screen sizes.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 13 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When performance and simplicity are priorities over heavy layout libraries.

    line 22
  2. Distinctive:

    Create CSS custom properties for spacing scale, container widths, and breakpoints.

    line 34
  3. Distinctive:

    Use Flexbox for one-dimensional flows (navbars, toolbars, button groups, card rows).

    line 38
  4. Distinctive:

    Use Grid for two-dimensional layouts (page templates, card grids, dashboards).

    line 39
  5. Distinctive:

    Consider subgrid and masonry for modern browsers.

    line 40
  6. Distinctive:

    Write base styles for the smallest screen (usually 320-375px).

    line 43
  7. Distinctive:

    Never hide critical content on mobile.

    line 45
  8. Very specific:

    Use @container for components that should adapt to their parent width rather than viewport.

    line 48
  9. Very specific:

    Use env(safe-area-inset-*) for mobile devices.

    line 59
  10. Distinctive:

    Test on iPhone with notch/dynamic island.

    line 60
  11. Very specific:

    Very narrow screens (320px): Ensure no horizontal scroll.

    line 112
  12. Distinctive:

    Container vs viewport: Prefer container queries for cards/grids that live in sidebars.

    line 113
  13. Distinctive:

    Use DevTools device toolbar for iPhone, iPad, desktop.

    line 121
  14. Distinctive:

    Test with real devices if possible.

    line 122
  15. Distinctive:

    Run Lighthouse — no layout shift issues (CLS < 0.1).

    line 123
  16. Distinctive:

    Check that all content remains accessible and no overflow at any size.

    line 124

≈ “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

Overview

Designs and implements robust, maintainable responsive page and component layouts using modern CSS (Grid for 2D, Flexbox for 1D), mobile-first methodology, CSS custom property design tokens for spacing and breakpoints, container queries where appropriate, and common layout patterns (sidebar, holy grail, masonry, dashboard).

When to Use This Skill

  • Building the overall page layout or major sections (header, hero, main content, sidebar, footer).
  • The user mentions "responsive", "mobile first", "works on all screen sizes", or provides a wireframe that needs to adapt.
  • Creating reusable layout primitives for a design system.
  • When performance and simplicity are priorities over heavy layout libraries.

Prerequisites

  • CSS file or Tailwind setup in the project.
  • Understanding of viewport vs container queries.
  • Target breakpoints defined (or the skill will propose sensible ones: 640, 768, 1024, 1280).
  • For advanced masonry or subgrid, modern browser support or fallbacks.

Steps

  1. Define design tokens:
    • Create CSS custom properties for spacing scale, container widths, and breakpoints.
    • Example: --space-4: 1rem; --container-max: 1280px;
  2. Choose layout primitives:
    • Use Flexbox for one-dimensional flows (navbars, toolbars, button groups, card rows).
    • Use Grid for two-dimensional layouts (page templates, card grids, dashboards).
    • Consider subgrid and masonry for modern browsers.
  3. Apply mobile-first:
    • Write base styles for the smallest screen (usually 320-375px).
    • Layer improvements with min-width media queries.
    • Never hide critical content on mobile; use progressive disclosure instead.
  4. Implement container queries (preferred for components):
    • Use @container for components that should adapt to their parent width rather than viewport.
    • Fallback to media queries when container queries are not supported.
  5. Build common patterns:
    • Holy grail (header, sidebar, main, footer)
    • Sidebar + content (collapsible on mobile)
    • Masonry grid
    • Dashboard (multiple resizable panels)
    • Sticky header + scrollable content area
  6. Handle safe areas and notches:
    • Use env(safe-area-inset-*) for mobile devices.
    • Test on iPhone with notch/dynamic island.
  7. Add debug helpers (optional but useful):
    • A temporary outline or grid overlay toggle for development.
  8. Output:
    • Complete CSS (or Tailwind config + component classes).
    • HTML structure example.
    • Responsive demo notes.

Examples

Example: Holy Grail Layout with Sidebar

:root {
  --sidebar-width: 280px;
  --header-height: 64px;
}

.layout {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer footer";
  grid-template-rows: var(--header-height) 1fr auto;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100dvh;
}

@media (max-width: 768px) {
  .layout {
    grid-template-areas:
      "header"
      "main"
      "footer";
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; } /* or use a drawer pattern */
}

.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.main { grid-area: main; }
.footer { grid-area: footer; }

Full HTML + more patterns (masonry using grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) with masonry-auto-flow or JS fallback) included in the skill output.

Edge Cases & Error Handling

  • Very narrow screens (320px): Ensure no horizontal scroll. Use overflow-x: hidden on body and test all components.
  • Container vs viewport: Prefer container queries for cards/grids that live in sidebars.
  • Print styles: Provide a separate print stylesheet or @media print rules that collapse sidebars and optimize for paper.
  • High zoom levels: Layouts must not break at 200%+ zoom (reflow, not zoom).
  • Dynamic content: Account for variable height headers/footers using min-height: 100dvh and grid.

Verification

  1. Open the layout in browser and resize from 320px to 1920px.
  2. Use DevTools device toolbar for iPhone, iPad, desktop.
  3. Test with real devices if possible.
  4. Run Lighthouse — no layout shift issues (CLS < 0.1).
  5. Check that all content remains accessible and no overflow at any size.
  6. Success: Layout adapts gracefully, no horizontal scroll, content hierarchy preserved on mobile.

References

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.