Skip to content

Working with coding agents

Gantry ships agent skills: short runbooks that teach a coding agent (Claude Code, Cursor, Copilot, Codex, Gemini or Aider) how to read your design records before it changes a UI, and how to edit them without breaking them. Each release of the gantry binary carries the skills that match its own commands and lint rules, and gantry skills install writes them where each agent looks.

This guide covers what the skills do, how to install them, the hooks that lint after an agent’s edits, the MCP server that gives an agent typed tools over the records, how Gantry avoids overwriting your own changes, and how to update after an upgrade.

Skill The agent uses it when
gantry it is about to change or review a UI. It reads the ruling for the pattern, its cell for the platform, the platform primer and the open defects, and keeps every edit to the records formatted and lint-clean.
gantry-file a screenshot or report disagrees with a ruling. It classifies the disagreement, records the screenshot as evidence and files the defect with its frames.
gantry-close a fix has landed. It discharges what the defect owes (an assertion, a primer line, a gate check or an amendment), closes it and lints.
gantry-pass you run a design pass. It creates the pass, ingests the captures and reads every frame against its ruling, filing a defect for each disagreement.
gantry-amend a ruling changes. It writes the amendment with what it replaces, the assertions that hold the new answer and the evidence behind it.
gantry-adopt you bring an existing ledger and defect log into Gantry, in the order the design lays out: profile, conversion, baseline, CI cut-over.

gantry skills list prints the same list from the binary you have.

Run from anywhere inside the project; like every command, it finds the project root (the directory holding gantry.yaml) and writes there.

Terminal window
gantry skills install # every agent the project already uses
gantry skills install --agent claude-code --agent codex
gantry skills install --dry-run # list what would change; write nothing

Without --agent, Gantry detects the agents from what is at the project root, and says which it found:

Found Agent Installed to
.claude/ claude-code .claude/skills/<name>/SKILL.md, one per skill
.cursor/ cursor .cursor/commands/<name>.md, one per skill
.github/copilot-instructions.md or .github/prompts/ copilot .github/prompts/<name>.prompt.md, one per skill
AGENTS.md codex a section of AGENTS.md
GEMINI.md gemini a section of GEMINI.md
CONVENTIONS.md aider a section of CONVENTIONS.md

A bare .github/ does not count for Copilot, since nearly every GitHub repository has one. If none of these exists, the install stops and asks you to pass --agent.

The skill text is installed as written. Only the front matter changes per agent: Claude Code keeps name and description, and Cursor and Copilot keep description, because their file name is the skill’s name.

Codex, Gemini and Aider each read one instructions file, so they get one section holding all six skills. Each skill is a ### subsection with its description, and its own headings move three levels down (to at most ######) so they nest under it; code blocks are left as they are. The section sits between these two lines:

<!-- gantry:skills:start -->
<!-- gantry:skills:end -->

Everything outside those lines is yours and is never touched. A file without the lines gets the section appended; a missing file is created with just the section. If the lines are duplicated or unbalanced, the install stops with an error naming the line, and changes nothing.

Commit the installed files and .gantry/skills.lock.json with the rest of the project, so every clone has the same skills.

Detection and installation happen at the Gantry project root, the directory holding gantry.yaml, which may be a subdirectory of the repository (app/, say). Run from the repository root, point at the project with --dir, and name the agents, since the agents’ own files are usually at the repository root rather than in app/:

Terminal window
gantry --dir app skills install --agent claude-code

The skills are then written under app/ (app/.claude/skills/…, app/AGENTS.md). Check that your agent reads instructions from a subdirectory; most read nested AGENTS.md files, but not all. A git hook runs at the repository’s top level, so give it --dir too:

Terminal window
gantry --dir app fmt --check && gantry --dir app lint

The Claude Code hook needs no --dir: it finds the project from the edited file.

The skills tell an agent to run gantry fmt then gantry lint --json after each edit. A hook makes the check automatic. gantry skills hooks prints the configuration for each; it never edits a file, so you stay in charge of your settings.

Terminal window
gantry skills hooks claude-code

prints a fragment to merge into .claude/settings.json (or .claude/settings.local.json):

{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "gantry hook claude-code"
}
]
}
]
}
}

After every Edit, Write or MultiEdit, Claude Code runs the command gantry hook claude-code, which reads the edited path from the hook’s input. The project is the one holding the edited file (else the one holding the hook’s working directory, against which a relative path is resolved). When the file is gantry.yaml or lies under the project’s content directory (every file, when the content directory is the project root), the hook lints the project and keeps the findings in that file. If it has errors, the hook writes them to stderr, inside an <untrusted-data> fence followed by the rule not to follow instructions in it (a finding can quote the file), and exits 2, which Claude Code hands back to the agent to fix. Any other file, a file outside a Gantry project, a clean result, input it cannot decode and input over 1 MiB all exit 0 and print nothing.

The hook reports errors only, and only those in the edited file. It does not run the history rules, which need a base ref, and it does not rewrite files; the skills still tell the agent to run gantry fmt.

Terminal window
gantry skills hooks pre-commit

prints a hook script that refuses a commit whose records are unformatted or have lint errors:

#!/bin/sh
# Gantry: refuse a commit whose design records are not formatted or not
# lint-clean. "gantry fmt" rewrites them; commit what it changes.
gantry fmt --check && gantry lint

Save it as .git/hooks/pre-commit and make it executable, or run its last line from your hook manager (pre-commit, lefthook, husky).

Cursor, Copilot, Codex, Gemini and Aider have no edit hook, so gantry skills hooks codex (or cursor, copilot, gemini, aider) prints a paragraph for the agent’s instructions file instead, and says which file:

## Gantry checks
After editing `gantry.yaml` or a ruling, defect, pass or primer under the
content directory, run `gantry fmt` then `gantry lint --json`, and fix
every finding by its `rule` before you finish.
Never hand-edit `generated/`; `gantry generate` rewrites it.

Put it outside the gantry:skills section, so it survives reinstalls as your own text.

Skills tell an agent when to use Gantry; the MCP server gives it typed tools to do so. gantry mcp runs a Model Context Protocol server over the same core as the CLI, so instead of grepping Markdown, the agent can:

  • read a ruling’s rule for one platform, with the primer lines its defects brought and its open defects, in one call: gantry_ruling_for_platform;
  • find and read records with gantry_query and gantry_show, and check the project with gantry_lint and gantry_rules;
  • look at a screenshot with gantry_evidence_get, which returns the image itself, after gantry_evidence_list says which frames are on disk;
  • file a defect, close one, amend a ruling and record a screenshot with gantry_defect_new, gantry_defect_close, gantry_ruling_amend and gantry_evidence_add (an amendment cites the frames that justify it in its evidence argument, as gantry amend --evidence does), previewing each change first (preview: true writes nothing and shows the files and the lint they would give). A write puts the files in exactly the form gantry fmt gives them and returns the lint report for them, so a change is checked before the agent moves on.

Print your agent’s configuration and add it to the file the note names (for Claude Code, .mcp.json at the project root):

Terminal window
gantry skills mcp claude-code

gantry skills mcp takes claude-code, cursor, copilot (VS Code), gemini or codex, and --read-only to leave out the tools that write. CI and unattended agents must use --read-only: nobody is there to approve a write. Like skills hooks, it never edits your settings. The installed skills tell the agent to prefer the gantry_* tools when they are available, and to fall back to the CLI when they are not, so a project can use the server, the hooks, or both. With the server writing every edit formatted, the hooks still catch edits the agent makes to the files by hand.

The tools return the project’s own text inside <untrusted-data> fences, since anyone who can commit can write a ruling’s cell or a defect’s title, and the skills teach the agent to read it as data, never as instructions. A screenshot is returned only when it is on disk (not a Git LFS pointer) and at most 5 MiB.

The MCP server reference lists every tool, its arguments and its result, and how the server handles untrusted content, write approval and audit logging.

Gantry records the SHA-256 of every file it installs in .gantry/skills.lock.json, with / paths on every OS:

{
"version": 1,
"files": {
".claude/skills/gantry/SKILL.md": "3f1c…",
"AGENTS.md": "9ab0…"
}
}

For a section file the hash covers only the section between the markers, so editing the rest of AGENTS.md never counts as editing the skills. Hashes ignore CRLF line endings, so a Windows checkout is not an edit.

On each install, every destination is one of:

  • missing, or still exactly what Gantry installed: written with the new text;
  • already identical to the new text: left alone (and recorded);
  • edited since Gantry installed it, or never installed by Gantry: kept as it is. The new version goes to .gantry/pending/<path> instead, the command prints staged <path> as .gantry/pending/<path> and a warning, and it still exits 0.

To resolve a staged file, compare the two and merge:

Terminal window
diff .claude/skills/gantry/SKILL.md .gantry/pending/.claude/skills/gantry/SKILL.md

To take Gantry’s version, copy the pending file over yours; the next install sees the match and owns the file again. To keep yours, leave it; each install restages the new version without rewriting an identical pending file. Either way, delete .gantry/pending/ when you are done. You may want it in .gitignore.

Running the install again with nothing changed writes nothing at all, not even the lock.

A new release can change the skills to match new commands or rules. After upgrading the binary:

Terminal window
gantry skills install --dry-run # see what would change
gantry skills install

Files you have not edited are updated in place; files you have edited are staged under .gantry/pending/ for you to merge, as above.

A release can also drop or rename a skill. For each agent you install, an installed file of a skill the release no longer ships is:

  • removed, when you have not edited it: the install prints removed <path> (no longer shipped) and drops it from the lock;
  • kept, when you have: the install prints no longer shipped: <path> (edited; delete it yourself) on every run until you delete the file, after which the lock forgets it.

A removed skill’s own directory, such as .claude/skills/<old-name>/, is removed with it once it is empty; one holding anything else is left. In AGENTS.md, GEMINI.md and CONVENTIONS.md the dropped skill simply disappears from the regenerated section. A dry run reports all of this without doing it.

Commit the updated skills and the lock together.