Agent skill UI design
Better Layout
Improve grouping, alignment and reading order across breakpoints, long translations and right-to-left layouts.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add jakubkrehel/skills --skill better-layout --agent claude-code --yesCheck this file in your project.claude/skills/better-layout/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add jakubkrehel/skills --skill better-layoutSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Bring the current spacing tokens, a representative long label, and the supported viewport and locale ranges.
View operation manualWhat this skill helps with
- Group related elements with spacing and align them to common edges.
- Preserve the visual and reading order when a layout stacks.
- Leave room for translated labels and mirrored layouts.
Good for
- Responsive feature sections
- Multilingual page layouts
- Skill name
- better-layout
- Workflow
- Make a list row fit long translations
- Deliverable
- A row that grows or reflows while keeping the primary control reachable.
- Skill name
better-layout- Repository
jakubkrehel/skills
Keep the request tied to one real task
A broad request
Set fixed widths on the text and action to stop them moving.
The fixed allocation can clip an actual translation or move a required action outside the visible viewport.
A checkable workflow
- Find the content width where the row breaks
- Give the text room without displacing controls
- Repeat the narrow and translated states
Better Layout operation manual
Fix one real overflow and verify the same content in wide, narrow, and mirrored layouts.
Replace the bracketed details with the component, route, or source you want to use.
Find the content width where the row breaks
Reproduce the bug with the actual label and action.
Prompt · Step 1Use better-layout to inspect [list row and preview route]. Load a real long label and action at the widest and narrowest supported sizes. Find the width where text, metadata, or controls first clip or overlap. Inspect the row’s source order, grid or flex tracks, spacing tokens, and direction-aware properties. Report a reproducible viewport and exact code location.Give the text room without displacing controls
Address the verified failure using the current spacing scale and reading order.
Prompt · Step 2Use better-layout to fix [approved row overflow] in [component path]. Reuse existing spacing tokens and preserve the DOM reading order. If an inflexible track is the cause, use the applicable minmax(0, 1fr) or min-width: 0 pattern and choose when the content should wrap or the layout collapse based on actual fit. Use logical properties for anything that mirrors. Keep full text reachable where it is truncated.Repeat the narrow and translated states
Check the same label and action around the failing width.
- The original label fits or wraps at the verified width.
- The primary action stays visible and logically ordered.
Prompt · Step 3Use better-layout to verify [changed row and original break width]. Test the same long label on both sides of the breakpoint and with one long-string locale or a pseudo-localized fixture. Inspect RTL where supported and confirm visual and DOM order agree. Verify the primary action remains reachable and record exactly which layouts, widths and locales were tested.
Find the relevant rule
Provide the actual target and point to the installed reference.
Rows break only when translatedReference
- Command or reference
spacing-and-adaptivity.md- Examples
- Test realistic long strings and identify the first width that fails.
Leading and trailing positions fail in RTLReference
- Command or reference
grouping-and-alignment.md- Examples
- Use logical properties and compare visual order with DOM order.
Better Layout troubleshooting
Should I choose breakpoints by device name?
Find where the actual content stops fitting. Reusable components can adapt to their container when the project supports it.