CSS Flexbox Layout Optimizer skill for Claude and Codex
Delivers a mobile-first Flexbox column grid that holds the column count you choose on wide screens and collapses cleanly on narrow ones, with an optional…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a responsive multi-column grid needs mobile-first Flexbox CSS with a chosen column count, gap, alignment, and an optional float fallback. Do not use for single-row component layouts, CSS Grid layouts, or fixing an existing grid that breaks. Related topics: coding, css.
What it will ask you for
- Maximum container width (px) (number from 320 to 1920)
- Number of columns at full width (choose one: 1, 2, 3, 4, 5, 6)
- Gap size (free text, e.g. "1rem or 16px")
- Alignment mode (choose one: stretch, center, start, end, space-between, space-around)
- Wrap behaviour (choose one: wrap, nowrap)
- Include float-based fallback (choose one: Yes, No)
How it works
- Write the mobile-first base rule (single column) and the media queries that step the column count up to the chosen number across the container range.
- Compute flex-basis from the column count and gap with calc so gutters stay constant, and apply the alignment mode to its correct axis.
- Handle the wrap setting: add a min-width on items when nowrap is chosen and state what overflows.
- Add the float fallback behind @supports not (display: flex) with a clearfix when requested, matching the column widths.
- Comment every rule and build the settings table, noting any value chosen on the user's behalf.
What you get
A fenced css block with the commented, mobile-first grid rules (plus the fallback when requested), followed by a Markdown table listing each setting and the value used.
What it watches out for
- Using percentage widths without subtracting the gap, so the last column wraps on wide screens.
- Writing desktop-first media queries, which makes the mobile layout the exception and inflates the stylesheet.
- Shipping a float fallback without @supports, so modern browsers apply both and columns double up.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.