adaptive-layout-and-spacing
Skill0 starsChanged 22 days agoMITView on GitHub
Use when laying out a screen, setting spacing and grids, handling notches and safe areas, adapting a phone design to tablet, foldable or desktop, choosing breakpoints or size classes, or fixing a layout that breaks with large text or rotation. Covers hierarchy, grouping, safe areas, edge-to-edge, size classes and reflow. Do not use for navigation structure (navigation-and-flows), colour and type (visual-design-system) or writing layout code.
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessible-designSkill
- ai-interface-designSkill
- interaction-feedback-and-formsSkill
- mobile-ux-foundationsSkill
- navigation-and-flowsSkill
- ui-ux-designerSkill
- ux-documentation-and-handoffSkill
- ux-review-and-testingSkill
- visual-design-systemSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Keep functionality the same across sizes.
- Distinctive: line 38
Group and align: Use space, containers or separators for related items.
- Distinctive: line 39
Place for the thumb: Put frequent actions in the lower middle.
- Distinctive: line 41
Adapt by size class: Use size-classes.md: compact (one column, bottom bar), medium (rail or two panes), expanded and larger (list-detail, …
- Distinctive: line 43
Verify: Test rotation, split screen, largest text size, 320 CSS px width, and with the keyboard open.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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.
Files
Adaptive Layout and Spacing
Stance: frozen are the information hierarchy, the full set of functions on every size, and respect for safe areas. Flexible are columns, panes and how much is shown at once.
Hard rules
- Order by importance: key content at the top and leading edge. Mechanism: people read top to bottom from the leading side, so late placement means missed content.
- Keep functionality the same across sizes; change only how much is visible. Mechanism: a feature that exists on desktop but not on phone splits support and trust (Apple HIG).
- Design for the window, not the device. Mechanism: split screen, desktop windows, rotation and folding change available space at any time; use size classes, not device names (Android).
- Respect safe areas and system bars. Mechanism: content under the notch, status bar or gesture bar is unreadable or untappable. Inset content, keep targets out of the gesture inset.
- Layout must survive large text and 320 CSS px width without two-direction scrolling. Mechanism: WCAG 1.4.10 reflow; fixed-height boxes clip enlarged text.
- Cap line length on wide screens. Mechanism: lines across a desktop are hard to track; use a readable text width.
- Act only on what the user asked. Before answering or changing anything, open the relevant files and check what is already done; report only what you checked, never guess, and do not redo finished work. Reason: guesses and repeated work waste the user's credit.
Gate
| Situation | Action |
| Small spacing or alignment tweak | Fix in place, no redesign |
| Layout fails at one size class | Fix that class, check the others |
| New screen | Phone layout first, then medium and expanded |
| Request to hide features on small screens | Decline; move them behind progressive disclosure instead |
Steps
- Rank content. List the elements on the screen and order by importance. Mark the primary action.
- Group and align. Use space, containers or separators for related items. Align edges; indent only to show hierarchy. Use one spacing scale (multiples of 4 or 8) throughout.
- Place for the thumb. Put frequent actions in the lower middle; keep destructive actions away from easy-hit spots. Treat reach as a heuristic: grips vary.
- Apply safe areas. Pad for status bar, notch, home indicator, tab bar and keyboard. Draw backgrounds edge to edge, keep controls inside.
- Adapt by size class. Use size-classes.md: compact (one column, bottom bar), medium (rail or two panes), expanded and larger (list-detail, sidebar, multi-column). Check height too for landscape phones and folded postures.
- Add desktop behaviour. Pointer hover as an extra, visible focus, keyboard shortcuts as extras, resizable windows.
- Verify. Test rotation, split screen, largest text size, 320 CSS px width, and with the keyboard open.
Checklist (copy into the reply and tick as you go)
- [ ] Content ranked; primary action obvious
- [ ] One spacing scale used
- [ ] Safe areas and keyboard handled
- [ ] Compact, medium and expanded layouts described
- [ ] Same functions at every size
- [ ] Large text and 320 CSS px tested or listed as untestedExamples
Example 1: phone to tablet User says: "Our order list looks stretched on iPad." Actions: identify the window width class; keep the list as the leading pane; add a detail pane on the trailing side; keep the same actions; cap text width. Result: a two-pane list-detail layout at medium width and above, one column on phones.
Example 2: hiding features User says: "Remove the filters on mobile, nobody uses them there." Actions: ask for evidence; explain that removal splits behaviour across sizes; propose filters behind a button opening a sheet. Result: filters remain available, with the screen kept clean.
Common issues
- Content hidden behind the bottom bar. Cause: no bottom inset. Fix: pad scrollable content by the bar height plus the safe area.
- Fields hidden by the keyboard. Cause: layout ignores keyboard insets. Fix: scroll the focused field into view and resize the layout.
- Clipped labels at large text. Cause: fixed heights. Fix: let rows grow, wrap text, test at the largest size.
References
- size-classes.md: breakpoints, layout per class and desktop notes.
Next
navigation-and-flows for how navigation changes by size; accessible-design for targets and text scaling.
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
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.

