Layout Grid logo

Layout Grid

Community
daveebbelaar
layout-grid

Grid and alignment rules for a macOS SwiftUI app, with three checks that catch misalignment (a lint for off-grid numbers, a layout probe that measures real frames in snapshot mode, and a grid overlay). Use when building or reviewing a custom page, card, row, form, or sheet, after every build that touched layout, or when the user says something looks misaligned, crooked, cramped, or unevenly spaced.

Overview

Publisherdaveebbelaar
Repositorybama
Skill namelayout-grid
Stars
952
Forks
136
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by daveebbelaar on GitHub. Read the source before you install it.

Installation

Install the Layout Grid AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/daveebbelaar/bama/tree/main/skills/design/layout-grid
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/daveebbelaar/bama.git /tmp/bama
mkdir -p .claude/skills
cp -r /tmp/bama/skills/design/layout-grid .claude/skills/layout-grid
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Layout Grid in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Layout Grid on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Layout Grid is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Layout grid

Agents guess numbers. A guessed .padding(13) looks almost right and makes the whole app feel slightly off. This skill replaces guessing with one scale and three checks that fail when something is off.

The template has everything in place: Sources/<App>/UI/Grid.swift and tools/. For an app made before this skill, copy UI/Grid.swift, tools/grid-lint.sh, and tools/check-layout.swift from the new-mac-app skill's template, and the layout file line from its Snapshot.swift.

The rules

  1. Every padding, spacing, and size comes from Space: xs 4, sm 8, md 12, lg 16, xl 20, xxl 24, section 32. Raw numbers are 0, 1, 2, or a multiple of 4.
  2. Pages and windows have a 20 pt margin (Space.margin). Cards pad 16 (Space.lg). Related controls sit 8 apart, groups 20 to 24, sections 32.
  3. Each column has one leading edge. Titles, text, cards, and buttons in a column start on the same x. Indent on purpose, by a step of the scale.
  4. Let containers do the aligning:
    • Labels with controls: Form with .formStyle(.grouped), or .columns for the Mac layout of right-aligned labels.
    • Rows and columns of values: Grid and GridRow.
    • A label with a value: LabeledContent.
    • Text of different sizes in one row: HStack(alignment: .firstTextBaseline).
    • Numbers in a column: .monospacedDigit(), trailing aligned.
    • An icon with text: Label.
  5. Sheets are 360, 480, or 640 wide. Controls take their height from .controlSize, never from a fixed height.
  6. Nested corners are concentric: inner radius = outer radius - padding.
  7. .offset and .position move a view after layout, so nothing lines up with it. Use them only for motion and drag previews, with // grid: ok <why> on the line.
  8. Long text truncates with its full value in a tooltip. Nothing clips.

Check 1: lint the code

Run it after every build that touched views:

bash
tools/grid-lint.sh
# Sources/Tasks/TaskRow.swift:14: off grid (10): .padding(.horizontal, 10)
# FAIL grid-lint: 1 lines off the grid

Fix each line with a Space token.

Check 2: probe the real layout

Mark what you lay out yourself: the page, its sections, cards, rows in a card, sheet content. System lists, forms, sidebars, and toolbars align themselves and need no probes.

swift
VStack(alignment: .leading, spacing: Space.xxl) {
    Text("Today").gridProbe("title", area: "page")
    StatsRow().gridProbe("stats", area: "page")
    TaskCard()
        .gridArea("card", inset: Space.lg)
        .gridProbe("card", area: "page")
}
.padding(Space.margin)
.gridArea("page")

.gridArea marks a container and its inset. .gridProbe marks a view in it. Probes with the same edge (default "lead") must share one leading edge. Pass edge: nil for views that sit side by side.

Snapshot mode writes a <page>-<mode>-layout.json next to every PNG. Check them:

bash
swift tools/check-layout.swift /tmp/<App>-shots/*-layout.json
# PASS today-light-layout.json: 12 probes in 2 areas
# FAIL inbox-light-layout.json
#   - edge page/lead has 2 leading edges: title 320, list 324

It checks that every probe:

  1. Starts on a whole or half point, so its edges stay sharp.
  2. Starts a multiple of 4 pt from its area's edge.
  3. Stays inside its area's inset on both sides.
  4. Shares one leading edge with the others on its edge.
  5. Sits a multiple of 4 pt below the probe above it.
  6. Never overlaps another probe in its area.

Check 3: look at the grid

When a check fails and the cause is not clear, draw the grid over the window:

bash
APP_GRID=1 APP_STORE=/tmp/<App>-test.store APP_SNAPSHOT=/tmp/<App>-grid \
  ~/Applications/<App>.app/Contents/MacOS/<App>

The PNGs show an 8 pt grid, each area in blue with its inset dashed, and each probe in pink with its name. Open them with the Read tool.

Fix a failure

MessageUsual causeFix
starts 23 pt into pagea raw padding on one childremove it, use the stack's Space padding
2 leading edgesa centered stack, or one child with extra paddingalignment: .leading on the stack
gap 10 ptspacing: 10, or a Spacer(minLength:)a Space token
inside its 20 pt inseta missing margin, or a fixed width wider than the parent.padding(Space.margin), maxWidth instead of width
overlap.offset, .position, or a fixed heightremove it, let the stack size the view
x between pixelsa fractional numbera whole number from Space

Done when tools/grid-lint.sh passes, tools/check-layout.swift passes on the layout files of every page you touched, and every custom page and card has a .gridArea with probes on its main parts.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Layout Grid AI skill do?

Grid and alignment rules for a macOS SwiftUI app, with three checks that catch misalignment (a lint for off-grid numbers, a layout probe that measures real frames in snapshot mode, and a grid overlay). Use when building or reviewing a custom page, card, row, form, or sheet, after every build that touched layout, or when the user says something looks misaligned, crooked, cramped, or unevenly spaced.

Why use Layout Grid on TypingMind?

Because you install it once and use it with any model. Layout Grid is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Layout Grid in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/daveebbelaar/bama/tree/main/skills/design/layout-grid. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Layout Grid?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Layout Grid?

As many as you like. As long as a model supports skills, you can use Layout Grid with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Layout Grid AI skill free?

Yes. It is published on GitHub by daveebbelaar under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇