# layout > layout checks a repo's tree against repo.layout, a contract that reads like a directory listing, and exits 1 on drift. - [Site](https://zaydek.github.io/layout/): the pitch, an example contract and check run, install, the grammar - [Setup prompt](https://zaydek.github.io/layout/setup.md): paste it into your coding agent to set layout up in a repo - [This site as Markdown](https://zaydek.github.io/layout/index.md): the same page, for agents - [README](https://github.com/zaydek/layout/blob/main/README.md): the grammar and the commands ## Grammar ```text # Names: a regex or a cap, used below as $name $component: [A-Z][a-zA-Z0-9]* # e.g. Button, UserCard $hook: use[A-Z][a-zA-Z0-9]* # e.g. useAuth, useTheme $code: <=400 # At most 400 lines # The tree: every entry this repo may hold README.md # One: a plain name is exactly one file package.json ?CHANGELOG.md # ? marks an entry optional src/ # The app main.tsx components/ # One component per file $component.tsx $code # Many: a pattern matches any number ?$component.test.tsx # An optional test beside it hooks/ # One hook per file $hook.ts $code # A hoisted cap public/ # Static files, served as is {} # Anything goes here docs -> ../docs # A symlink ``` ## Commands ```sh layout . # Check this tree; exit 1 on drift layout lint repo.layout # Check the contract's own syntax layout format # Rewrite the contract to house style layout format --check # Exit 1 if format would change it ``` ## Install - Claude Code: `claude plugin marketplace add zaydek/layout && claude plugin install layout@layout` - Codex: `codex plugin marketplace add zaydek/layout && codex plugin add layout@layout` - OpenCode: `mkdir -p ~/.config/opencode/skills && curl -fsSL https://github.com/zaydek/layout/archive/refs/heads/main.tar.gz | tar -xz -C ~/.config/opencode/skills --strip-components=2 layout-main/skills/layout` - omp (oh-my-pi): `omp plugin marketplace add zaydek/layout && omp plugin install layout@layout`