{"owner":"withcoral","repo":"coral","hasSkills":true,"totalSkillsCount":83,"totalTokensCount":58653,"categories":["anthropic-skill","root-instruction","subagent-persona"],"hasMcp":false,"mcpConfig":null,"found":[".agents/skills/add-recipe/SKILL.md",".agents/skills/add-recipe/agents/openai.yaml",".agents/skills/ask-matt/PHASE-BOUNDARIES.md",".agents/skills/ask-matt/SKILL.md",".agents/skills/ask-matt/agents/openai.yaml",".agents/skills/code-review/SKILL.md",".agents/skills/code-review/agents/openai.yaml",".agents/skills/codebase-design/DEEPENING.md",".agents/skills/codebase-design/DESIGN-IT-TWICE.md",".agents/skills/codebase-design/SKILL.md",".agents/skills/codebase-design/agents/openai.yaml",".agents/skills/diagnosing-bugs/SKILL.md",".agents/skills/diagnosing-bugs/agents/openai.yaml",".agents/skills/domain-modeling/ADR-FORMAT.md",".agents/skills/domain-modeling/GLOSSARY-FORMAT.md",".agents/skills/domain-modeling/SKILL.md",".agents/skills/domain-modeling/agents/openai.yaml",".agents/skills/grill-me/SKILL.md",".agents/skills/grill-me/agents/openai.yaml",".agents/skills/grill-with-docs/SKILL.md",".agents/skills/grill-with-docs/agents/openai.yaml",".agents/skills/grilling/SKILL.md",".agents/skills/grilling/agents/openai.yaml",".agents/skills/handoff/SKILL.md",".agents/skills/handoff/agents/openai.yaml",".agents/skills/implement-spec/SKILL.md",".agents/skills/implement-spec/agents/openai.yaml",".agents/skills/implement/SKILL.md",".agents/skills/implement/agents/openai.yaml",".agents/skills/improve-codebase-architecture/HTML-REPORT.md",".agents/skills/improve-codebase-architecture/SKILL.md",".agents/skills/improve-codebase-architecture/agents/openai.yaml",".agents/skills/pr/CREDITS.md",".agents/skills/pr/SKILL.md",".agents/skills/pr/agents/openai.yaml",".agents/skills/prototype/LOGIC.md",".agents/skills/prototype/SKILL.md",".agents/skills/prototype/UI.md",".agents/skills/prototype/agents/openai.yaml",".agents/skills/research/SKILL.md",".agents/skills/research/agents/openai.yaml",".agents/skills/retro/SKILL.md",".agents/skills/retro/agents/openai.yaml",".agents/skills/show-me/SKILL.md",".agents/skills/show-me/agents/openai.yaml",".agents/skills/tdd/SKILL.md",".agents/skills/tdd/agents/openai.yaml",".agents/skills/tdd/mocking.md",".agents/skills/tdd/tests.md",".agents/skills/teach/GLOSSARY-FORMAT.md",".agents/skills/teach/LEARNING-RECORD-FORMAT.md",".agents/skills/teach/MISSION-FORMAT.md",".agents/skills/teach/RESOURCES-FORMAT.md",".agents/skills/teach/SKILL.md",".agents/skills/teach/agents/openai.yaml",".agents/skills/to-benchmark/EXAMPLE.md",".agents/skills/to-benchmark/KNOWN_ISSUES.md",".agents/skills/to-benchmark/SKILL.md",".agents/skills/to-benchmark/TEMPLATE.md",".agents/skills/to-questionnaire/SKILL.md",".agents/skills/to-questionnaire/agents/openai.yaml",".agents/skills/to-spec/SKILL.md",".agents/skills/to-spec/agents/openai.yaml",".agents/skills/to-tickets/SKILL.md",".agents/skills/to-tickets/agents/openai.yaml",".agents/skills/triage/AGENT-BRIEF.md",".agents/skills/triage/OUT-OF-SCOPE.md",".agents/skills/triage/SKILL.md",".agents/skills/triage/agents/openai.yaml",".agents/skills/wait-what/SKILL.md",".agents/skills/wait-what/agents/openai.yaml",".agents/skills/wayfinder/SKILL.md",".agents/skills/wayfinder/agents/openai.yaml",".agents/skills/wizard/SKILL.md",".agents/skills/wizard/agents/openai.yaml",".agents/skills/writing-for-agents/SKILL-MECHANICS.md",".agents/skills/writing-for-agents/SKILL.md",".agents/skills/writing-for-agents/agents/openai.yaml","AGENTS.md","apps/AGENTS.md","docs/agents/domain.md","docs/agents/issue-tracker.md","docs/agents/triage-labels.md"],"skills":{".agents/skills/add-recipe/SKILL.md":"---\nname: add-recipe\ndescription: Research an upstream service and write a Provider Recipe for it in apps/reef/recipes.\nargument-hint: \"Service name, e.g. notion\"\ndisable-model-invocation: true\n---\n\nWrite a **Provider Recipe** for the service the user names. A recipe states facts about one Upstream Service (its source, how to authenticate, its inputs and servers) so Reef can pre-fill Provider Setup. It lives at `apps/reef/recipes/<id>/recipe.yaml`, with an optional icon beside it.\n\nBefore you start, read:\n\n- `GLOSSARY.md`, the **Provider Recipe** entry.\n- ADRs 0002, 0003 and 0004 in `docs/adr/`.\n- `apps/reef/recipes/schema.json`: the recipe format. Its `description` fields are the field docs.\n- Example recipes: `linear` (MCP, OAuth discovery), `github` (OpenAPI, device code, public client) and `sentry` (region input, owner-configured client, servers).\n\n## 1. Check the id\n\nDerive the id from the service name: lowercase, `[a-z][a-z0-9_]*`. If `apps/reef/recipes/<id>/` exists, stop and ask the user whether to update that recipe or pick a new id.\n\n## 2. Find a source\n\nCoral reads two kinds of source:\n\n- An **OpenAPI 3.0 or 3.1** document, fetched once from a URL without following redirects. Swagger 2.0 fails.\n- An **MCP server over Streamable HTTP**. Standalone SSE and stdio servers fail.\n\nSearch the vendor's official docs for both. Record the URL of every doc page you rely on; the PR description cites them.\n\nDone when you hold at least one usable source URL, or have reported that none exists.\n\n## 3. Plan, then wait\n\nShow the user a short plan and wait for their approval. Cover each point:\n\n- **Recipes and ids.** One source: use the bare id. OpenAPI and MCP both: offer two recipes, `<id>` for OpenAPI and `<id>_mcp` for MCP. Give both the same `display_name` and set `service: <id>` in the MCP recipe, so the catalog shows both on one card and suggests one namespace (as `github_mcp` does). A self-hosted edition with its own host: offer `<id>_self_hosted` as well.\n- **Source URLs**, and for a third-party document, the audit result and why you pinned it or not.\n- **Authentication options** and the `default` (see below).\n- **Scopes** for each OAuth option, or why it names none.\n- **Inputs and servers**, e.g. a region.\n- **Icon** source.\n- **Gaps**: anything the format cannot express.\n\nAuthentication rules:\n\n- Include every method the service supports that a recipe `method` can express, e.g. OAuth and an API key.\n- Default to OAuth when it needs no extra setup: `oauth_discovery` for MCP, or device code or authorization code with a public client. Otherwise default to the API key or personal access token.\n- Leave the OAuth client id out, so the owner configures one (as `sentry` does). Coral could register its own application later; list that as a follow-up.\n- Name scopes whenever the service reads them from the authorization request. This includes an `oauth_discovery` server that does not advertise them (as `github_mcp` does). Request every scope it offers, read and write, with a comment naming what each grants. Coral reads and writes through providers.\n- Name no scopes when the service supplies them another way: an `oauth_discovery` server that advertises them (as `hubspot` does), or a service that takes them from the app's settings (as `attio` does). Omit `scopes` for `oauth_discovery`. The other OAuth methods require the field, so write `scopes: []`. Add a comment saying why the recipe names none, and for app settings, list the scopes the owner must turn on.\n- If the only way to authenticate needs a method the format lacks, stop and report the gap and what a new method would need. Extending the format touches Reef, proto and Rust, and is out of scope here.\n\nModel regions and similar choices as an `inputs` enum inside one recipe.\n\n## 4. Write the recipe\n\nFor each approved recipe, write `apps/reef/recipes/<id>/recipe.yaml`. Start it with `# yaml-language-server: $schema=../schema.json`, then match the shape of the example recipes.\n\n- `description` follows the pattern \"Issues, events and releases from Sentry.\"\n- Write `label` and `description` text in the Reef copy style from `AGENTS.md`.\n- Comment anything a reader cannot tell from the YAML alone.\n\nFor the icon, use the vendor's official brand SVG from their brand or press page, or the Simple Icons one. If you find no clean SVG, or its terms are unclear, leave `icons` out and list it as a follow-up.\nName the logo under `icons.light`. Reef shows it on a white plate in the light theme and a dark plate in the dark theme. If it does not read on the dark plate, e.g. a black glyph, add the vendor's official or Simple Icons light variant under `icons.dark`, named `<name>-dark.svg`. If there is no clean variant or its terms are unclear, leave `icons.dark` out and list it as a follow-up.\n\nDone when every approved recipe has its file and the plan's decisions all appear in it.\n\n## 5. Test\n\nRun, and fix until both pass:\n\n```sh\nnpm ci --prefix apps/reef   # once, if apps/reef/node_modules is missing\n(cd apps/reef && npx vitest run --project server recipes.server)\nnpm run check --prefix apps/reef\n```\n\nDo not use `npm test -- recipes.server`. It also runs the Storybook tests, which match no file and exit 1.\n\nThe recipe test also enforces rules the schema cannot, such as no undeclared `{{input.x}}` and no unused credential fields.\n\nCheck each source directly:\n\n- **OpenAPI**: fetch the URL. Confirm a 200 with no redirect, and an `openapi` field of `3.0.x` or `3.1.x`.\n- **MCP**: POST an `initialize` request to the URL. Confirm a Streamable HTTP response, or a 401 that points at OAuth when the server needs sign-in.\n\nThen give the user steps for a live test, which needs their browser and account:\n\n1. Run `./dev run` (see `docs/development.md`).\n2. In Reef, open `/workspaces/<workspace>/providers/new?recipe=<id>`.\n3. Sign in, publish the provider, and run a query against one of its tables.\n\n## 6. Summarise\n\nReport:\n\n- The files you wrote.\n- Test results, including the source checks.\n- Follow-ups: missing icon, OAuth client to register, the third-party audit result, format gaps.\n- A draft PR description that cites the vendor doc URLs.\n\nThen offer to open the PR. If the user accepts, create a branch named `<prefix>/add-<id>-recipe`, using the user's usual branch prefix, and commit there.\n",".agents/skills/add-recipe/agents/openai.yaml":"interface:\n  display_name: \"Add Recipe\"\n  short_description: \"Write a Provider Recipe for a service\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/ask-matt/PHASE-BOUNDARIES.md":"# Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *\"ok, we're done with that\"*.\n\nThe **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.\n\n## The five options\n\n| Option       | What it does                                                    |\n| ------------ | --------------------------------------------------------------- |\n| **Continue** | Stay in the session. No context switch at all.                    |\n| **`/clear`** | Empty the context window and start from nothing.                  |\n| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |\n| **Subagent** | Send the task to its own context window and get a report back.     |\n| **`/compact`** | Compress this context and seed a fresh session with the summary.  |\n\n## The tree\n\nWork top to bottom at the boundary. The first **yes** wins.\n\n**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.\n\n**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.\n\nThe cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.\n\n**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:\n\n- swapping to a **new harness** (Claude → Codex),\n- moving to a **new directory** or repo,\n- sending the work to a **colleague**,\n- or forking a side task you found **mid-phase** without derailing what you're doing.\n\nThat list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.\n\n**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.\n\n**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.\n\n`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.\n\n## Primary and secondary sources\n\nEvery move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:\n\n| Source                            | Information | Noise | Room to move |\n| --------------------------------- | ----------- | ----- | ------------ |\n| Primary (Continue)                | Full        | Lots  | Little       |\n| Secondary (`/compact`, `/handoff`) | Lossy       | Less  | Lots         |\n\nThis is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.\n\n## These are judgement calls\n\nThe questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.\n",".agents/skills/ask-matt/SKILL.md":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nBefore stating what a skill does or recommending a step be skipped, read that skill's SKILL.md: the summaries here are for orientation only.\n\nA **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `GLOSSARY.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)\n2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch: is this a multi-session build?**\n   - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. Then work the tickets one of two ways:\n     - **`/implement`** per ticket, **`/clear`ing context between each one**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed. Each ticket is self-contained, so the last one's context is disposable.\n     - **`/implement-spec`** for the whole spec in one run. It reads the tickets as a **task graph**, runs implementer subagents across the ready **frontier** in parallel, and lands everything on one **integration branch**. Reach for it when you'd rather orchestrate the build than drive each ticket yourself.\n   - **No** → **`/implement`** right here, in the same context window.\n\n   Either way, the code gets built by driving **`/tdd`** (one red-green slice at a time) and closes out with **`/code-review`**, a two-axis review (Standards + Spec) of the diff. `/implement` runs both per ticket; `/implement-spec`'s implementers each drive `/tdd`, and it runs one `/code-review` over the integration branch. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.\n\n   When the work goes up as a pull request, **`/pr`** shapes the body: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call. It's model-invoked, so the agent reaches for it whenever it writes a PR.\n\n4. **`/retro`** closes the loop. After a build, and especially one that went sideways, it looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards. The next build then starts from a better environment.\n\n### Context hygiene\n\nKeep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket. Run `/retro` in the session it's looking back on, before you clear; after clearing, point it at that session's log instead.\n\nThe limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.\n\n- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Once the fix is in, run **`/retro`** in the same session to ask what would have prevented the bug; where the real finding is that there's no good seam to lock it down, that's a job for **`/improve-codebase-architecture`**.\n\n- **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.\n\n  When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.\n\n## Codebase health\n\nNot feature work, just upkeep.\n\n- **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.\n\n## Vocabulary underneath\n\nTwo model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.\n\n- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word (\"account\" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `GLOSSARY.md` a clean glossary.\n- **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.\n\n## Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:\n\n- **Continue**: stay put. Costs nothing, loses nothing.\n- **`/clear`**: empty the window, when nothing here matters to what's next.\n- **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.\n- **Subagent**: send a tightly-scoped task to its own window and get a report back.\n- **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.\n\nRead [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `GLOSSARY.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.\n- **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.\n- **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.\n- **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.\n- **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.\n- **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.\n- **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.\n- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.\n\n## Precondition\n\n**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.\n",".agents/skills/ask-matt/agents/openai.yaml":"interface:\n  display_name: \"Ask Matt\"\n  short_description: \"Find the right skill or workflow\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/code-review/SKILL.md":"---\nname: code-review\ndescription: \"Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \\\"review since X\\\".\"\n---\n\nTwo-axis review of the diff between `HEAD` and a fixed point the user supplies:\n\n- **Standards**: does the code conform to this repo's documented coding standards?\n- **Spec**: does the code faithfully implement the originating issue / spec?\n\nBoth axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\n## Process\n\n### 1. Pin the fixed point\n\nWhatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.\n\nCapture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.\n\nBefore going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.\n\n### 2. Identify the spec source\n\nLook for the originating spec, in this order:\n\n1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.\n2. A path the user passed as an argument.\n3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.\n4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report \"no spec available\".\n\n### 3. Identify the standards sources\n\nSearch the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.\n\nOn top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:\n\n- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.\n- **Always a judgement call.** Each smell is a labelled heuristic (\"possible Feature Envy\"), never a hard violation. Like any standard here, skip anything tooling already enforces.\n\nEach smell reads *what it is* → *how to fix*; match it against the diff:\n\n- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.\n- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.\n- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.\n- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.\n- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.\n- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.\n- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.\n- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.\n- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.\n- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.\n- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.\n- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.\n\n### 4. Spawn both sub-agents in parallel\n\nIssue both sub-agent calls together, in the foreground, and aggregate the reports they return.\n\n**Standards sub-agent prompt** should include:\n\n- The full diff command and commit list.\n- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).\n- The brief: \"Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words.\"\n\n**Spec sub-agent prompt** should include:\n\n- The diff command and commit list.\n- The path or fetched contents of the spec.\n- The brief: \"Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words.\"\n\nIf the spec is missing, skip the Spec sub-agent and note this in the final report.\n\n### 5. Aggregate\n\nPresent the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).\n\nEnd with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.\n\n## Why two axes\n\nA change can pass one axis and fail the other:\n\n- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**\n- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**\n\nReporting them separately stops one axis from masking the other.\n",".agents/skills/code-review/agents/openai.yaml":"interface:\n  display_name: \"Code Review\"\n  short_description: \"Review a diff on standards and spec\"\n",".agents/skills/codebase-design/DEEPENING.md":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.\n\nRecommendation shape: *\"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network.\"*\n\n### 4. True external (Mock)\n\nThird-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.\n\n## Seam discipline\n\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.\n- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.\n",".agents/skills/codebase-design/DESIGN-IT-TWICE.md":"# Design It Twice\n\nWhen the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on \"Design It Twice\" (Ousterhout): your first idea is unlikely to be the best.\n\nUses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.\n\nPrompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:\n\n- Agent 1: \"Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility: support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller: make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params, plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs: where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.\n\nAfter comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.\n",".agents/skills/codebase-design/SKILL.md":"---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.\n- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n",".agents/skills/codebase-design/agents/openai.yaml":"interface:\n  display_name: \"Codebase Design\"\n  short_description: \"Vocabulary for deep-module design\"\n",".agents/skills/diagnosing-bugs/SKILL.md":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.\n\n## Redact\n\nThis skill has you show commands, outputs and captured artifacts. **Redact every secret first**: write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.\n\nIf the redacted output is not enough to diagnose the bug, say so and ask the user.\n\n## Phase 1: Build a feedback loop\n\n**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug (one that goes red on _this_ bug), you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one, in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug: unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) that drives the UI and asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate \"boot at state X, check, repeat\" so you can `git bisect run` it.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight, a debugging superpower.\n\n### Non-deterministic bugs\n\nThe goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not, so keep raising the rate until it's debuggable.\n\n### When you genuinely cannot build a loop\n\nStop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.\n\n### Completion criterion: a tight loop that goes red\n\nPhase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** (a script path, a test invocation, a curl) that you have **already run at least once** (show the invocation and its output, redacted), and that is:\n\n- [ ] **Red-capable**: it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not \"runs without erroring\"; it must be able to _catch this specific bug_.\n- [ ] **Deterministic**: same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast**: seconds, not minutes.\n- [ ] **Agent-runnable**: you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf you catch yourself reading code to build a theory before this command exists, **stop: jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.\n\n## Phase 2: Reproduce + minimise\n\nRun the loop. Watch it go red as the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described, not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut, and keep only what's load-bearing for the failure.\n\nWhy bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.\n\nDone when **every remaining element is load-bearing**: removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3: Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe: discard or sharpen it.\n\n**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly (\"we just deployed a change to #3\"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it; proceed with your ranking if the user is AFK.\n\n## Phase 4: Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.\n\n**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.\n\n## Phase 5: Fix + regression test\n\nWrite the regression test **before the fix**, but only if there is a **correct seam** for it.\n\nA correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.\n\n**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail. If you forced the red by mutating code or a fixture, `diff` against a pristine copy to prove the mutation landed before you trust it.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6: Cleanup\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message, so the next debugger learns\n",".agents/skills/diagnosing-bugs/agents/openai.yaml":"interface:\n  display_name: \"Diagnosing Bugs\"\n  short_description: \"Diagnose hard bugs and regressions\"\n",".agents/skills/domain-modeling/ADR-FORMAT.md":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n",".agents/skills/domain-modeling/GLOSSARY-FORMAT.md":"# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `GLOSSARY.md` at the repo root.\n\n**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Glossary Map\n\n## Contexts\n\n- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders\n- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `GLOSSARY-MAP.md` exists, read it to find contexts\n- If only a root `GLOSSARY.md` exists, single context\n- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n",".agents/skills/domain-modeling/SKILL.md":"---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── GLOSSARY.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── GLOSSARY-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── GLOSSARY.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── GLOSSARY.md\n│       └── docs/adr/\n```\n\nCreate files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. \"Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?\"\n\n### Sharpen fuzzy language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term. \"You're saying 'account': do you mean the Customer or the User? Those are different things.\"\n\n### Discuss concrete scenarios\n\nWhen domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.\n\n### Cross-reference with code\n\nWhen the user states how something works, check whether the code agrees. If you find a contradiction, surface it: \"Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?\"\n\n### Update GLOSSARY.md inline\n\nWhen a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).\n\n`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n",".agents/skills/domain-modeling/agents/openai.yaml":"interface:\n  display_name: \"Domain Modeling\"\n  short_description: \"Build and sharpen a domain model\"\n",".agents/skills/grill-me/SKILL.md":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nCall the Skill tool with \"grilling\".\n",".agents/skills/grill-me/agents/openai.yaml":"interface:\n  display_name: \"Grill Me\"\n  short_description: \"Sharpen a plan through interview\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/grill-with-docs/SKILL.md":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nCall the Skill tool twice, for \"grilling\" and \"domain-modeling\".\n",".agents/skills/grill-with-docs/agents/openai.yaml":"interface:\n  display_name: \"Grill with Docs\"\n  short_description: \"Grill a design and write its docs\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/grilling/SKILL.md":"---\nname: grilling\ndescription: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.\n---\n\nInterview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.\n\nWork the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.\n\nFormat a round like so:\n\n```\n❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n\n---\n\n❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n```\n\nWord each question so \"yes\" accepts your recommended answer.\n\nEach round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.\n\nFinding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.\n\nThe session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.\n",".agents/skills/grilling/agents/openai.yaml":"interface:\n  display_name: \"Grilling\"\n  short_description: \"Stress-test thinking a round of questions at a time\"\n",".agents/skills/handoff/SKILL.md":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS (`$TMPDIR`, else `/tmp`; `%TEMP%` on Windows) - not the current workspace.\n\nInclude a \"suggested skills\" section in the document, naming which skills the next agent should call the Skill tool for.\n\nDo not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n",".agents/skills/handoff/agents/openai.yaml":"interface:\n  display_name: \"Handoff\"\n  short_description: \"Compact a conversation into a handoff\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/implement-spec/SKILL.md":"---\nname: implement-spec\ndescription: \"Implement the result of /to-spec and /to-tickets in code.\"\ndisable-model-invocation: true\n---\n\nYou have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\nThe goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.\n\nThe tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.\n\nCommunication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.\n\n**Implementer subagents** should be run in the background where possible for maximum concurrency.\n\n## Steps\n\n1. Read the spec and tickets to understand the task graph.\n\n2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.\n\n3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.\n\n4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:\n   - confirms its worktree is based on the integration branch before starting, and resets onto it if not;\n   - calls the Skill tool with `tdd` to build the ticket;\n   - merges the integration branch tip into its own branch before reporting done\n\n5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.\n\n6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.\n\n7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.\n\n8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.\n\n9. Clean up all **implementer subagent** worktrees.\n",".agents/skills/implement-spec/agents/openai.yaml":"interface:\n  display_name: \"Implement Spec\"\n  short_description: \"Implement the result of /to-spec and /to-tickets in code.\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/implement/SKILL.md":"---\nname: implement\ndescription: \"Implement a piece of work based on a spec or set of tickets.\"\ndisable-model-invocation: true\n---\n\nImplement the work described by the user in the spec or tickets.\n\nIf the user passes a ticket reference, fetch it from the issue tracker and state its title before starting. If the reference is ambiguous, ask.\n\nCall the Skill tool with \"tdd\" where possible, at pre-agreed seams.\n\nRun typechecking regularly, single test files regularly, and the full test suite once at the end.\n\nOnce done, call the Skill tool with \"code-review\" to review the work.\n\nCommit your work to the current branch.\n",".agents/skills/implement/agents/openai.yaml":"interface:\n  display_name: \"Implement\"\n  short_description: \"Build work from a spec or tickets\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/improve-codebase-architecture/HTML-REPORT.md":"# HTML Report Format\n\nThe architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two: don't lean on Mermaid for everything, it'll start to look generic.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review for {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph. Straight into the candidates.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title**: short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **Badge row**: recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).\n- **Files**: monospaced list, `font-mono text-sm`.\n- **Before / After diagram**: the centrepiece. Two columns, side by side. See patterns below.\n- **Problem**: one sentence. What hurts.\n- **Solution**: one sentence. What changes.\n- **Wins**: bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable): one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same. Variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse a Mermaid `flowchart` or `graph` when the point is \"X calls Y calls Z, and look at the mess.\" Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for \"before: 6 round-trips; after: 1.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the \"after\" diagram to feel like one thick-bordered deep module with greyed-out internals, since Mermaid won't render that with the right weight.\n\n### Cross-section (good for layered shallowness)\n\nStack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo rectangles per module: one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).\n\n### Call-graph collapse\n\nBefore: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.\n- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise, but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow: interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**Wins bullets** name the gain in glossary terms: *\"locality: bugs concentrate in one module\"*, *\"leverage: one interface, N call sites\"*, *\"interface shrinks; implementation absorbs the wrappers\"*. Don't write *\"easier to maintain\"* or *\"cleaner code\"*, because those terms aren't in the glossary and don't earn their place.\n\nNo hedging, no throat-clearing, no \"it's worth noting that…\". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in the `/codebase-design` glossary, reach for one that is before inventing a new one.\n",".agents/skills/improve-codebase-architecture/SKILL.md":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities**: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- Call the Skill tool with \"codebase-design\" for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, \"the interface is the test surface\", \"one adapter = hypothetical seam, two = real\"). Use these terms exactly in every suggestion, and don't drift into \"component,\" \"service,\" \"API,\" or \"boundary.\"\n- The domain language in `GLOSSARY.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\n**Scope before you scan: YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:\n\n- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.\n- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.\n\nRead the project's domain glossary (`GLOSSARY.md`) and any ADRs in the area you're touching first.\n\nThen spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow**, with an interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A \"yes, concentrates\" is the signal you want.\n\n### 2. Present candidates as an HTML report\n\nWrite a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.\n\nThe report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.\n\nFor each candidate, render a card with:\n\n- **Files**: which files/modules are involved\n- **Problem**: why the current architecture is causing friction\n- **Solution**: plain English description of what would change\n- **Benefits**: explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram**: side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength**: one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**Use GLOSSARY.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `GLOSSARY.md` defines \"Order,\" talk about \"the Order intake module,\" not \"the FooBarHandler,\" and not \"the Order service.\"\n\n**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _\"contradicts ADR-0007, but worth reopening because…\"_). Don't list every theoretical refactor an ADR forbids.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce the user picks a candidate, call the Skill tool with \"grilling\" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.\n\nSide effects happen inline as decisions crystallize; call the Skill tool with \"domain-modeling\" to keep the domain model current as you go:\n\n- **Naming a deepened module after a concept not in `GLOSSARY.md`?** Add the term to `GLOSSARY.md`. Create the file lazily if it doesn't exist.\n- **Sharpening a fuzzy term during the conversation?** Update `GLOSSARY.md` right there.\n- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _\"Want me to record this as an ADR so future architecture reviews don't re-suggest it?\"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons (\"not worth it right now\") and self-evident ones.\n- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with \"codebase-design\" and use its design-it-twice parallel sub-agent pattern.\n",".agents/skills/improve-codebase-architecture/agents/openai.yaml":"interface:\n  display_name: \"Improve Codebase Architecture\"\n  short_description: \"Find and grill architecture improvements\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/pr/CREDITS.md":"# Credits\n\nThe **Summary** section's menu of visuals (pseudocode, call trees, component trees, file trees, Mermaid, diffs) and its placement guidance come from [Dex Horthy](https://github.com/dexhorthy)'s [`show-me`](https://github.com/humanlayer/humanlayer) skill, reproduced almost word for word and aimed at a diff instead of a live conversation. `pr` does not depend on `show-me` as a skill (it isn't part of this repo, and a hard dependency would break standalone installs), so the content is copied in rather than pointed at; this file is the attribution a dependency would otherwise have carried.\n",".agents/skills/pr/SKILL.md":"---\nname: pr\ndescription: \"Use when writing a PR body.\"\nmetadata:\n  credits:\n    skill: show-me\n    author: Dex Horthy\n    organisation: Humanlayer\n    url: \"https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md\"\n---\n\nUse this template for writing the PR body:\n\n```markdown\n## Summary\n\n<diagram, diff-sketch, or tree>\n\n## Evidence\n\n- **Before:** <screenshot/output/failing test run>\n  **After:** <screenshot/output/passing test run>\n\n## Merge Danger\n\n**Door:** <one-way or two-way>\n\n<optional: description>\n\n**Blast Radius:** <one-word description>\n\n<optional: potential ramifications of merge>\n```\n\n## Sections\n\nSkip all preambles and keep prose brief. Use the user's domain language from `GLOSSARY.md`.\n\n### Summary\n\nPick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```text\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1);\n  return `use the ${skillName} skill`;\n}\n```\n\n#### Guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n\n### Evidence\n\nConcrete evidence that the change works. Show a before and after.\n\nScreenshots are S-tier - when the environment is set up for it and the change is visual.\n\nExecution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode.\n\n### Merge Danger\n\nDescribe whether it's a one-way or two-way door. You can walk back through two-way doors, but not one-way doors. A PR that is cheap to roll back is lower risk. Changes that involve destructive actions or hard-to-reverse decisions are one-way doors.\n\nThe blast radius is the potential impact or scope of the changes introduced by this PR. Consider all possibilities. Examples are layout shift, breakages for consumers, mobile responsiveness, etc.\n",".agents/skills/pr/agents/openai.yaml":"interface:\n  display_name: \"PR\"\n  short_description: \"Write a PR body that's fast to review\"\n",".agents/skills/prototype/LOGIC.md":"# Logic Prototype\n\nA single, self-contained HTML file (a **shareable demo**) that lets anyone drive a state model by clicking buttons. Use this when the question is about **business logic, state transitions, or data shape**: the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.\n\nBecause it's one file with nothing to install, you can hand it to a non-developer (a designer, a PM, a domain expert) and let them feel the model for themselves. So it speaks their language, not the code's.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where someone wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like,\" this is the wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore writing code, write down what state model and what question you're prototyping. One paragraph, at the top of the demo (in a visible intro, not just a comment). A logic prototype that answers the wrong question is pure waste, so make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.\n\n### 2. Isolate the logic in a portable module\n\nPut the actual logic (the bit that's answering the question) in a single `<script>` block written as a small, pure module that could be lifted out and dropped into the real codebase later. The page around it is throwaway; this module isn't.\n\nThe right shape depends on the question:\n\n- **A pure reducer**: `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine**: explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state, just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a page. Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The page calls into it; nothing flows the other direction. This is what makes the prototype useful past its own lifetime: once the question's answered, the validated reducer / machine / function set lifts into the real module on its own.\n\n### 3. Build the shareable HTML file\n\nOne file, plain HTML/CSS/JS: no framework, no bundler, no server, everything inline so it opens by double-click and survives being emailed around. Anyone should be able to run it by opening it.\n\nWrite it for a non-developer. Every label is in **domain language**, not code: buttons and state read like the business, not the reducer. Explain in plain words what's happening.\n\nLay it out with a clean hierarchy, top to bottom:\n\n1. **Title and one-line explanation** of what this demo lets you explore (the question from step 1).\n2. **Current state**: the full relevant state, rendered as a readable panel (labelled fields, not a raw JSON dump), re-rendered after every click so the change is visible. Where it helps a non-developer follow, call out what just changed.\n3. **Free-play buttons**: one button per action, always available, so anyone can poke at the model in any order. Each click dispatches its action and re-renders the state.\n4. **Guided walkthroughs**: a set of **scenarios**, one per tab. Each tab holds a short plain-language description of the scenario (the situation it sets up and what to watch for) and underneath it, the ordered **buttons to press** for that scenario. Each step is a real button: clicking it performs that action and moves to the next step. Starting a walkthrough resets to a known initial state so the scenario runs the same way every time.\n\nChoose scenarios that demonstrate the awkward cases, the ones hard to reason about on paper: the happy path, a tricky edge case, an attempt at something that should be illegal.\n\nKeep it beautiful but restrained: clean typography, generous spacing, one accent colour. No animations, no gimmicks: nothing that competes with the state and the buttons.\n\n### 4. Hand it over\n\nSend them the file, or open it for them. They'll click through the walkthroughs and free-play whenever they get to it; the interesting moments are when they say \"wait, that shouldn't be possible\" or \"huh, I assumed X would be different\"; those are the bugs in the _idea_, which is the whole point. If they want new actions or a new scenario, add them. Prototypes evolve.\n\n### 5. Capture the answer and the prototype\n\nOnce the prototype has answered its question, capture the answer, then capture the prototype the way the [SKILL](SKILL.md) describes. The logic-specific mapping: the validated reducer / machine / function set lifts into the real module (the decision, absorbed); the HTML shell rides along to the throwaway branch that keeps the prototype as a primary source, and being one self-contained file, it stays trivially re-runnable there.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use in-memory state unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **Don't blur the logic and the page together.** If the pure module references the DOM, `document`, or button handlers, it's no longer liftable. Keep the page as a thin shell over a pure module.\n- **Don't reach for a framework, bundler, or server.** One file the recipient double-clicks; a React app or a dev server defeats \"shareable\".\n- **Don't ship the HTML shell into production.** The page is optimised for being clicked through by hand. The logic module behind it is the bit worth keeping.\n",".agents/skills/prototype/SKILL.md":"---\nname: prototype\ndescription: Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"Does this logic / state model feel right?\"** → [LOGIC.md](LOGIC.md). Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.\n- **\"What should this look like?\"** → [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.\n\nThe two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.\n\n## Rules that apply to both\n\n1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.\n2. **Trivial to run.** A UI prototype starts from one command in the project's task runner: `pnpm <name>`, `python <path>`, `bun <path>`, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it.\n3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear \"PROTOTYPE, wipe me\" name.\n4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast.\n5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.\n6. **Capture it when done.** Fold any validated decision into the real code, then capture the prototype itself as a **primary source**: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.\n",".agents/skills/prototype/UI.md":"# UI Prototype\n\nGenerate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.\n\nIf the question is about logic/state rather than what something looks like, this is the wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes: strongly prefer sub-shape A\n\nA UI prototype is much easier to judge when it's **butting up against the rest of the app**: real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.\n\n### Sub-shape A: adjustment to an existing page (preferred)\n\nThe route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay. Only the rendering swaps. This is the default; pick it unless there's a specific reason not to.\n\nIf the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow), it's still sub-shape A. Mount the variants inside the host page.\n\n### Sub-shape B: a new page (last resort)\n\nOnly use this when the thing being prototyped genuinely has no existing page to live inside (e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible).\n\nCreate a **throwaway route** following whatever routing convention the project already uses. Don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.\n\nBefore committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise, so cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants must be **structurally different**: different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit \"do not use a card grid\" guidance.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code, adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow**: cycles to the previous variant (wraps around).\n- **Variant label**: shows the current variant key and, if the variant exports a name, that name too. e.g. `B (Sidebar layout)`.\n- **Right arrow**: cycles forward (wraps around).\n\nBehaviour:\n\n- Clicking an arrow updates the URL search param (use the framework's router, e.g. `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- Hidden in production builds: gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **\"I want the header from B with the sidebar from C\"**, which is the actual design they want.\n\n### 6. Capture the answer and clean up\n\nOnce a variant has won, capture the answer (which variant and why), then capture the prototype the way the [SKILL](SKILL.md) describes. Fold the winner into the real code and move the rest onto the throwaway branch, not into main:\n\n- **Sub-shape A**: fold the winner into the existing page; drop the losing variants and the switcher from main.\n- **Sub-shape B**: promote the winning variant to a real route; drop the throwaway route and the switcher from main.\n\nThe full set of variants is the primary source, so it lands on the throwaway branch, not the bin, since variant components and the switcher left in the main branch rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.\n- **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub: the question is \"what should this look like\", not \"does the backend work\".\n- **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.\n",".agents/skills/prototype/agents/openai.yaml":"interface:\n  display_name: \"Prototype\"\n  short_description: \"Prototype to answer a design question\"\n",".agents/skills/research/SKILL.md":"---\nname: research\ndescription: Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.\n---\n\nSpin up a **background agent** to do the research, so you keep working while it reads.\n\nIts job:\n\n1. Investigate the question against **primary sources** (official docs, source code, specs, first-party APIs), not a secondary write-up of them. Follow every claim back to the source that owns it.\n2. Write the findings to a single Markdown file, citing each claim's source.\n3. Save it where the repo already keeps such notes; match the existing convention, and if there is none, put it somewhere sensible and say where.\n",".agents/skills/research/agents/openai.yaml":"interface:\n  display_name: \"Research\"\n  short_description: \"Research from high-trust sources\"\n",".agents/skills/retro/SKILL.md":"---\nname: retro\ndescription: \"Conduct a retrospective on a coding session.\"\ndisable-model-invocation: true\n---\n\nThe user has asked for a **retrospective**. You are suggesting improvements to the coding agent's **environment** to improve future runs.\n\n## Steps\n\n1. Call the Skill tool with `writing-for-agents` for the writing style guide.\n\n2. Read the primary sources for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.\n\n3. Look for candidates for improvement in these categories.\n\n- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** make it easier? _Use when_ the session took a long time to find a piece of information.\n- **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but sits unwired or silently broken is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a standing missed opportunity, not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all.\n- **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a deterministic check, full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **judgement calls** (cross-file consistency, \"matches the surrounding style,\" anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake.\n- **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope.\n- **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call.\n- **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy.\n- **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.\n\n4. Present these candidates to the user, in order of severity.\n\n## Reference\n\n### Implementation vs Review\n\nRemember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.\n\nThe review agent has the least context pressure - it receives a diff, so no exploration needed. It often does not need to write code or debug.\n\nThis means that the review agent should be responsible for imposing coding standards, not the implementation agent.\n\n### Files\n\nYou have access to several files in the repo:\n\n- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be used incredibly sparingly, usually only for **navigation pointers** to other files.\n- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.\n- Docs: use docs as references files, pointed to by other files. Look for existing docs before writing new ones.\n- Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.\n",".agents/skills/retro/agents/openai.yaml":"interface:\n  display_name: \"Retro\"\n  short_description: \"Conduct a retrospective on a coding session.\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/show-me/SKILL.md":"---\nname: show-me\ndescription: Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.\ndisable-model-invocation: true\n---\n\nHelp the user understand the current topic of conversation visually. Skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```tsx\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1)\n  return `use the ${skillName} skill`\n}\n```\n\n- For a visual UI, layout, state comparison, or concept too dense for Mermaid, write one focused HTML file — a diagram, an infographic, or a short slide deck, whichever fits the point. Match the product's colors, type, spacing, and components; use real labels and data; support desktop and mobile. Then open it for the user:\n\n```\nBash(open path/to/show-me-{description}.html)\n```\n\n### guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n",".agents/skills/show-me/agents/openai.yaml":"policy:\n  allow_implicit_invocation: false\n",".agents/skills/tdd/SKILL.md":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\nTDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\n## What a good test is\n\nTests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: \"user can checkout with valid cart\" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Seams: where tests go\n\nA **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.\n\n**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.\n\nAsk: \"What's the public interface, and which seams should we test?\" Give each proposed seam a one-line note on what it catches and what it misses.\n\nWhen the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with \"codebase-design\" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.\n\n## Anti-patterns\n\n- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.\n- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.\n- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.\n\n## Rules of the loop\n\n- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.\n- **One slice at a time.** One seam, one test, one minimal implementation per cycle.\n- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.\n",".agents/skills/tdd/agents/openai.yaml":"interface:\n  display_name: \"TDD\"\n  short_description: \"Test-driven red-green-refactor\"\n",".agents/skills/tdd/mocking.md":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n",".agents/skills/tdd/tests.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftdd%2Ftests.md -->",".agents/skills/teach/GLOSSARY-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FGLOSSARY-FORMAT.md -->",".agents/skills/teach/LEARNING-RECORD-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FLEARNING-RECORD-FORMAT.md -->",".agents/skills/teach/MISSION-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FMISSION-FORMAT.md -->",".agents/skills/teach/RESOURCES-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FRESOURCES-FORMAT.md -->",".agents/skills/teach/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FSKILL.md -->",".agents/skills/teach/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2Fagents%2Fopenai.yaml -->",".agents/skills/to-benchmark/EXAMPLE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FEXAMPLE.md -->",".agents/skills/to-benchmark/KNOWN_ISSUES.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FKNOWN_ISSUES.md -->",".agents/skills/to-benchmark/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FSKILL.md -->",".agents/skills/to-benchmark/TEMPLATE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FTEMPLATE.md -->",".agents/skills/to-questionnaire/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2FSKILL.md -->",".agents/skills/to-questionnaire/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2Fagents%2Fopenai.yaml -->",".agents/skills/to-spec/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2FSKILL.md -->",".agents/skills/to-spec/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2Fagents%2Fopenai.yaml -->",".agents/skills/to-tickets/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2FSKILL.md -->",".agents/skills/to-tickets/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2Fagents%2Fopenai.yaml -->",".agents/skills/triage/AGENT-BRIEF.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FAGENT-BRIEF.md -->",".agents/skills/triage/OUT-OF-SCOPE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FOUT-OF-SCOPE.md -->",".agents/skills/triage/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FSKILL.md -->",".agents/skills/triage/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2Fagents%2Fopenai.yaml -->",".agents/skills/wait-what/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2FSKILL.md -->",".agents/skills/wait-what/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2Fagents%2Fopenai.yaml -->",".agents/skills/wayfinder/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2FSKILL.md -->",".agents/skills/wayfinder/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2Fagents%2Fopenai.yaml -->",".agents/skills/wizard/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2FSKILL.md -->",".agents/skills/wizard/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2Fagents%2Fopenai.yaml -->",".agents/skills/writing-for-agents/SKILL-MECHANICS.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL-MECHANICS.md -->",".agents/skills/writing-for-agents/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL.md -->",".agents/skills/writing-for-agents/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2Fagents%2Fopenai.yaml -->","AGENTS.md":"# Repository guidance\n\n## Canonical context\n\n- Use `GLOSSARY.md` as the product glossary.\n- Issues live in `withcoral/coral`. Always pass `--repo withcoral/coral` to\n  `gh`; this checkout also has an unrelated `upstream` remote.\n- The PR title becomes the squash commit that release-please reads. Use\n  Conventional Commits, `type(scope): summary`, and keep the title current as\n  the branch changes. Only `feat`, `fix`, `perf`, and breaking (`type!:`)\n  titles open a release PR and reach the changelog, so give a user-visible\n  change one of those. The scope appears in the release notes, so name what a\n  user sees, not an internal codename: `ui` for Reef and Wax, never `reef`.\n  `.github/workflows/pr.yml` lists the rejected scopes.\n- Tracker conventions, triage labels, and domain-document rules are under\n  `docs/agents/`.\n\n## Durable boundaries\n\n- Keep transport and presentation adapters thin. Put domain behavior behind a\n  transport-neutral interface.\n- Read process environment only at process bootstrap. Pass explicit values to\n  domain code.\n- Route untrusted outbound HTTP through `coral-outbound::Client`. Pass the\n  bootstrap-resolved operator destination policy to domain modules. Identity and\n  inbound listener selection do not determine outbound permissions. See\n  [ADR 0008](docs/adr/0008-outbound-network-permissions.md) for composition defaults.\n- Keep cross-crate W3C propagation, safe telemetry fields, and export filtering\n  in `coral-telemetry`. Domain modules own signal timing. Application bootstrap\n  owns exporter configuration.\n- Keep generated files marked `linguist-generated` in `.gitattributes`.\n\n### Persistence\n\n- Keep domain database queries, table identifiers, row mapping, and persistence\n  encoding in `repository.rs`, `*_repository.rs`, or `repository/` modules.\n  Keep authorization decisions, lifecycle rules, and outcome selection in domain\n  code outside those files. Domain code owns transaction choreography; repository\n  facets join its transaction and retain scoping, locking, and conditional-write\n  predicates needed for atomicity. Return typed evidence rather than raw rows or\n  query expressions to domain callers.\n- Mark observable mutations with `Transaction::execute_change` in the owning\n  repository (or through its existing lifecycle/Run evidence write). Reads, row\n  locks, and worker-lease renewals use `execute`, or `fetch_optional_returning`\n  for a lock that returns its row; they must not wake activity observers or Run\n  waits. Time-dependent visibility also needs an observation deadline.\n- Open read-only work with `Database::begin_read_snapshot` and non-holding\n  checks. `Database::begin` takes SQLite's write lock at `BEGIN`, so it waits\n  behind every other writer.\n- The Dispatch Fence and the held rechecks before it read the fact rows\n  they never write (a Workspace, a Provider, a policy rule, an Account) with\n  `RowLock::Shared`\n  (`Transaction::fetch_optional_locked`; `coral_db::RowLock` documents what\n  each backend does). Other decisions still take the exclusive no-op `UPDATE`\n  hold on those rows; a row the transaction goes on to write always keeps it.\n  A row that two shared-hold decisions may both create for the first time (an\n  Account placeholder, a connection request) is inserted with\n  `ON CONFLICT DO NOTHING` and reread, since no shared hold serializes its\n  creators.\n- A waiting Invocation parks with its Run Owner and never polls or\n  subscribes to the change signal itself; the owner wakes it (the\n  Wake-ups bullet of\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md)). A\n  wake-up is a hint; the held recheck decides.\n- A nonterminal Run's row and Events are written only through its Run\n  Owner: the Program paths (Emissions, Logs, Invocation admission, held\n  rechecks, the Dispatch Fence, Invocation completion), the outside\n  requests (an approval decision, a cancellation) and the owner's timers\n  (the Run deadline, each Approval Request's and connection request's\n  deadline) alike. An Event is applied in owner memory, a row write is a\n  `ChunkWork` that joins the owner's chunk commit, and an intent (a\n  cancellation, the deadline) rides a chunk's head update or the owner's\n  terminal write; every chunk commit asserts the head the owner tracks in\n  memory. A timer is armed as an effect and fires as a message into the\n  owner's mailbox, so the clock never decides state outside the owner (ADR\n  0018): a Run's timeout and an Approval Request's expiry are decided in the\n  owner's pure `apply`, in mailbox order (when the timer fires, or first\n  when a decision, a cancel or the periodic precheck of parked waits applied\n  before it finds the deadline passed),\n  the owner's own writes read the\n  clock only for their own sample (the start mark, the terminal write and a\n  recovered owner's one chunk date a timeout they find passed; the Dispatch\n  Fence judges an approved\n  request's deadline at dispatch, contract line 3, and records no expiry),\n  and no chunk commit is predicated on the clock (contract line 5). Nothing\n  outside the owner compares `now` with those deadlines to write TimedOut\n  or Expired: readers show the recorded state beside the deadline. A\n  connection request is Account-owned and shared across Runs: the Account\n  module records its expiry when a holder reads it, and the owner's timer\n  only wakes the Invocations parked on it. Do not open a transaction that\n  holds the Run row from any of these paths, and do not write a nonterminal\n  Run's row from outside its owner. A Run whose owner retired or whose\n  process is gone without ending it gets its owner back from the\n  expired-lease sweep (the Recovery section of ADR 0018); a panicked owner\n  task's supervisor ends its Run at once instead. Retention holds and\n  deletes terminal Runs only.\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md) has the\n  request model (requests keyed by the entity they decide, the first wins).\n- A Run Owner's write ends on the database's answer, never on the clock: an\n  unanswered write (`Error::is_operational`: a lost connection, a pool\n  timeout, a lock race) means a reread and a retry with bounded backoff until\n  the answer comes or the owner has retired, and a definite answer (a\n  rejection, a claim mismatch, an ended Run, a corrupt head) stops it; the\n  Interrupted record alone retries every answer but a claim mismatch or an\n  ended Run. The worker lease is ownership between processes, renewed by\n  every commit: never write a Run whose live lease another process holds.\n  The lease never ends a Run from inside its own process. The owner's\n  own bounds do (suspect after one lease without a commit, self-interrupt\n  after three, constants in `crates/coral-run/src/execution.rs`), and the\n  supervisor of a panicked owner task writes the same one Interrupted chunk.\n- Give each independently identified entity one stable ID as its sole primary\n  key. Use a composite primary key only when the tuple is the domain identity.\n- For Workspace-owned data, every externally influenced read or write must\n  match both the Workspace and entity identity, even when the entity ID is\n  globally unique.\n- Add every schema migration to `crates/coral-db/migrations`, the one shared\n  chain. Write one portable file that both databases run. When SQLite and\n  Postgres must perform a step differently, add one file with the same name to\n  both `postgres/` and `sqlite/` instead.\n- Change a schema only by adding a migration. Never delete a migration that\n  is on `main`, or change its file name or bytes: databases created from an\n  earlier `main` must keep booting.\n  `scripts/check-migrations.sh` checks this.\n  Keep the fence that rejects state written by Coral 0.x.\n- Keep schemas portable across SQLite and Postgres and fail on schema drift;\n  do not use `IF NOT EXISTS` to hide unexpected state.\n- When a migration needs a database feature whose availability it cannot\n  ensure or diagnose clearly, such as `pg_trgm` or FTS5's trigram tokenizer,\n  check it at boot before the chain runs, as `coral_search::prepare_storage`\n  does. The check names the feature and what the operator can do about it.\n- Run shared repository behavior tests against SQLite and Postgres. Use\n  `make postgres-tests` for Rust repository tests. For Reel's Postgres product\n  evidence, use the E2E scope and cadence under Validation.\n  Both own disposable databases through `scripts/postgres.ts`.\n\n### Reef and Desktop\n\n- Wax (`apps/reef/app/wax`) owns reusable visual behavior and styling. Extend\n  its primitives when a UI needs a missing capability; app-specific modules\n  compose Wax and own layout, not a parallel set of controls or theme values.\n- When a table row opens a page, pass the path to `Table.Row`'s `to` so a\n  click anywhere in the row opens it, and link its name with `Table.RowLink`.\n  Do not make only the name a link, or style the name as a link.\n  Use `Table.useRowCursor` so ↑, ↓ and Enter reach the rows.\n- Match a filter field's text with `filterQuery` (`apps/reef/app/utils/filter-query.ts`),\n  not `includes`, so every filter reads `^`, `$` and `*` the same way. To bold\n  the matches, use Wax's `HighlightedMatches`.\n- Do not show status or meaning with color alone. Pair color with a distinct\n  icon shape or text, so color-blind users can read it (WCAG 1.4.1).\n- Browser access to Coral belongs in React Router server loaders, actions, and\n  explicit resource routes. Live updates are the one exception:\n  `apps/reef/app/lib/activity-stream.ts` holds the only streaming connection,\n  to a same-origin resource route. Loaders supply initial data; streams only\n  push later changes. Reef's `.oxlintrc.json` and\n  `app/__tests__/architecture.test.ts` enforce the rest of this boundary.\n- Add or extend Reef Vitest coverage when a change fixes a reproducible bug,\n  introduces branching behavior (validation, state transitions, or error handling),\n  or affects security or an architecture invariant. Name the failure the test\n  catches and assert observable behavior through the owning module's interface.\n  For bug fixes, verify that the regression test fails without the fix.\n- Keep tests beside the behavior they protect. Exercise existing module boundaries;\n  do not extract single-use helpers solely to test them or assert implementation\n  details. Use Storybook and Chromatic for visual states and browser tests for\n  behavior that depends on browser APIs or a complete user journey. `npm test`\n  runs every story's `play` function in Chromium, so an assertion there is a\n  test; give each behavior one home, a story or a Vitest test, and query by role\n  and label with Testing Library in both. Styling and\n  static markup changes alone do not need Vitest coverage. Vitest coverage does\n  not replace required product-journey or local/remote parity evidence.\n- Use vanilla-extract, not Tailwind.\n- Reef has one build for every deployment. Do not add a Desktop build marker\n  or branch Reef on its host. Desktop's window behavior belongs in the\n  `apps/desktop` main process.\n- Reef copy follows simplified technical English (ASD-STE100): address the\n  reader as \"you\", give one instruction per sentence in the imperative, keep\n  sentences under 20 words with one idea each, use the active voice and the\n  present tense. Do not narrate what Coral does behind the scenes (\"Coral then\n  returns you here.\", \"Coral reads it once.\", \"Coral is updating this page.\").\n  Name a consequence only when the reader must act on it or would otherwise\n  lose something. Show progress as a short status: \"Completing sign-in…\".\n  Use one word for one thing: provider, workspace, organization, operation,\n  program, account, sign in. These words are lowercase in the interface; the\n  glossary and code keep their capitals.\n\n### Tests\n\n- Test each rule once, at its owner: the crate or module that implements it.\n  Transport and route tests assert their contract (status, reason, projection)\n  and leave domain rules to the owner's tests.\n- Assert a denial's exact error variant and that the denial changed nothing. A\n  bare error check also passes on a database failure.\n- Assert deltas and domain properties, not totals. Event counts, byte sizes, and\n  page sizes move whenever unrelated behavior changes.\n- Extend the nearest shared helper (`coral-test-support` or the crate's test\n  harness) and write near-duplicate cases as one table test. After a TDD loop,\n  fold the tracer tests into that table before you open the PR.\n- Inject faults through the owning crate's API or\n  `TestDatabase::execute_fixture_sql`, so the test runs on both databases.\n  Production `#[cfg(test)]` hooks only synchronize timing; every tested path is\n  one production runs.\n\n### Credentials\n\n- Tests that use dummy credentials must select filesystem credential storage.\n  Do not write test credentials to the OS keychain.\n\n## Validation\n\nUse focused unit/integration tests during implementation. Run the applicable\nrequired gates below after the change stabilizes, then report what ran:\n\n| Change                   | Required gate                                                                                                                                                                                |\n| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Dev scripts              | `./dev test`                                                                                                                                                                                 |\n| Rust                     | `make rust-checks`                                                                                                                                                                           |\n| coral-v8 embedded JS     | `npm run check --prefix crates/coral-v8`                                                                                                                                                     |\n| Postgres-backed behavior | `make postgres-tests`                                                                                                                                                                        |\n| Reef                     | `npm run check --prefix apps/reef`, `npm run typecheck --prefix apps/reef`, `npm test --prefix apps/reef`, `npm run build --prefix apps/reef`, then `npm run test:server --prefix apps/reef` |\n| Desktop                  | `npm run check --prefix apps/desktop`, `npm test --prefix apps/desktop`, then the Reel `desktop` suite: `npm run test:e2e --prefix apps/reef -- --suite desktop`                             |\n| Runtime or Reef image    | `make docker-test`                                                                                                                                                                           |\n\n### E2E scope and cadence\n\n- Give each scenario a cross-process journey or local/remote parity claim that\n  lower-level tests cannot prove. Test form state, copy, and status tables in\n  Vitest or server tests.\n- Treat E2E as an acceptance gate, not the default edit–test loop. Batch changes\n  before running affected scenarios; use a focused browser test during debugging\n  when lower-level tests cannot reproduce the failure.\n- Select affected scenarios for browser-dependent changes. Read\n  [Reel's run guide](apps/reef/e2e/README.md) for file/folder filters and suite\n  selection. Run database and deployment variants required by the affected\n  behavior or the issue's acceptance criteria.\n- Reserve full-suite runs for the final integration checkpoint or explicit\n  acceptance requirements. With multiple agents, designate one integration agent\n  to own full-suite validation of the combined changes.\n- After a failure, rerun the failing selection while fixing it. Repeat required\n  broader validation at the final checkpoint after fixes.\n- Preserve required product-journey and local/remote parity evidence. Report\n  scenario selection, database, deployment suite, and unrun required checks;\n  a focused pass is not a full-suite pass.\n\n## Maintaining agent guidance\n\n- Keep an `AGENTS.md` rule only when it is durable, non-obvious, and changes a\n  contributor's decision.\n- Do not copy repo maps, temporary implementation details, generic engineering\n  advice, or facts that a nearby manifest already makes clear.\n- Link to a canonical spec or tool instead of copying its full contract.\n- When a rule becomes stale or enforced clearly by code, tests, or tooling,\n  delete it.\n- If a change creates a new durable contributor constraint, update the nearest\n  relevant `AGENTS.md` and validate that the guidance matches the behavior.\n","apps/AGENTS.md":"# App guidance\n\n- Format the files you change with the owning app's `npm run format`.\n","docs/agents/domain.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fdomain.md -->","docs/agents/issue-tracker.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fissue-tracker.md -->","docs/agents/triage-labels.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Ftriage-labels.md -->"},"files":{".agents/skills/add-recipe/SKILL.md":"---\nname: add-recipe\ndescription: Research an upstream service and write a Provider Recipe for it in apps/reef/recipes.\nargument-hint: \"Service name, e.g. notion\"\ndisable-model-invocation: true\n---\n\nWrite a **Provider Recipe** for the service the user names. A recipe states facts about one Upstream Service (its source, how to authenticate, its inputs and servers) so Reef can pre-fill Provider Setup. It lives at `apps/reef/recipes/<id>/recipe.yaml`, with an optional icon beside it.\n\nBefore you start, read:\n\n- `GLOSSARY.md`, the **Provider Recipe** entry.\n- ADRs 0002, 0003 and 0004 in `docs/adr/`.\n- `apps/reef/recipes/schema.json`: the recipe format. Its `description` fields are the field docs.\n- Example recipes: `linear` (MCP, OAuth discovery), `github` (OpenAPI, device code, public client) and `sentry` (region input, owner-configured client, servers).\n\n## 1. Check the id\n\nDerive the id from the service name: lowercase, `[a-z][a-z0-9_]*`. If `apps/reef/recipes/<id>/` exists, stop and ask the user whether to update that recipe or pick a new id.\n\n## 2. Find a source\n\nCoral reads two kinds of source:\n\n- An **OpenAPI 3.0 or 3.1** document, fetched once from a URL without following redirects. Swagger 2.0 fails.\n- An **MCP server over Streamable HTTP**. Standalone SSE and stdio servers fail.\n\nSearch the vendor's official docs for both. Record the URL of every doc page you rely on; the PR description cites them.\n\nDone when you hold at least one usable source URL, or have reported that none exists.\n\n## 3. Plan, then wait\n\nShow the user a short plan and wait for their approval. Cover each point:\n\n- **Recipes and ids.** One source: use the bare id. OpenAPI and MCP both: offer two recipes, `<id>` for OpenAPI and `<id>_mcp` for MCP. Give both the same `display_name` and set `service: <id>` in the MCP recipe, so the catalog shows both on one card and suggests one namespace (as `github_mcp` does). A self-hosted edition with its own host: offer `<id>_self_hosted` as well.\n- **Source URLs**, and for a third-party document, the audit result and why you pinned it or not.\n- **Authentication options** and the `default` (see below).\n- **Scopes** for each OAuth option, or why it names none.\n- **Inputs and servers**, e.g. a region.\n- **Icon** source.\n- **Gaps**: anything the format cannot express.\n\nAuthentication rules:\n\n- Include every method the service supports that a recipe `method` can express, e.g. OAuth and an API key.\n- Default to OAuth when it needs no extra setup: `oauth_discovery` for MCP, or device code or authorization code with a public client. Otherwise default to the API key or personal access token.\n- Leave the OAuth client id out, so the owner configures one (as `sentry` does). Coral could register its own application later; list that as a follow-up.\n- Name scopes whenever the service reads them from the authorization request. This includes an `oauth_discovery` server that does not advertise them (as `github_mcp` does). Request every scope it offers, read and write, with a comment naming what each grants. Coral reads and writes through providers.\n- Name no scopes when the service supplies them another way: an `oauth_discovery` server that advertises them (as `hubspot` does), or a service that takes them from the app's settings (as `attio` does). Omit `scopes` for `oauth_discovery`. The other OAuth methods require the field, so write `scopes: []`. Add a comment saying why the recipe names none, and for app settings, list the scopes the owner must turn on.\n- If the only way to authenticate needs a method the format lacks, stop and report the gap and what a new method would need. Extending the format touches Reef, proto and Rust, and is out of scope here.\n\nModel regions and similar choices as an `inputs` enum inside one recipe.\n\n## 4. Write the recipe\n\nFor each approved recipe, write `apps/reef/recipes/<id>/recipe.yaml`. Start it with `# yaml-language-server: $schema=../schema.json`, then match the shape of the example recipes.\n\n- `description` follows the pattern \"Issues, events and releases from Sentry.\"\n- Write `label` and `description` text in the Reef copy style from `AGENTS.md`.\n- Comment anything a reader cannot tell from the YAML alone.\n\nFor the icon, use the vendor's official brand SVG from their brand or press page, or the Simple Icons one. If you find no clean SVG, or its terms are unclear, leave `icons` out and list it as a follow-up.\nName the logo under `icons.light`. Reef shows it on a white plate in the light theme and a dark plate in the dark theme. If it does not read on the dark plate, e.g. a black glyph, add the vendor's official or Simple Icons light variant under `icons.dark`, named `<name>-dark.svg`. If there is no clean variant or its terms are unclear, leave `icons.dark` out and list it as a follow-up.\n\nDone when every approved recipe has its file and the plan's decisions all appear in it.\n\n## 5. Test\n\nRun, and fix until both pass:\n\n```sh\nnpm ci --prefix apps/reef   # once, if apps/reef/node_modules is missing\n(cd apps/reef && npx vitest run --project server recipes.server)\nnpm run check --prefix apps/reef\n```\n\nDo not use `npm test -- recipes.server`. It also runs the Storybook tests, which match no file and exit 1.\n\nThe recipe test also enforces rules the schema cannot, such as no undeclared `{{input.x}}` and no unused credential fields.\n\nCheck each source directly:\n\n- **OpenAPI**: fetch the URL. Confirm a 200 with no redirect, and an `openapi` field of `3.0.x` or `3.1.x`.\n- **MCP**: POST an `initialize` request to the URL. Confirm a Streamable HTTP response, or a 401 that points at OAuth when the server needs sign-in.\n\nThen give the user steps for a live test, which needs their browser and account:\n\n1. Run `./dev run` (see `docs/development.md`).\n2. In Reef, open `/workspaces/<workspace>/providers/new?recipe=<id>`.\n3. Sign in, publish the provider, and run a query against one of its tables.\n\n## 6. Summarise\n\nReport:\n\n- The files you wrote.\n- Test results, including the source checks.\n- Follow-ups: missing icon, OAuth client to register, the third-party audit result, format gaps.\n- A draft PR description that cites the vendor doc URLs.\n\nThen offer to open the PR. If the user accepts, create a branch named `<prefix>/add-<id>-recipe`, using the user's usual branch prefix, and commit there.\n",".agents/skills/add-recipe/agents/openai.yaml":"interface:\n  display_name: \"Add Recipe\"\n  short_description: \"Write a Provider Recipe for a service\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/ask-matt/PHASE-BOUNDARIES.md":"# Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *\"ok, we're done with that\"*.\n\nThe **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.\n\n## The five options\n\n| Option       | What it does                                                    |\n| ------------ | --------------------------------------------------------------- |\n| **Continue** | Stay in the session. No context switch at all.                    |\n| **`/clear`** | Empty the context window and start from nothing.                  |\n| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |\n| **Subagent** | Send the task to its own context window and get a report back.     |\n| **`/compact`** | Compress this context and seed a fresh session with the summary.  |\n\n## The tree\n\nWork top to bottom at the boundary. The first **yes** wins.\n\n**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.\n\n**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.\n\nThe cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.\n\n**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:\n\n- swapping to a **new harness** (Claude → Codex),\n- moving to a **new directory** or repo,\n- sending the work to a **colleague**,\n- or forking a side task you found **mid-phase** without derailing what you're doing.\n\nThat list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.\n\n**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.\n\n**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.\n\n`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.\n\n## Primary and secondary sources\n\nEvery move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:\n\n| Source                            | Information | Noise | Room to move |\n| --------------------------------- | ----------- | ----- | ------------ |\n| Primary (Continue)                | Full        | Lots  | Little       |\n| Secondary (`/compact`, `/handoff`) | Lossy       | Less  | Lots         |\n\nThis is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.\n\n## These are judgement calls\n\nThe questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.\n",".agents/skills/ask-matt/SKILL.md":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nBefore stating what a skill does or recommending a step be skipped, read that skill's SKILL.md: the summaries here are for orientation only.\n\nA **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `GLOSSARY.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)\n2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch: is this a multi-session build?**\n   - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. Then work the tickets one of two ways:\n     - **`/implement`** per ticket, **`/clear`ing context between each one**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed. Each ticket is self-contained, so the last one's context is disposable.\n     - **`/implement-spec`** for the whole spec in one run. It reads the tickets as a **task graph**, runs implementer subagents across the ready **frontier** in parallel, and lands everything on one **integration branch**. Reach for it when you'd rather orchestrate the build than drive each ticket yourself.\n   - **No** → **`/implement`** right here, in the same context window.\n\n   Either way, the code gets built by driving **`/tdd`** (one red-green slice at a time) and closes out with **`/code-review`**, a two-axis review (Standards + Spec) of the diff. `/implement` runs both per ticket; `/implement-spec`'s implementers each drive `/tdd`, and it runs one `/code-review` over the integration branch. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.\n\n   When the work goes up as a pull request, **`/pr`** shapes the body: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call. It's model-invoked, so the agent reaches for it whenever it writes a PR.\n\n4. **`/retro`** closes the loop. After a build, and especially one that went sideways, it looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards. The next build then starts from a better environment.\n\n### Context hygiene\n\nKeep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket. Run `/retro` in the session it's looking back on, before you clear; after clearing, point it at that session's log instead.\n\nThe limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.\n\n- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Once the fix is in, run **`/retro`** in the same session to ask what would have prevented the bug; where the real finding is that there's no good seam to lock it down, that's a job for **`/improve-codebase-architecture`**.\n\n- **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.\n\n  When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.\n\n## Codebase health\n\nNot feature work, just upkeep.\n\n- **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.\n\n## Vocabulary underneath\n\nTwo model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.\n\n- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word (\"account\" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `GLOSSARY.md` a clean glossary.\n- **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.\n\n## Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:\n\n- **Continue**: stay put. Costs nothing, loses nothing.\n- **`/clear`**: empty the window, when nothing here matters to what's next.\n- **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.\n- **Subagent**: send a tightly-scoped task to its own window and get a report back.\n- **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.\n\nRead [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `GLOSSARY.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.\n- **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.\n- **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.\n- **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.\n- **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.\n- **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.\n- **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.\n- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.\n\n## Precondition\n\n**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.\n",".agents/skills/ask-matt/agents/openai.yaml":"interface:\n  display_name: \"Ask Matt\"\n  short_description: \"Find the right skill or workflow\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/code-review/SKILL.md":"---\nname: code-review\ndescription: \"Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \\\"review since X\\\".\"\n---\n\nTwo-axis review of the diff between `HEAD` and a fixed point the user supplies:\n\n- **Standards**: does the code conform to this repo's documented coding standards?\n- **Spec**: does the code faithfully implement the originating issue / spec?\n\nBoth axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\n## Process\n\n### 1. Pin the fixed point\n\nWhatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.\n\nCapture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.\n\nBefore going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.\n\n### 2. Identify the spec source\n\nLook for the originating spec, in this order:\n\n1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.\n2. A path the user passed as an argument.\n3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.\n4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report \"no spec available\".\n\n### 3. Identify the standards sources\n\nSearch the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.\n\nOn top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:\n\n- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.\n- **Always a judgement call.** Each smell is a labelled heuristic (\"possible Feature Envy\"), never a hard violation. Like any standard here, skip anything tooling already enforces.\n\nEach smell reads *what it is* → *how to fix*; match it against the diff:\n\n- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.\n- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.\n- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.\n- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.\n- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.\n- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.\n- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.\n- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.\n- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.\n- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.\n- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.\n- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.\n\n### 4. Spawn both sub-agents in parallel\n\nIssue both sub-agent calls together, in the foreground, and aggregate the reports they return.\n\n**Standards sub-agent prompt** should include:\n\n- The full diff command and commit list.\n- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).\n- The brief: \"Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words.\"\n\n**Spec sub-agent prompt** should include:\n\n- The diff command and commit list.\n- The path or fetched contents of the spec.\n- The brief: \"Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words.\"\n\nIf the spec is missing, skip the Spec sub-agent and note this in the final report.\n\n### 5. Aggregate\n\nPresent the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).\n\nEnd with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.\n\n## Why two axes\n\nA change can pass one axis and fail the other:\n\n- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**\n- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**\n\nReporting them separately stops one axis from masking the other.\n",".agents/skills/code-review/agents/openai.yaml":"interface:\n  display_name: \"Code Review\"\n  short_description: \"Review a diff on standards and spec\"\n",".agents/skills/codebase-design/DEEPENING.md":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.\n\nRecommendation shape: *\"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network.\"*\n\n### 4. True external (Mock)\n\nThird-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.\n\n## Seam discipline\n\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.\n- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.\n",".agents/skills/codebase-design/DESIGN-IT-TWICE.md":"# Design It Twice\n\nWhen the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on \"Design It Twice\" (Ousterhout): your first idea is unlikely to be the best.\n\nUses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.\n\nPrompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:\n\n- Agent 1: \"Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility: support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller: make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params, plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs: where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.\n\nAfter comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.\n",".agents/skills/codebase-design/SKILL.md":"---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.\n- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n",".agents/skills/codebase-design/agents/openai.yaml":"interface:\n  display_name: \"Codebase Design\"\n  short_description: \"Vocabulary for deep-module design\"\n",".agents/skills/diagnosing-bugs/SKILL.md":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.\n\n## Redact\n\nThis skill has you show commands, outputs and captured artifacts. **Redact every secret first**: write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.\n\nIf the redacted output is not enough to diagnose the bug, say so and ask the user.\n\n## Phase 1: Build a feedback loop\n\n**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug (one that goes red on _this_ bug), you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one, in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug: unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) that drives the UI and asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate \"boot at state X, check, repeat\" so you can `git bisect run` it.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight, a debugging superpower.\n\n### Non-deterministic bugs\n\nThe goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not, so keep raising the rate until it's debuggable.\n\n### When you genuinely cannot build a loop\n\nStop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.\n\n### Completion criterion: a tight loop that goes red\n\nPhase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** (a script path, a test invocation, a curl) that you have **already run at least once** (show the invocation and its output, redacted), and that is:\n\n- [ ] **Red-capable**: it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not \"runs without erroring\"; it must be able to _catch this specific bug_.\n- [ ] **Deterministic**: same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast**: seconds, not minutes.\n- [ ] **Agent-runnable**: you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf you catch yourself reading code to build a theory before this command exists, **stop: jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.\n\n## Phase 2: Reproduce + minimise\n\nRun the loop. Watch it go red as the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described, not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut, and keep only what's load-bearing for the failure.\n\nWhy bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.\n\nDone when **every remaining element is load-bearing**: removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3: Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe: discard or sharpen it.\n\n**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly (\"we just deployed a change to #3\"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it; proceed with your ranking if the user is AFK.\n\n## Phase 4: Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.\n\n**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.\n\n## Phase 5: Fix + regression test\n\nWrite the regression test **before the fix**, but only if there is a **correct seam** for it.\n\nA correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.\n\n**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail. If you forced the red by mutating code or a fixture, `diff` against a pristine copy to prove the mutation landed before you trust it.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6: Cleanup\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message, so the next debugger learns\n",".agents/skills/diagnosing-bugs/agents/openai.yaml":"interface:\n  display_name: \"Diagnosing Bugs\"\n  short_description: \"Diagnose hard bugs and regressions\"\n",".agents/skills/domain-modeling/ADR-FORMAT.md":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n",".agents/skills/domain-modeling/GLOSSARY-FORMAT.md":"# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `GLOSSARY.md` at the repo root.\n\n**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Glossary Map\n\n## Contexts\n\n- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders\n- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `GLOSSARY-MAP.md` exists, read it to find contexts\n- If only a root `GLOSSARY.md` exists, single context\n- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n",".agents/skills/domain-modeling/SKILL.md":"---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── GLOSSARY.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── GLOSSARY-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── GLOSSARY.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── GLOSSARY.md\n│       └── docs/adr/\n```\n\nCreate files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. \"Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?\"\n\n### Sharpen fuzzy language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term. \"You're saying 'account': do you mean the Customer or the User? Those are different things.\"\n\n### Discuss concrete scenarios\n\nWhen domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.\n\n### Cross-reference with code\n\nWhen the user states how something works, check whether the code agrees. If you find a contradiction, surface it: \"Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?\"\n\n### Update GLOSSARY.md inline\n\nWhen a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).\n\n`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n",".agents/skills/domain-modeling/agents/openai.yaml":"interface:\n  display_name: \"Domain Modeling\"\n  short_description: \"Build and sharpen a domain model\"\n",".agents/skills/grill-me/SKILL.md":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nCall the Skill tool with \"grilling\".\n",".agents/skills/grill-me/agents/openai.yaml":"interface:\n  display_name: \"Grill Me\"\n  short_description: \"Sharpen a plan through interview\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/grill-with-docs/SKILL.md":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nCall the Skill tool twice, for \"grilling\" and \"domain-modeling\".\n",".agents/skills/grill-with-docs/agents/openai.yaml":"interface:\n  display_name: \"Grill with Docs\"\n  short_description: \"Grill a design and write its docs\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/grilling/SKILL.md":"---\nname: grilling\ndescription: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.\n---\n\nInterview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.\n\nWork the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.\n\nFormat a round like so:\n\n```\n❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n\n---\n\n❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n```\n\nWord each question so \"yes\" accepts your recommended answer.\n\nEach round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.\n\nFinding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.\n\nThe session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.\n",".agents/skills/grilling/agents/openai.yaml":"interface:\n  display_name: \"Grilling\"\n  short_description: \"Stress-test thinking a round of questions at a time\"\n",".agents/skills/handoff/SKILL.md":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS (`$TMPDIR`, else `/tmp`; `%TEMP%` on Windows) - not the current workspace.\n\nInclude a \"suggested skills\" section in the document, naming which skills the next agent should call the Skill tool for.\n\nDo not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n",".agents/skills/handoff/agents/openai.yaml":"interface:\n  display_name: \"Handoff\"\n  short_description: \"Compact a conversation into a handoff\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/implement-spec/SKILL.md":"---\nname: implement-spec\ndescription: \"Implement the result of /to-spec and /to-tickets in code.\"\ndisable-model-invocation: true\n---\n\nYou have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\nThe goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.\n\nThe tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.\n\nCommunication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.\n\n**Implementer subagents** should be run in the background where possible for maximum concurrency.\n\n## Steps\n\n1. Read the spec and tickets to understand the task graph.\n\n2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.\n\n3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.\n\n4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:\n   - confirms its worktree is based on the integration branch before starting, and resets onto it if not;\n   - calls the Skill tool with `tdd` to build the ticket;\n   - merges the integration branch tip into its own branch before reporting done\n\n5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.\n\n6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.\n\n7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.\n\n8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.\n\n9. Clean up all **implementer subagent** worktrees.\n",".agents/skills/implement-spec/agents/openai.yaml":"interface:\n  display_name: \"Implement Spec\"\n  short_description: \"Implement the result of /to-spec and /to-tickets in code.\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/implement/SKILL.md":"---\nname: implement\ndescription: \"Implement a piece of work based on a spec or set of tickets.\"\ndisable-model-invocation: true\n---\n\nImplement the work described by the user in the spec or tickets.\n\nIf the user passes a ticket reference, fetch it from the issue tracker and state its title before starting. If the reference is ambiguous, ask.\n\nCall the Skill tool with \"tdd\" where possible, at pre-agreed seams.\n\nRun typechecking regularly, single test files regularly, and the full test suite once at the end.\n\nOnce done, call the Skill tool with \"code-review\" to review the work.\n\nCommit your work to the current branch.\n",".agents/skills/implement/agents/openai.yaml":"interface:\n  display_name: \"Implement\"\n  short_description: \"Build work from a spec or tickets\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/improve-codebase-architecture/HTML-REPORT.md":"# HTML Report Format\n\nThe architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two: don't lean on Mermaid for everything, it'll start to look generic.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review for {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph. Straight into the candidates.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title**: short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **Badge row**: recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).\n- **Files**: monospaced list, `font-mono text-sm`.\n- **Before / After diagram**: the centrepiece. Two columns, side by side. See patterns below.\n- **Problem**: one sentence. What hurts.\n- **Solution**: one sentence. What changes.\n- **Wins**: bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable): one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same. Variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse a Mermaid `flowchart` or `graph` when the point is \"X calls Y calls Z, and look at the mess.\" Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for \"before: 6 round-trips; after: 1.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the \"after\" diagram to feel like one thick-bordered deep module with greyed-out internals, since Mermaid won't render that with the right weight.\n\n### Cross-section (good for layered shallowness)\n\nStack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo rectangles per module: one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).\n\n### Call-graph collapse\n\nBefore: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.\n- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise, but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow: interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**Wins bullets** name the gain in glossary terms: *\"locality: bugs concentrate in one module\"*, *\"leverage: one interface, N call sites\"*, *\"interface shrinks; implementation absorbs the wrappers\"*. Don't write *\"easier to maintain\"* or *\"cleaner code\"*, because those terms aren't in the glossary and don't earn their place.\n\nNo hedging, no throat-clearing, no \"it's worth noting that…\". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in the `/codebase-design` glossary, reach for one that is before inventing a new one.\n",".agents/skills/improve-codebase-architecture/SKILL.md":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities**: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- Call the Skill tool with \"codebase-design\" for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, \"the interface is the test surface\", \"one adapter = hypothetical seam, two = real\"). Use these terms exactly in every suggestion, and don't drift into \"component,\" \"service,\" \"API,\" or \"boundary.\"\n- The domain language in `GLOSSARY.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\n**Scope before you scan: YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:\n\n- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.\n- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.\n\nRead the project's domain glossary (`GLOSSARY.md`) and any ADRs in the area you're touching first.\n\nThen spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow**, with an interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A \"yes, concentrates\" is the signal you want.\n\n### 2. Present candidates as an HTML report\n\nWrite a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.\n\nThe report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.\n\nFor each candidate, render a card with:\n\n- **Files**: which files/modules are involved\n- **Problem**: why the current architecture is causing friction\n- **Solution**: plain English description of what would change\n- **Benefits**: explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram**: side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength**: one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**Use GLOSSARY.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `GLOSSARY.md` defines \"Order,\" talk about \"the Order intake module,\" not \"the FooBarHandler,\" and not \"the Order service.\"\n\n**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _\"contradicts ADR-0007, but worth reopening because…\"_). Don't list every theoretical refactor an ADR forbids.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce the user picks a candidate, call the Skill tool with \"grilling\" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.\n\nSide effects happen inline as decisions crystallize; call the Skill tool with \"domain-modeling\" to keep the domain model current as you go:\n\n- **Naming a deepened module after a concept not in `GLOSSARY.md`?** Add the term to `GLOSSARY.md`. Create the file lazily if it doesn't exist.\n- **Sharpening a fuzzy term during the conversation?** Update `GLOSSARY.md` right there.\n- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _\"Want me to record this as an ADR so future architecture reviews don't re-suggest it?\"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons (\"not worth it right now\") and self-evident ones.\n- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with \"codebase-design\" and use its design-it-twice parallel sub-agent pattern.\n",".agents/skills/improve-codebase-architecture/agents/openai.yaml":"interface:\n  display_name: \"Improve Codebase Architecture\"\n  short_description: \"Find and grill architecture improvements\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/pr/CREDITS.md":"# Credits\n\nThe **Summary** section's menu of visuals (pseudocode, call trees, component trees, file trees, Mermaid, diffs) and its placement guidance come from [Dex Horthy](https://github.com/dexhorthy)'s [`show-me`](https://github.com/humanlayer/humanlayer) skill, reproduced almost word for word and aimed at a diff instead of a live conversation. `pr` does not depend on `show-me` as a skill (it isn't part of this repo, and a hard dependency would break standalone installs), so the content is copied in rather than pointed at; this file is the attribution a dependency would otherwise have carried.\n",".agents/skills/pr/SKILL.md":"---\nname: pr\ndescription: \"Use when writing a PR body.\"\nmetadata:\n  credits:\n    skill: show-me\n    author: Dex Horthy\n    organisation: Humanlayer\n    url: \"https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md\"\n---\n\nUse this template for writing the PR body:\n\n```markdown\n## Summary\n\n<diagram, diff-sketch, or tree>\n\n## Evidence\n\n- **Before:** <screenshot/output/failing test run>\n  **After:** <screenshot/output/passing test run>\n\n## Merge Danger\n\n**Door:** <one-way or two-way>\n\n<optional: description>\n\n**Blast Radius:** <one-word description>\n\n<optional: potential ramifications of merge>\n```\n\n## Sections\n\nSkip all preambles and keep prose brief. Use the user's domain language from `GLOSSARY.md`.\n\n### Summary\n\nPick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```text\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1);\n  return `use the ${skillName} skill`;\n}\n```\n\n#### Guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n\n### Evidence\n\nConcrete evidence that the change works. Show a before and after.\n\nScreenshots are S-tier - when the environment is set up for it and the change is visual.\n\nExecution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode.\n\n### Merge Danger\n\nDescribe whether it's a one-way or two-way door. You can walk back through two-way doors, but not one-way doors. A PR that is cheap to roll back is lower risk. Changes that involve destructive actions or hard-to-reverse decisions are one-way doors.\n\nThe blast radius is the potential impact or scope of the changes introduced by this PR. Consider all possibilities. Examples are layout shift, breakages for consumers, mobile responsiveness, etc.\n",".agents/skills/pr/agents/openai.yaml":"interface:\n  display_name: \"PR\"\n  short_description: \"Write a PR body that's fast to review\"\n",".agents/skills/prototype/LOGIC.md":"# Logic Prototype\n\nA single, self-contained HTML file (a **shareable demo**) that lets anyone drive a state model by clicking buttons. Use this when the question is about **business logic, state transitions, or data shape**: the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.\n\nBecause it's one file with nothing to install, you can hand it to a non-developer (a designer, a PM, a domain expert) and let them feel the model for themselves. So it speaks their language, not the code's.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where someone wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like,\" this is the wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore writing code, write down what state model and what question you're prototyping. One paragraph, at the top of the demo (in a visible intro, not just a comment). A logic prototype that answers the wrong question is pure waste, so make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.\n\n### 2. Isolate the logic in a portable module\n\nPut the actual logic (the bit that's answering the question) in a single `<script>` block written as a small, pure module that could be lifted out and dropped into the real codebase later. The page around it is throwaway; this module isn't.\n\nThe right shape depends on the question:\n\n- **A pure reducer**: `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine**: explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state, just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a page. Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The page calls into it; nothing flows the other direction. This is what makes the prototype useful past its own lifetime: once the question's answered, the validated reducer / machine / function set lifts into the real module on its own.\n\n### 3. Build the shareable HTML file\n\nOne file, plain HTML/CSS/JS: no framework, no bundler, no server, everything inline so it opens by double-click and survives being emailed around. Anyone should be able to run it by opening it.\n\nWrite it for a non-developer. Every label is in **domain language**, not code: buttons and state read like the business, not the reducer. Explain in plain words what's happening.\n\nLay it out with a clean hierarchy, top to bottom:\n\n1. **Title and one-line explanation** of what this demo lets you explore (the question from step 1).\n2. **Current state**: the full relevant state, rendered as a readable panel (labelled fields, not a raw JSON dump), re-rendered after every click so the change is visible. Where it helps a non-developer follow, call out what just changed.\n3. **Free-play buttons**: one button per action, always available, so anyone can poke at the model in any order. Each click dispatches its action and re-renders the state.\n4. **Guided walkthroughs**: a set of **scenarios**, one per tab. Each tab holds a short plain-language description of the scenario (the situation it sets up and what to watch for) and underneath it, the ordered **buttons to press** for that scenario. Each step is a real button: clicking it performs that action and moves to the next step. Starting a walkthrough resets to a known initial state so the scenario runs the same way every time.\n\nChoose scenarios that demonstrate the awkward cases, the ones hard to reason about on paper: the happy path, a tricky edge case, an attempt at something that should be illegal.\n\nKeep it beautiful but restrained: clean typography, generous spacing, one accent colour. No animations, no gimmicks: nothing that competes with the state and the buttons.\n\n### 4. Hand it over\n\nSend them the file, or open it for them. They'll click through the walkthroughs and free-play whenever they get to it; the interesting moments are when they say \"wait, that shouldn't be possible\" or \"huh, I assumed X would be different\"; those are the bugs in the _idea_, which is the whole point. If they want new actions or a new scenario, add them. Prototypes evolve.\n\n### 5. Capture the answer and the prototype\n\nOnce the prototype has answered its question, capture the answer, then capture the prototype the way the [SKILL](SKILL.md) describes. The logic-specific mapping: the validated reducer / machine / function set lifts into the real module (the decision, absorbed); the HTML shell rides along to the throwaway branch that keeps the prototype as a primary source, and being one self-contained file, it stays trivially re-runnable there.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use in-memory state unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **Don't blur the logic and the page together.** If the pure module references the DOM, `document`, or button handlers, it's no longer liftable. Keep the page as a thin shell over a pure module.\n- **Don't reach for a framework, bundler, or server.** One file the recipient double-clicks; a React app or a dev server defeats \"shareable\".\n- **Don't ship the HTML shell into production.** The page is optimised for being clicked through by hand. The logic module behind it is the bit worth keeping.\n",".agents/skills/prototype/SKILL.md":"---\nname: prototype\ndescription: Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"Does this logic / state model feel right?\"** → [LOGIC.md](LOGIC.md). Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.\n- **\"What should this look like?\"** → [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.\n\nThe two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.\n\n## Rules that apply to both\n\n1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.\n2. **Trivial to run.** A UI prototype starts from one command in the project's task runner: `pnpm <name>`, `python <path>`, `bun <path>`, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it.\n3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear \"PROTOTYPE, wipe me\" name.\n4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast.\n5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.\n6. **Capture it when done.** Fold any validated decision into the real code, then capture the prototype itself as a **primary source**: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.\n",".agents/skills/prototype/UI.md":"# UI Prototype\n\nGenerate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.\n\nIf the question is about logic/state rather than what something looks like, this is the wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes: strongly prefer sub-shape A\n\nA UI prototype is much easier to judge when it's **butting up against the rest of the app**: real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.\n\n### Sub-shape A: adjustment to an existing page (preferred)\n\nThe route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay. Only the rendering swaps. This is the default; pick it unless there's a specific reason not to.\n\nIf the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow), it's still sub-shape A. Mount the variants inside the host page.\n\n### Sub-shape B: a new page (last resort)\n\nOnly use this when the thing being prototyped genuinely has no existing page to live inside (e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible).\n\nCreate a **throwaway route** following whatever routing convention the project already uses. Don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.\n\nBefore committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise, so cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants must be **structurally different**: different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit \"do not use a card grid\" guidance.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code, adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow**: cycles to the previous variant (wraps around).\n- **Variant label**: shows the current variant key and, if the variant exports a name, that name too. e.g. `B (Sidebar layout)`.\n- **Right arrow**: cycles forward (wraps around).\n\nBehaviour:\n\n- Clicking an arrow updates the URL search param (use the framework's router, e.g. `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- Hidden in production builds: gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **\"I want the header from B with the sidebar from C\"**, which is the actual design they want.\n\n### 6. Capture the answer and clean up\n\nOnce a variant has won, capture the answer (which variant and why), then capture the prototype the way the [SKILL](SKILL.md) describes. Fold the winner into the real code and move the rest onto the throwaway branch, not into main:\n\n- **Sub-shape A**: fold the winner into the existing page; drop the losing variants and the switcher from main.\n- **Sub-shape B**: promote the winning variant to a real route; drop the throwaway route and the switcher from main.\n\nThe full set of variants is the primary source, so it lands on the throwaway branch, not the bin, since variant components and the switcher left in the main branch rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.\n- **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub: the question is \"what should this look like\", not \"does the backend work\".\n- **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.\n",".agents/skills/prototype/agents/openai.yaml":"interface:\n  display_name: \"Prototype\"\n  short_description: \"Prototype to answer a design question\"\n",".agents/skills/research/SKILL.md":"---\nname: research\ndescription: Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.\n---\n\nSpin up a **background agent** to do the research, so you keep working while it reads.\n\nIts job:\n\n1. Investigate the question against **primary sources** (official docs, source code, specs, first-party APIs), not a secondary write-up of them. Follow every claim back to the source that owns it.\n2. Write the findings to a single Markdown file, citing each claim's source.\n3. Save it where the repo already keeps such notes; match the existing convention, and if there is none, put it somewhere sensible and say where.\n",".agents/skills/research/agents/openai.yaml":"interface:\n  display_name: \"Research\"\n  short_description: \"Research from high-trust sources\"\n",".agents/skills/retro/SKILL.md":"---\nname: retro\ndescription: \"Conduct a retrospective on a coding session.\"\ndisable-model-invocation: true\n---\n\nThe user has asked for a **retrospective**. You are suggesting improvements to the coding agent's **environment** to improve future runs.\n\n## Steps\n\n1. Call the Skill tool with `writing-for-agents` for the writing style guide.\n\n2. Read the primary sources for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.\n\n3. Look for candidates for improvement in these categories.\n\n- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** make it easier? _Use when_ the session took a long time to find a piece of information.\n- **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but sits unwired or silently broken is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a standing missed opportunity, not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all.\n- **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a deterministic check, full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **judgement calls** (cross-file consistency, \"matches the surrounding style,\" anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake.\n- **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope.\n- **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call.\n- **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy.\n- **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.\n\n4. Present these candidates to the user, in order of severity.\n\n## Reference\n\n### Implementation vs Review\n\nRemember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.\n\nThe review agent has the least context pressure - it receives a diff, so no exploration needed. It often does not need to write code or debug.\n\nThis means that the review agent should be responsible for imposing coding standards, not the implementation agent.\n\n### Files\n\nYou have access to several files in the repo:\n\n- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be used incredibly sparingly, usually only for **navigation pointers** to other files.\n- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.\n- Docs: use docs as references files, pointed to by other files. Look for existing docs before writing new ones.\n- Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.\n",".agents/skills/retro/agents/openai.yaml":"interface:\n  display_name: \"Retro\"\n  short_description: \"Conduct a retrospective on a coding session.\"\npolicy:\n  allow_implicit_invocation: false\n",".agents/skills/show-me/SKILL.md":"---\nname: show-me\ndescription: Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.\ndisable-model-invocation: true\n---\n\nHelp the user understand the current topic of conversation visually. Skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```tsx\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1)\n  return `use the ${skillName} skill`\n}\n```\n\n- For a visual UI, layout, state comparison, or concept too dense for Mermaid, write one focused HTML file — a diagram, an infographic, or a short slide deck, whichever fits the point. Match the product's colors, type, spacing, and components; use real labels and data; support desktop and mobile. Then open it for the user:\n\n```\nBash(open path/to/show-me-{description}.html)\n```\n\n### guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n",".agents/skills/show-me/agents/openai.yaml":"policy:\n  allow_implicit_invocation: false\n",".agents/skills/tdd/SKILL.md":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\nTDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\n## What a good test is\n\nTests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: \"user can checkout with valid cart\" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Seams: where tests go\n\nA **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.\n\n**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.\n\nAsk: \"What's the public interface, and which seams should we test?\" Give each proposed seam a one-line note on what it catches and what it misses.\n\nWhen the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with \"codebase-design\" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.\n\n## Anti-patterns\n\n- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.\n- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.\n- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.\n\n## Rules of the loop\n\n- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.\n- **One slice at a time.** One seam, one test, one minimal implementation per cycle.\n- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.\n",".agents/skills/tdd/agents/openai.yaml":"interface:\n  display_name: \"TDD\"\n  short_description: \"Test-driven red-green-refactor\"\n",".agents/skills/tdd/mocking.md":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n",".agents/skills/tdd/tests.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftdd%2Ftests.md -->",".agents/skills/teach/GLOSSARY-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FGLOSSARY-FORMAT.md -->",".agents/skills/teach/LEARNING-RECORD-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FLEARNING-RECORD-FORMAT.md -->",".agents/skills/teach/MISSION-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FMISSION-FORMAT.md -->",".agents/skills/teach/RESOURCES-FORMAT.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FRESOURCES-FORMAT.md -->",".agents/skills/teach/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FSKILL.md -->",".agents/skills/teach/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2Fagents%2Fopenai.yaml -->",".agents/skills/to-benchmark/EXAMPLE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FEXAMPLE.md -->",".agents/skills/to-benchmark/KNOWN_ISSUES.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FKNOWN_ISSUES.md -->",".agents/skills/to-benchmark/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FSKILL.md -->",".agents/skills/to-benchmark/TEMPLATE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FTEMPLATE.md -->",".agents/skills/to-questionnaire/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2FSKILL.md -->",".agents/skills/to-questionnaire/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2Fagents%2Fopenai.yaml -->",".agents/skills/to-spec/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2FSKILL.md -->",".agents/skills/to-spec/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2Fagents%2Fopenai.yaml -->",".agents/skills/to-tickets/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2FSKILL.md -->",".agents/skills/to-tickets/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2Fagents%2Fopenai.yaml -->",".agents/skills/triage/AGENT-BRIEF.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FAGENT-BRIEF.md -->",".agents/skills/triage/OUT-OF-SCOPE.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FOUT-OF-SCOPE.md -->",".agents/skills/triage/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FSKILL.md -->",".agents/skills/triage/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2Fagents%2Fopenai.yaml -->",".agents/skills/wait-what/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2FSKILL.md -->",".agents/skills/wait-what/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2Fagents%2Fopenai.yaml -->",".agents/skills/wayfinder/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2FSKILL.md -->",".agents/skills/wayfinder/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2Fagents%2Fopenai.yaml -->",".agents/skills/wizard/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2FSKILL.md -->",".agents/skills/wizard/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2Fagents%2Fopenai.yaml -->",".agents/skills/writing-for-agents/SKILL-MECHANICS.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL-MECHANICS.md -->",".agents/skills/writing-for-agents/SKILL.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL.md -->",".agents/skills/writing-for-agents/agents/openai.yaml":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2Fagents%2Fopenai.yaml -->","AGENTS.md":"# Repository guidance\n\n## Canonical context\n\n- Use `GLOSSARY.md` as the product glossary.\n- Issues live in `withcoral/coral`. Always pass `--repo withcoral/coral` to\n  `gh`; this checkout also has an unrelated `upstream` remote.\n- The PR title becomes the squash commit that release-please reads. Use\n  Conventional Commits, `type(scope): summary`, and keep the title current as\n  the branch changes. Only `feat`, `fix`, `perf`, and breaking (`type!:`)\n  titles open a release PR and reach the changelog, so give a user-visible\n  change one of those. The scope appears in the release notes, so name what a\n  user sees, not an internal codename: `ui` for Reef and Wax, never `reef`.\n  `.github/workflows/pr.yml` lists the rejected scopes.\n- Tracker conventions, triage labels, and domain-document rules are under\n  `docs/agents/`.\n\n## Durable boundaries\n\n- Keep transport and presentation adapters thin. Put domain behavior behind a\n  transport-neutral interface.\n- Read process environment only at process bootstrap. Pass explicit values to\n  domain code.\n- Route untrusted outbound HTTP through `coral-outbound::Client`. Pass the\n  bootstrap-resolved operator destination policy to domain modules. Identity and\n  inbound listener selection do not determine outbound permissions. See\n  [ADR 0008](docs/adr/0008-outbound-network-permissions.md) for composition defaults.\n- Keep cross-crate W3C propagation, safe telemetry fields, and export filtering\n  in `coral-telemetry`. Domain modules own signal timing. Application bootstrap\n  owns exporter configuration.\n- Keep generated files marked `linguist-generated` in `.gitattributes`.\n\n### Persistence\n\n- Keep domain database queries, table identifiers, row mapping, and persistence\n  encoding in `repository.rs`, `*_repository.rs`, or `repository/` modules.\n  Keep authorization decisions, lifecycle rules, and outcome selection in domain\n  code outside those files. Domain code owns transaction choreography; repository\n  facets join its transaction and retain scoping, locking, and conditional-write\n  predicates needed for atomicity. Return typed evidence rather than raw rows or\n  query expressions to domain callers.\n- Mark observable mutations with `Transaction::execute_change` in the owning\n  repository (or through its existing lifecycle/Run evidence write). Reads, row\n  locks, and worker-lease renewals use `execute`, or `fetch_optional_returning`\n  for a lock that returns its row; they must not wake activity observers or Run\n  waits. Time-dependent visibility also needs an observation deadline.\n- Open read-only work with `Database::begin_read_snapshot` and non-holding\n  checks. `Database::begin` takes SQLite's write lock at `BEGIN`, so it waits\n  behind every other writer.\n- The Dispatch Fence and the held rechecks before it read the fact rows\n  they never write (a Workspace, a Provider, a policy rule, an Account) with\n  `RowLock::Shared`\n  (`Transaction::fetch_optional_locked`; `coral_db::RowLock` documents what\n  each backend does). Other decisions still take the exclusive no-op `UPDATE`\n  hold on those rows; a row the transaction goes on to write always keeps it.\n  A row that two shared-hold decisions may both create for the first time (an\n  Account placeholder, a connection request) is inserted with\n  `ON CONFLICT DO NOTHING` and reread, since no shared hold serializes its\n  creators.\n- A waiting Invocation parks with its Run Owner and never polls or\n  subscribes to the change signal itself; the owner wakes it (the\n  Wake-ups bullet of\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md)). A\n  wake-up is a hint; the held recheck decides.\n- A nonterminal Run's row and Events are written only through its Run\n  Owner: the Program paths (Emissions, Logs, Invocation admission, held\n  rechecks, the Dispatch Fence, Invocation completion), the outside\n  requests (an approval decision, a cancellation) and the owner's timers\n  (the Run deadline, each Approval Request's and connection request's\n  deadline) alike. An Event is applied in owner memory, a row write is a\n  `ChunkWork` that joins the owner's chunk commit, and an intent (a\n  cancellation, the deadline) rides a chunk's head update or the owner's\n  terminal write; every chunk commit asserts the head the owner tracks in\n  memory. A timer is armed as an effect and fires as a message into the\n  owner's mailbox, so the clock never decides state outside the owner (ADR\n  0018): a Run's timeout and an Approval Request's expiry are decided in the\n  owner's pure `apply`, in mailbox order (when the timer fires, or first\n  when a decision, a cancel or the periodic precheck of parked waits applied\n  before it finds the deadline passed),\n  the owner's own writes read the\n  clock only for their own sample (the start mark, the terminal write and a\n  recovered owner's one chunk date a timeout they find passed; the Dispatch\n  Fence judges an approved\n  request's deadline at dispatch, contract line 3, and records no expiry),\n  and no chunk commit is predicated on the clock (contract line 5). Nothing\n  outside the owner compares `now` with those deadlines to write TimedOut\n  or Expired: readers show the recorded state beside the deadline. A\n  connection request is Account-owned and shared across Runs: the Account\n  module records its expiry when a holder reads it, and the owner's timer\n  only wakes the Invocations parked on it. Do not open a transaction that\n  holds the Run row from any of these paths, and do not write a nonterminal\n  Run's row from outside its owner. A Run whose owner retired or whose\n  process is gone without ending it gets its owner back from the\n  expired-lease sweep (the Recovery section of ADR 0018); a panicked owner\n  task's supervisor ends its Run at once instead. Retention holds and\n  deletes terminal Runs only.\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md) has the\n  request model (requests keyed by the entity they decide, the first wins).\n- A Run Owner's write ends on the database's answer, never on the clock: an\n  unanswered write (`Error::is_operational`: a lost connection, a pool\n  timeout, a lock race) means a reread and a retry with bounded backoff until\n  the answer comes or the owner has retired, and a definite answer (a\n  rejection, a claim mismatch, an ended Run, a corrupt head) stops it; the\n  Interrupted record alone retries every answer but a claim mismatch or an\n  ended Run. The worker lease is ownership between processes, renewed by\n  every commit: never write a Run whose live lease another process holds.\n  The lease never ends a Run from inside its own process. The owner's\n  own bounds do (suspect after one lease without a commit, self-interrupt\n  after three, constants in `crates/coral-run/src/execution.rs`), and the\n  supervisor of a panicked owner task writes the same one Interrupted chunk.\n- Give each independently identified entity one stable ID as its sole primary\n  key. Use a composite primary key only when the tuple is the domain identity.\n- For Workspace-owned data, every externally influenced read or write must\n  match both the Workspace and entity identity, even when the entity ID is\n  globally unique.\n- Add every schema migration to `crates/coral-db/migrations`, the one shared\n  chain. Write one portable file that both databases run. When SQLite and\n  Postgres must perform a step differently, add one file with the same name to\n  both `postgres/` and `sqlite/` instead.\n- Change a schema only by adding a migration. Never delete a migration that\n  is on `main`, or change its file name or bytes: databases created from an\n  earlier `main` must keep booting.\n  `scripts/check-migrations.sh` checks this.\n  Keep the fence that rejects state written by Coral 0.x.\n- Keep schemas portable across SQLite and Postgres and fail on schema drift;\n  do not use `IF NOT EXISTS` to hide unexpected state.\n- When a migration needs a database feature whose availability it cannot\n  ensure or diagnose clearly, such as `pg_trgm` or FTS5's trigram tokenizer,\n  check it at boot before the chain runs, as `coral_search::prepare_storage`\n  does. The check names the feature and what the operator can do about it.\n- Run shared repository behavior tests against SQLite and Postgres. Use\n  `make postgres-tests` for Rust repository tests. For Reel's Postgres product\n  evidence, use the E2E scope and cadence under Validation.\n  Both own disposable databases through `scripts/postgres.ts`.\n\n### Reef and Desktop\n\n- Wax (`apps/reef/app/wax`) owns reusable visual behavior and styling. Extend\n  its primitives when a UI needs a missing capability; app-specific modules\n  compose Wax and own layout, not a parallel set of controls or theme values.\n- When a table row opens a page, pass the path to `Table.Row`'s `to` so a\n  click anywhere in the row opens it, and link its name with `Table.RowLink`.\n  Do not make only the name a link, or style the name as a link.\n  Use `Table.useRowCursor` so ↑, ↓ and Enter reach the rows.\n- Match a filter field's text with `filterQuery` (`apps/reef/app/utils/filter-query.ts`),\n  not `includes`, so every filter reads `^`, `$` and `*` the same way. To bold\n  the matches, use Wax's `HighlightedMatches`.\n- Do not show status or meaning with color alone. Pair color with a distinct\n  icon shape or text, so color-blind users can read it (WCAG 1.4.1).\n- Browser access to Coral belongs in React Router server loaders, actions, and\n  explicit resource routes. Live updates are the one exception:\n  `apps/reef/app/lib/activity-stream.ts` holds the only streaming connection,\n  to a same-origin resource route. Loaders supply initial data; streams only\n  push later changes. Reef's `.oxlintrc.json` and\n  `app/__tests__/architecture.test.ts` enforce the rest of this boundary.\n- Add or extend Reef Vitest coverage when a change fixes a reproducible bug,\n  introduces branching behavior (validation, state transitions, or error handling),\n  or affects security or an architecture invariant. Name the failure the test\n  catches and assert observable behavior through the owning module's interface.\n  For bug fixes, verify that the regression test fails without the fix.\n- Keep tests beside the behavior they protect. Exercise existing module boundaries;\n  do not extract single-use helpers solely to test them or assert implementation\n  details. Use Storybook and Chromatic for visual states and browser tests for\n  behavior that depends on browser APIs or a complete user journey. `npm test`\n  runs every story's `play` function in Chromium, so an assertion there is a\n  test; give each behavior one home, a story or a Vitest test, and query by role\n  and label with Testing Library in both. Styling and\n  static markup changes alone do not need Vitest coverage. Vitest coverage does\n  not replace required product-journey or local/remote parity evidence.\n- Use vanilla-extract, not Tailwind.\n- Reef has one build for every deployment. Do not add a Desktop build marker\n  or branch Reef on its host. Desktop's window behavior belongs in the\n  `apps/desktop` main process.\n- Reef copy follows simplified technical English (ASD-STE100): address the\n  reader as \"you\", give one instruction per sentence in the imperative, keep\n  sentences under 20 words with one idea each, use the active voice and the\n  present tense. Do not narrate what Coral does behind the scenes (\"Coral then\n  returns you here.\", \"Coral reads it once.\", \"Coral is updating this page.\").\n  Name a consequence only when the reader must act on it or would otherwise\n  lose something. Show progress as a short status: \"Completing sign-in…\".\n  Use one word for one thing: provider, workspace, organization, operation,\n  program, account, sign in. These words are lowercase in the interface; the\n  glossary and code keep their capitals.\n\n### Tests\n\n- Test each rule once, at its owner: the crate or module that implements it.\n  Transport and route tests assert their contract (status, reason, projection)\n  and leave domain rules to the owner's tests.\n- Assert a denial's exact error variant and that the denial changed nothing. A\n  bare error check also passes on a database failure.\n- Assert deltas and domain properties, not totals. Event counts, byte sizes, and\n  page sizes move whenever unrelated behavior changes.\n- Extend the nearest shared helper (`coral-test-support` or the crate's test\n  harness) and write near-duplicate cases as one table test. After a TDD loop,\n  fold the tracer tests into that table before you open the PR.\n- Inject faults through the owning crate's API or\n  `TestDatabase::execute_fixture_sql`, so the test runs on both databases.\n  Production `#[cfg(test)]` hooks only synchronize timing; every tested path is\n  one production runs.\n\n### Credentials\n\n- Tests that use dummy credentials must select filesystem credential storage.\n  Do not write test credentials to the OS keychain.\n\n## Validation\n\nUse focused unit/integration tests during implementation. Run the applicable\nrequired gates below after the change stabilizes, then report what ran:\n\n| Change                   | Required gate                                                                                                                                                                                |\n| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Dev scripts              | `./dev test`                                                                                                                                                                                 |\n| Rust                     | `make rust-checks`                                                                                                                                                                           |\n| coral-v8 embedded JS     | `npm run check --prefix crates/coral-v8`                                                                                                                                                     |\n| Postgres-backed behavior | `make postgres-tests`                                                                                                                                                                        |\n| Reef                     | `npm run check --prefix apps/reef`, `npm run typecheck --prefix apps/reef`, `npm test --prefix apps/reef`, `npm run build --prefix apps/reef`, then `npm run test:server --prefix apps/reef` |\n| Desktop                  | `npm run check --prefix apps/desktop`, `npm test --prefix apps/desktop`, then the Reel `desktop` suite: `npm run test:e2e --prefix apps/reef -- --suite desktop`                             |\n| Runtime or Reef image    | `make docker-test`                                                                                                                                                                           |\n\n### E2E scope and cadence\n\n- Give each scenario a cross-process journey or local/remote parity claim that\n  lower-level tests cannot prove. Test form state, copy, and status tables in\n  Vitest or server tests.\n- Treat E2E as an acceptance gate, not the default edit–test loop. Batch changes\n  before running affected scenarios; use a focused browser test during debugging\n  when lower-level tests cannot reproduce the failure.\n- Select affected scenarios for browser-dependent changes. Read\n  [Reel's run guide](apps/reef/e2e/README.md) for file/folder filters and suite\n  selection. Run database and deployment variants required by the affected\n  behavior or the issue's acceptance criteria.\n- Reserve full-suite runs for the final integration checkpoint or explicit\n  acceptance requirements. With multiple agents, designate one integration agent\n  to own full-suite validation of the combined changes.\n- After a failure, rerun the failing selection while fixing it. Repeat required\n  broader validation at the final checkpoint after fixes.\n- Preserve required product-journey and local/remote parity evidence. Report\n  scenario selection, database, deployment suite, and unrun required checks;\n  a focused pass is not a full-suite pass.\n\n## Maintaining agent guidance\n\n- Keep an `AGENTS.md` rule only when it is durable, non-obvious, and changes a\n  contributor's decision.\n- Do not copy repo maps, temporary implementation details, generic engineering\n  advice, or facts that a nearby manifest already makes clear.\n- Link to a canonical spec or tool instead of copying its full contract.\n- When a rule becomes stale or enforced clearly by code, tests, or tooling,\n  delete it.\n- If a change creates a new durable contributor constraint, update the nearest\n  relevant `AGENTS.md` and validate that the guidance matches the behavior.\n","apps/AGENTS.md":"# App guidance\n\n- Format the files you change with the owning app's `npm run format`.\n","docs/agents/domain.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fdomain.md -->","docs/agents/issue-tracker.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fissue-tracker.md -->","docs/agents/triage-labels.md":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Ftriage-labels.md -->"},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# Repository guidance\n\n## Canonical context\n\n- Use `GLOSSARY.md` as the product glossary.\n- Issues live in `withcoral/coral`. Always pass `--repo withcoral/coral` to\n  `gh`; this checkout also has an unrelated `upstream` remote.\n- The PR title becomes the squash commit that release-please reads. Use\n  Conventional Commits, `type(scope): summary`, and keep the title current as\n  the branch changes. Only `feat`, `fix`, `perf`, and breaking (`type!:`)\n  titles open a release PR and reach the changelog, so give a user-visible\n  change one of those. The scope appears in the release notes, so name what a\n  user sees, not an internal codename: `ui` for Reef and Wax, never `reef`.\n  `.github/workflows/pr.yml` lists the rejected scopes.\n- Tracker conventions, triage labels, and domain-document rules are under\n  `docs/agents/`.\n\n## Durable boundaries\n\n- Keep transport and presentation adapters thin. Put domain behavior behind a\n  transport-neutral interface.\n- Read process environment only at process bootstrap. Pass explicit values to\n  domain code.\n- Route untrusted outbound HTTP through `coral-outbound::Client`. Pass the\n  bootstrap-resolved operator destination policy to domain modules. Identity and\n  inbound listener selection do not determine outbound permissions. See\n  [ADR 0008](docs/adr/0008-outbound-network-permissions.md) for composition defaults.\n- Keep cross-crate W3C propagation, safe telemetry fields, and export filtering\n  in `coral-telemetry`. Domain modules own signal timing. Application bootstrap\n  owns exporter configuration.\n- Keep generated files marked `linguist-generated` in `.gitattributes`.\n\n### Persistence\n\n- Keep domain database queries, table identifiers, row mapping, and persistence\n  encoding in `repository.rs`, `*_repository.rs`, or `repository/` modules.\n  Keep authorization decisions, lifecycle rules, and outcome selection in domain\n  code outside those files. Domain code owns transaction choreography; repository\n  facets join its transaction and retain scoping, locking, and conditional-write\n  predicates needed for atomicity. Return typed evidence rather than raw rows or\n  query expressions to domain callers.\n- Mark observable mutations with `Transaction::execute_change` in the owning\n  repository (or through its existing lifecycle/Run evidence write). Reads, row\n  locks, and worker-lease renewals use `execute`, or `fetch_optional_returning`\n  for a lock that returns its row; they must not wake activity observers or Run\n  waits. Time-dependent visibility also needs an observation deadline.\n- Open read-only work with `Database::begin_read_snapshot` and non-holding\n  checks. `Database::begin` takes SQLite's write lock at `BEGIN`, so it waits\n  behind every other writer.\n- The Dispatch Fence and the held rechecks before it read the fact rows\n  they never write (a Workspace, a Provider, a policy rule, an Account) with\n  `RowLock::Shared`\n  (`Transaction::fetch_optional_locked`; `coral_db::RowLock` documents what\n  each backend does). Other decisions still take the exclusive no-op `UPDATE`\n  hold on those rows; a row the transaction goes on to write always keeps it.\n  A row that two shared-hold decisions may both create for the first time (an\n  Account placeholder, a connection request) is inserted with\n  `ON CONFLICT DO NOTHING` and reread, since no shared hold serializes its\n  creators.\n- A waiting Invocation parks with its Run Owner and never polls or\n  subscribes to the change signal itself; the owner wakes it (the\n  Wake-ups bullet of\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md)). A\n  wake-up is a hint; the held recheck decides.\n- A nonterminal Run's row and Events are written only through its Run\n  Owner: the Program paths (Emissions, Logs, Invocation admission, held\n  rechecks, the Dispatch Fence, Invocation completion), the outside\n  requests (an approval decision, a cancellation) and the owner's timers\n  (the Run deadline, each Approval Request's and connection request's\n  deadline) alike. An Event is applied in owner memory, a row write is a\n  `ChunkWork` that joins the owner's chunk commit, and an intent (a\n  cancellation, the deadline) rides a chunk's head update or the owner's\n  terminal write; every chunk commit asserts the head the owner tracks in\n  memory. A timer is armed as an effect and fires as a message into the\n  owner's mailbox, so the clock never decides state outside the owner (ADR\n  0018): a Run's timeout and an Approval Request's expiry are decided in the\n  owner's pure `apply`, in mailbox order (when the timer fires, or first\n  when a decision, a cancel or the periodic precheck of parked waits applied\n  before it finds the deadline passed),\n  the owner's own writes read the\n  clock only for their own sample (the start mark, the terminal write and a\n  recovered owner's one chunk date a timeout they find passed; the Dispatch\n  Fence judges an approved\n  request's deadline at dispatch, contract line 3, and records no expiry),\n  and no chunk commit is predicated on the clock (contract line 5). Nothing\n  outside the owner compares `now` with those deadlines to write TimedOut\n  or Expired: readers show the recorded state beside the deadline. A\n  connection request is Account-owned and shared across Runs: the Account\n  module records its expiry when a holder reads it, and the owner's timer\n  only wakes the Invocations parked on it. Do not open a transaction that\n  holds the Run row from any of these paths, and do not write a nonterminal\n  Run's row from outside its owner. A Run whose owner retired or whose\n  process is gone without ending it gets its owner back from the\n  expired-lease sweep (the Recovery section of ADR 0018); a panicked owner\n  task's supervisor ends its Run at once instead. Retention holds and\n  deletes terminal Runs only.\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md) has the\n  request model (requests keyed by the entity they decide, the first wins).\n- A Run Owner's write ends on the database's answer, never on the clock: an\n  unanswered write (`Error::is_operational`: a lost connection, a pool\n  timeout, a lock race) means a reread and a retry with bounded backoff until\n  the answer comes or the owner has retired, and a definite answer (a\n  rejection, a claim mismatch, an ended Run, a corrupt head) stops it; the\n  Interrupted record alone retries every answer but a claim mismatch or an\n  ended Run. The worker lease is ownership between processes, renewed by\n  every commit: never write a Run whose live lease another process holds.\n  The lease never ends a Run from inside its own process. The owner's\n  own bounds do (suspect after one lease without a commit, self-interrupt\n  after three, constants in `crates/coral-run/src/execution.rs`), and the\n  supervisor of a panicked owner task writes the same one Interrupted chunk.\n- Give each independently identified entity one stable ID as its sole primary\n  key. Use a composite primary key only when the tuple is the domain identity.\n- For Workspace-owned data, every externally influenced read or write must\n  match both the Workspace and entity identity, even when the entity ID is\n  globally unique.\n- Add every schema migration to `crates/coral-db/migrations`, the one shared\n  chain. Write one portable file that both databases run. When SQLite and\n  Postgres must perform a step differently, add one file with the same name to\n  both `postgres/` and `sqlite/` instead.\n- Change a schema only by adding a migration. Never delete a migration that\n  is on `main`, or change its file name or bytes: databases created from an\n  earlier `main` must keep booting.\n  `scripts/check-migrations.sh` checks this.\n  Keep the fence that rejects state written by Coral 0.x.\n- Keep schemas portable across SQLite and Postgres and fail on schema drift;\n  do not use `IF NOT EXISTS` to hide unexpected state.\n- When a migration needs a database feature whose availability it cannot\n  ensure or diagnose clearly, such as `pg_trgm` or FTS5's trigram tokenizer,\n  check it at boot before the chain runs, as `coral_search::prepare_storage`\n  does. The check names the feature and what the operator can do about it.\n- Run shared repository behavior tests against SQLite and Postgres. Use\n  `make postgres-tests` for Rust repository tests. For Reel's Postgres product\n  evidence, use the E2E scope and cadence under Validation.\n  Both own disposable databases through `scripts/postgres.ts`.\n\n### Reef and Desktop\n\n- Wax (`apps/reef/app/wax`) owns reusable visual behavior and styling. Extend\n  its primitives when a UI needs a missing capability; app-specific modules\n  compose Wax and own layout, not a parallel set of controls or theme values.\n- When a table row opens a page, pass the path to `Table.Row`'s `to` so a\n  click anywhere in the row opens it, and link its name with `Table.RowLink`.\n  Do not make only the name a link, or style the name as a link.\n  Use `Table.useRowCursor` so ↑, ↓ and Enter reach the rows.\n- Match a filter field's text with `filterQuery` (`apps/reef/app/utils/filter-query.ts`),\n  not `includes`, so every filter reads `^`, `$` and `*` the same way. To bold\n  the matches, use Wax's `HighlightedMatches`.\n- Do not show status or meaning with color alone. Pair color with a distinct\n  icon shape or text, so color-blind users can read it (WCAG 1.4.1).\n- Browser access to Coral belongs in React Router server loaders, actions, and\n  explicit resource routes. Live updates are the one exception:\n  `apps/reef/app/lib/activity-stream.ts` holds the only streaming connection,\n  to a same-origin resource route. Loaders supply initial data; streams only\n  push later changes. Reef's `.oxlintrc.json` and\n  `app/__tests__/architecture.test.ts` enforce the rest of this boundary.\n- Add or extend Reef Vitest coverage when a change fixes a reproducible bug,\n  introduces branching behavior (validation, state transitions, or error handling),\n  or affects security or an architecture invariant. Name the failure the test\n  catches and assert observable behavior through the owning module's interface.\n  For bug fixes, verify that the regression test fails without the fix.\n- Keep tests beside the behavior they protect. Exercise existing module boundaries;\n  do not extract single-use helpers solely to test them or assert implementation\n  details. Use Storybook and Chromatic for visual states and browser tests for\n  behavior that depends on browser APIs or a complete user journey. `npm test`\n  runs every story's `play` function in Chromium, so an assertion there is a\n  test; give each behavior one home, a story or a Vitest test, and query by role\n  and label with Testing Library in both. Styling and\n  static markup changes alone do not need Vitest coverage. Vitest coverage does\n  not replace required product-journey or local/remote parity evidence.\n- Use vanilla-extract, not Tailwind.\n- Reef has one build for every deployment. Do not add a Desktop build marker\n  or branch Reef on its host. Desktop's window behavior belongs in the\n  `apps/desktop` main process.\n- Reef copy follows simplified technical English (ASD-STE100): address the\n  reader as \"you\", give one instruction per sentence in the imperative, keep\n  sentences under 20 words with one idea each, use the active voice and the\n  present tense. Do not narrate what Coral does behind the scenes (\"Coral then\n  returns you here.\", \"Coral reads it once.\", \"Coral is updating this page.\").\n  Name a consequence only when the reader must act on it or would otherwise\n  lose something. Show progress as a short status: \"Completing sign-in…\".\n  Use one word for one thing: provider, workspace, organization, operation,\n  program, account, sign in. These words are lowercase in the interface; the\n  glossary and code keep their capitals.\n\n### Tests\n\n- Test each rule once, at its owner: the crate or module that implements it.\n  Transport and route tests assert their contract (status, reason, projection)\n  and leave domain rules to the owner's tests.\n- Assert a denial's exact error variant and that the denial changed nothing. A\n  bare error check also passes on a database failure.\n- Assert deltas and domain properties, not totals. Event counts, byte sizes, and\n  page sizes move whenever unrelated behavior changes.\n- Extend the nearest shared helper (`coral-test-support` or the crate's test\n  harness) and write near-duplicate cases as one table test. After a TDD loop,\n  fold the tracer tests into that table before you open the PR.\n- Inject faults through the owning crate's API or\n  `TestDatabase::execute_fixture_sql`, so the test runs on both databases.\n  Production `#[cfg(test)]` hooks only synchronize timing; every tested path is\n  one production runs.\n\n### Credentials\n\n- Tests that use dummy credentials must select filesystem credential storage.\n  Do not write test credentials to the OS keychain.\n\n## Validation\n\nUse focused unit/integration tests during implementation. Run the applicable\nrequired gates below after the change stabilizes, then report what ran:\n\n| Change                   | Required gate                                                                                                                                                                                |\n| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Dev scripts              | `./dev test`                                                                                                                                                                                 |\n| Rust                     | `make rust-checks`                                                                                                                                                                           |\n| coral-v8 embedded JS     | `npm run check --prefix crates/coral-v8`                                                                                                                                                     |\n| Postgres-backed behavior | `make postgres-tests`                                                                                                                                                                        |\n| Reef                     | `npm run check --prefix apps/reef`, `npm run typecheck --prefix apps/reef`, `npm test --prefix apps/reef`, `npm run build --prefix apps/reef`, then `npm run test:server --prefix apps/reef` |\n| Desktop                  | `npm run check --prefix apps/desktop`, `npm test --prefix apps/desktop`, then the Reel `desktop` suite: `npm run test:e2e --prefix apps/reef -- --suite desktop`                             |\n| Runtime or Reef image    | `make docker-test`                                                                                                                                                                           |\n\n### E2E scope and cadence\n\n- Give each scenario a cross-process journey or local/remote parity claim that\n  lower-level tests cannot prove. Test form state, copy, and status tables in\n  Vitest or server tests.\n- Treat E2E as an acceptance gate, not the default edit–test loop. Batch changes\n  before running affected scenarios; use a focused browser test during debugging\n  when lower-level tests cannot reproduce the failure.\n- Select affected scenarios for browser-dependent changes. Read\n  [Reel's run guide](apps/reef/e2e/README.md) for file/folder filters and suite\n  selection. Run database and deployment variants required by the affected\n  behavior or the issue's acceptance criteria.\n- Reserve full-suite runs for the final integration checkpoint or explicit\n  acceptance requirements. With multiple agents, designate one integration agent\n  to own full-suite validation of the combined changes.\n- After a failure, rerun the failing selection while fixing it. Repeat required\n  broader validation at the final checkpoint after fixes.\n- Preserve required product-journey and local/remote parity evidence. Report\n  scenario selection, database, deployment suite, and unrun required checks;\n  a focused pass is not a full-suite pass.\n\n## Maintaining agent guidance\n\n- Keep an `AGENTS.md` rule only when it is durable, non-obvious, and changes a\n  contributor's decision.\n- Do not copy repo maps, temporary implementation details, generic engineering\n  advice, or facts that a nearby manifest already makes clear.\n- Link to a canonical spec or tool instead of copying its full contract.\n- When a rule becomes stale or enforced clearly by code, tests, or tooling,\n  delete it.\n- If a change creates a new durable contributor constraint, update the nearest\n  relevant `AGENTS.md` and validate that the guidance matches the behavior.\n","isInternal":false,"tokens":3587,"sizeBytes":16849},{"name":"AGENTS.md","path":"apps/AGENTS.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/apps/AGENTS.md","title":"apps - AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"# App guidance\n\n- Format the files you change with the owning app's `npm run format`.\n","isInternal":false,"tokens":20,"sizeBytes":86},{"name":"openai.yaml","path":".agents/skills/add-recipe/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/add-recipe/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Add Recipe\"\n  short_description: \"Write a Provider Recipe for a service\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":34,"sizeBytes":144},{"name":"SKILL.md","path":".agents/skills/add-recipe/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/add-recipe/SKILL.md","title":"add-recipe","category":"anthropic-skill","format":"markdown","content":"---\nname: add-recipe\ndescription: Research an upstream service and write a Provider Recipe for it in apps/reef/recipes.\nargument-hint: \"Service name, e.g. notion\"\ndisable-model-invocation: true\n---\n\nWrite a **Provider Recipe** for the service the user names. A recipe states facts about one Upstream Service (its source, how to authenticate, its inputs and servers) so Reef can pre-fill Provider Setup. It lives at `apps/reef/recipes/<id>/recipe.yaml`, with an optional icon beside it.\n\nBefore you start, read:\n\n- `GLOSSARY.md`, the **Provider Recipe** entry.\n- ADRs 0002, 0003 and 0004 in `docs/adr/`.\n- `apps/reef/recipes/schema.json`: the recipe format. Its `description` fields are the field docs.\n- Example recipes: `linear` (MCP, OAuth discovery), `github` (OpenAPI, device code, public client) and `sentry` (region input, owner-configured client, servers).\n\n## 1. Check the id\n\nDerive the id from the service name: lowercase, `[a-z][a-z0-9_]*`. If `apps/reef/recipes/<id>/` exists, stop and ask the user whether to update that recipe or pick a new id.\n\n## 2. Find a source\n\nCoral reads two kinds of source:\n\n- An **OpenAPI 3.0 or 3.1** document, fetched once from a URL without following redirects. Swagger 2.0 fails.\n- An **MCP server over Streamable HTTP**. Standalone SSE and stdio servers fail.\n\nSearch the vendor's official docs for both. Record the URL of every doc page you rely on; the PR description cites them.\n\nDone when you hold at least one usable source URL, or have reported that none exists.\n\n## 3. Plan, then wait\n\nShow the user a short plan and wait for their approval. Cover each point:\n\n- **Recipes and ids.** One source: use the bare id. OpenAPI and MCP both: offer two recipes, `<id>` for OpenAPI and `<id>_mcp` for MCP. Give both the same `display_name` and set `service: <id>` in the MCP recipe, so the catalog shows both on one card and suggests one namespace (as `github_mcp` does). A self-hosted edition with its own host: offer `<id>_self_hosted` as well.\n- **Source URLs**, and for a third-party document, the audit result and why you pinned it or not.\n- **Authentication options** and the `default` (see below).\n- **Scopes** for each OAuth option, or why it names none.\n- **Inputs and servers**, e.g. a region.\n- **Icon** source.\n- **Gaps**: anything the format cannot express.\n\nAuthentication rules:\n\n- Include every method the service supports that a recipe `method` can express, e.g. OAuth and an API key.\n- Default to OAuth when it needs no extra setup: `oauth_discovery` for MCP, or device code or authorization code with a public client. Otherwise default to the API key or personal access token.\n- Leave the OAuth client id out, so the owner configures one (as `sentry` does). Coral could register its own application later; list that as a follow-up.\n- Name scopes whenever the service reads them from the authorization request. This includes an `oauth_discovery` server that does not advertise them (as `github_mcp` does). Request every scope it offers, read and write, with a comment naming what each grants. Coral reads and writes through providers.\n- Name no scopes when the service supplies them another way: an `oauth_discovery` server that advertises them (as `hubspot` does), or a service that takes them from the app's settings (as `attio` does). Omit `scopes` for `oauth_discovery`. The other OAuth methods require the field, so write `scopes: []`. Add a comment saying why the recipe names none, and for app settings, list the scopes the owner must turn on.\n- If the only way to authenticate needs a method the format lacks, stop and report the gap and what a new method would need. Extending the format touches Reef, proto and Rust, and is out of scope here.\n\nModel regions and similar choices as an `inputs` enum inside one recipe.\n\n## 4. Write the recipe\n\nFor each approved recipe, write `apps/reef/recipes/<id>/recipe.yaml`. Start it with `# yaml-language-server: $schema=../schema.json`, then match the shape of the example recipes.\n\n- `description` follows the pattern \"Issues, events and releases from Sentry.\"\n- Write `label` and `description` text in the Reef copy style from `AGENTS.md`.\n- Comment anything a reader cannot tell from the YAML alone.\n\nFor the icon, use the vendor's official brand SVG from their brand or press page, or the Simple Icons one. If you find no clean SVG, or its terms are unclear, leave `icons` out and list it as a follow-up.\nName the logo under `icons.light`. Reef shows it on a white plate in the light theme and a dark plate in the dark theme. If it does not read on the dark plate, e.g. a black glyph, add the vendor's official or Simple Icons light variant under `icons.dark`, named `<name>-dark.svg`. If there is no clean variant or its terms are unclear, leave `icons.dark` out and list it as a follow-up.\n\nDone when every approved recipe has its file and the plan's decisions all appear in it.\n\n## 5. Test\n\nRun, and fix until both pass:\n\n```sh\nnpm ci --prefix apps/reef   # once, if apps/reef/node_modules is missing\n(cd apps/reef && npx vitest run --project server recipes.server)\nnpm run check --prefix apps/reef\n```\n\nDo not use `npm test -- recipes.server`. It also runs the Storybook tests, which match no file and exit 1.\n\nThe recipe test also enforces rules the schema cannot, such as no undeclared `{{input.x}}` and no unused credential fields.\n\nCheck each source directly:\n\n- **OpenAPI**: fetch the URL. Confirm a 200 with no redirect, and an `openapi` field of `3.0.x` or `3.1.x`.\n- **MCP**: POST an `initialize` request to the URL. Confirm a Streamable HTTP response, or a 401 that points at OAuth when the server needs sign-in.\n\nThen give the user steps for a live test, which needs their browser and account:\n\n1. Run `./dev run` (see `docs/development.md`).\n2. In Reef, open `/workspaces/<workspace>/providers/new?recipe=<id>`.\n3. Sign in, publish the provider, and run a query against one of its tables.\n\n## 6. Summarise\n\nReport:\n\n- The files you wrote.\n- Test results, including the source checks.\n- Follow-ups: missing icon, OAuth client to register, the third-party audit result, format gaps.\n- A draft PR description that cites the vendor doc URLs.\n\nThen offer to open the PR. If the user accepts, create a branch named `<prefix>/add-<id>-recipe`, using the user's usual branch prefix, and commit there.\n","frontmatter":{"name":"add-recipe","description":"Research an upstream service and write a Provider Recipe for it in apps/reef/recipes.","argument-hint":"Service name, e.g. notion","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1571,"sizeBytes":6323},{"name":"openai.yaml","path":".agents/skills/ask-matt/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/ask-matt/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Ask Matt\"\n  short_description: \"Find the right skill or workflow\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":33,"sizeBytes":137},{"name":"PHASE-BOUNDARIES.md","path":".agents/skills/ask-matt/PHASE-BOUNDARIES.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/ask-matt/PHASE-BOUNDARIES.md","title":"Ask-matt Skill","category":"anthropic-skill","format":"markdown","content":"# Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *\"ok, we're done with that\"*.\n\nThe **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.\n\n## The five options\n\n| Option       | What it does                                                    |\n| ------------ | --------------------------------------------------------------- |\n| **Continue** | Stay in the session. No context switch at all.                    |\n| **`/clear`** | Empty the context window and start from nothing.                  |\n| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |\n| **Subagent** | Send the task to its own context window and get a report back.     |\n| **`/compact`** | Compress this context and seed a fresh session with the summary.  |\n\n## The tree\n\nWork top to bottom at the boundary. The first **yes** wins.\n\n**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.\n\n**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.\n\nThe cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.\n\n**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:\n\n- swapping to a **new harness** (Claude → Codex),\n- moving to a **new directory** or repo,\n- sending the work to a **colleague**,\n- or forking a side task you found **mid-phase** without derailing what you're doing.\n\nThat list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.\n\n**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.\n\n**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.\n\n`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.\n\n## Primary and secondary sources\n\nEvery move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:\n\n| Source                            | Information | Noise | Room to move |\n| --------------------------------- | ----------- | ----- | ------------ |\n| Primary (Continue)                | Full        | Lots  | Little       |\n| Secondary (`/compact`, `/handoff`) | Lossy       | Less  | Lots         |\n\nThis is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.\n\n## These are judgement calls\n\nThe questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.\n","isInternal":false,"tokens":956,"sizeBytes":4249},{"name":"SKILL.md","path":".agents/skills/ask-matt/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/ask-matt/SKILL.md","title":"ask-matt","category":"anthropic-skill","format":"markdown","content":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nBefore stating what a skill does or recommending a step be skipped, read that skill's SKILL.md: the summaries here are for orientation only.\n\nA **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `GLOSSARY.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)\n2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch: is this a multi-session build?**\n   - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. Then work the tickets one of two ways:\n     - **`/implement`** per ticket, **`/clear`ing context between each one**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed. Each ticket is self-contained, so the last one's context is disposable.\n     - **`/implement-spec`** for the whole spec in one run. It reads the tickets as a **task graph**, runs implementer subagents across the ready **frontier** in parallel, and lands everything on one **integration branch**. Reach for it when you'd rather orchestrate the build than drive each ticket yourself.\n   - **No** → **`/implement`** right here, in the same context window.\n\n   Either way, the code gets built by driving **`/tdd`** (one red-green slice at a time) and closes out with **`/code-review`**, a two-axis review (Standards + Spec) of the diff. `/implement` runs both per ticket; `/implement-spec`'s implementers each drive `/tdd`, and it runs one `/code-review` over the integration branch. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.\n\n   When the work goes up as a pull request, **`/pr`** shapes the body: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call. It's model-invoked, so the agent reaches for it whenever it writes a PR.\n\n4. **`/retro`** closes the loop. After a build, and especially one that went sideways, it looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards. The next build then starts from a better environment.\n\n### Context hygiene\n\nKeep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket. Run `/retro` in the session it's looking back on, before you clear; after clearing, point it at that session's log instead.\n\nThe limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.\n\n- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Once the fix is in, run **`/retro`** in the same session to ask what would have prevented the bug; where the real finding is that there's no good seam to lock it down, that's a job for **`/improve-codebase-architecture`**.\n\n- **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.\n\n  When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.\n\n## Codebase health\n\nNot feature work, just upkeep.\n\n- **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.\n\n## Vocabulary underneath\n\nTwo model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.\n\n- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word (\"account\" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `GLOSSARY.md` a clean glossary.\n- **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.\n\n## Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:\n\n- **Continue**: stay put. Costs nothing, loses nothing.\n- **`/clear`**: empty the window, when nothing here matters to what's next.\n- **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.\n- **Subagent**: send a tightly-scoped task to its own window and get a report back.\n- **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.\n\nRead [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `GLOSSARY.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.\n- **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.\n- **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.\n- **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.\n- **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.\n- **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.\n- **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.\n- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.\n\n## Precondition\n\n**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.\n","frontmatter":{"name":"ask-matt","description":"Ask which skill or flow fits your situation. A router over the skills in this repo.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":3009,"sizeBytes":12594},{"name":"openai.yaml","path":".agents/skills/code-review/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/code-review/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Code Review\"\n  short_description: \"Review a diff on standards and spec\"\n","isInternal":false,"tokens":23,"sizeBytes":100},{"name":"SKILL.md","path":".agents/skills/code-review/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/code-review/SKILL.md","title":"code-review","category":"anthropic-skill","format":"markdown","content":"---\nname: code-review\ndescription: \"Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \\\"review since X\\\".\"\n---\n\nTwo-axis review of the diff between `HEAD` and a fixed point the user supplies:\n\n- **Standards**: does the code conform to this repo's documented coding standards?\n- **Spec**: does the code faithfully implement the originating issue / spec?\n\nBoth axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\n## Process\n\n### 1. Pin the fixed point\n\nWhatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.\n\nCapture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.\n\nBefore going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.\n\n### 2. Identify the spec source\n\nLook for the originating spec, in this order:\n\n1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.\n2. A path the user passed as an argument.\n3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.\n4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report \"no spec available\".\n\n### 3. Identify the standards sources\n\nSearch the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.\n\nOn top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:\n\n- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.\n- **Always a judgement call.** Each smell is a labelled heuristic (\"possible Feature Envy\"), never a hard violation. Like any standard here, skip anything tooling already enforces.\n\nEach smell reads *what it is* → *how to fix*; match it against the diff:\n\n- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.\n- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.\n- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.\n- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.\n- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.\n- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.\n- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.\n- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.\n- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.\n- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.\n- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.\n- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.\n\n### 4. Spawn both sub-agents in parallel\n\nIssue both sub-agent calls together, in the foreground, and aggregate the reports they return.\n\n**Standards sub-agent prompt** should include:\n\n- The full diff command and commit list.\n- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).\n- The brief: \"Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words.\"\n\n**Spec sub-agent prompt** should include:\n\n- The diff command and commit list.\n- The path or fetched contents of the spec.\n- The brief: \"Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words.\"\n\nIf the spec is missing, skip the Spec sub-agent and note this in the final report.\n\n### 5. Aggregate\n\nPresent the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).\n\nEnd with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.\n\n## Why two axes\n\nA change can pass one axis and fail the other:\n\n- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**\n- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**\n\nReporting them separately stops one axis from masking the other.\n","frontmatter":{"name":"code-review","description":"Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."},"isInternal":false,"tokens":1517,"sizeBytes":6670},{"name":"openai.yaml","path":".agents/skills/codebase-design/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/codebase-design/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Codebase Design\"\n  short_description: \"Vocabulary for deep-module design\"\n","isInternal":false,"tokens":23,"sizeBytes":102},{"name":"DEEPENING.md","path":".agents/skills/codebase-design/DEEPENING.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/codebase-design/DEEPENING.md","title":"Codebase-design Skill","category":"anthropic-skill","format":"markdown","content":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.\n\nRecommendation shape: *\"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network.\"*\n\n### 4. True external (Mock)\n\nThird-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.\n\n## Seam discipline\n\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.\n- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.\n","isInternal":false,"tokens":542,"sizeBytes":2553},{"name":"DESIGN-IT-TWICE.md","path":".agents/skills/codebase-design/DESIGN-IT-TWICE.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/codebase-design/DESIGN-IT-TWICE.md","title":"Codebase-design Skill","category":"anthropic-skill","format":"markdown","content":"# Design It Twice\n\nWhen the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on \"Design It Twice\" (Ousterhout): your first idea is unlikely to be the best.\n\nUses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.\n\nPrompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:\n\n- Agent 1: \"Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility: support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller: make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params, plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs: where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.\n\nAfter comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.\n","isInternal":false,"tokens":607,"sizeBytes":2665},{"name":"SKILL.md","path":".agents/skills/codebase-design/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/codebase-design/SKILL.md","title":"codebase-design","category":"anthropic-skill","format":"markdown","content":"---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.\n- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n","frontmatter":{"name":"codebase-design","description":"Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary."},"isInternal":false,"tokens":1357,"sizeBytes":6446},{"name":"openai.yaml","path":".agents/skills/diagnosing-bugs/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/diagnosing-bugs/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Diagnosing Bugs\"\n  short_description: \"Diagnose hard bugs and regressions\"\n","isInternal":false,"tokens":26,"sizeBytes":103},{"name":"SKILL.md","path":".agents/skills/diagnosing-bugs/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/diagnosing-bugs/SKILL.md","title":"diagnosing-bugs","category":"anthropic-skill","format":"markdown","content":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.\n\n## Redact\n\nThis skill has you show commands, outputs and captured artifacts. **Redact every secret first**: write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.\n\nIf the redacted output is not enough to diagnose the bug, say so and ask the user.\n\n## Phase 1: Build a feedback loop\n\n**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug (one that goes red on _this_ bug), you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one, in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug: unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) that drives the UI and asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate \"boot at state X, check, repeat\" so you can `git bisect run` it.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight, a debugging superpower.\n\n### Non-deterministic bugs\n\nThe goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not, so keep raising the rate until it's debuggable.\n\n### When you genuinely cannot build a loop\n\nStop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.\n\n### Completion criterion: a tight loop that goes red\n\nPhase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** (a script path, a test invocation, a curl) that you have **already run at least once** (show the invocation and its output, redacted), and that is:\n\n- [ ] **Red-capable**: it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not \"runs without erroring\"; it must be able to _catch this specific bug_.\n- [ ] **Deterministic**: same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast**: seconds, not minutes.\n- [ ] **Agent-runnable**: you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf you catch yourself reading code to build a theory before this command exists, **stop: jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.\n\n## Phase 2: Reproduce + minimise\n\nRun the loop. Watch it go red as the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described, not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut, and keep only what's load-bearing for the failure.\n\nWhy bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.\n\nDone when **every remaining element is load-bearing**: removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3: Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe: discard or sharpen it.\n\n**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly (\"we just deployed a change to #3\"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it; proceed with your ranking if the user is AFK.\n\n## Phase 4: Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.\n\n**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.\n\n## Phase 5: Fix + regression test\n\nWrite the regression test **before the fix**, but only if there is a **correct seam** for it.\n\nA correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.\n\n**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail. If you forced the red by mutating code or a fixture, `diff` against a pristine copy to prove the mutation landed before you trust it.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6: Cleanup\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message, so the next debugger learns\n","frontmatter":{"name":"diagnosing-bugs","description":"Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow."},"isInternal":false,"tokens":2040,"sizeBytes":8664},{"name":"ADR-FORMAT.md","path":".agents/skills/domain-modeling/ADR-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/domain-modeling/ADR-FORMAT.md","title":"Domain-modeling Skill","category":"anthropic-skill","format":"markdown","content":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n","isInternal":false,"tokens":628,"sizeBytes":2733},{"name":"openai.yaml","path":".agents/skills/domain-modeling/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/domain-modeling/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Domain Modeling\"\n  short_description: \"Build and sharpen a domain model\"\n","isInternal":false,"tokens":22,"sizeBytes":101},{"name":"GLOSSARY-FORMAT.md","path":".agents/skills/domain-modeling/GLOSSARY-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/domain-modeling/GLOSSARY-FORMAT.md","title":"Domain-modeling Skill","category":"anthropic-skill","format":"markdown","content":"# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `GLOSSARY.md` at the repo root.\n\n**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Glossary Map\n\n## Contexts\n\n- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders\n- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `GLOSSARY-MAP.md` exists, read it to find contexts\n- If only a root `GLOSSARY.md` exists, single context\n- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n","isInternal":false,"tokens":544,"sizeBytes":2300},{"name":"SKILL.md","path":".agents/skills/domain-modeling/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/domain-modeling/SKILL.md","title":"domain-modeling","category":"anthropic-skill","format":"markdown","content":"---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── GLOSSARY.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── GLOSSARY-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── GLOSSARY.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── GLOSSARY.md\n│       └── docs/adr/\n```\n\nCreate files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. \"Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?\"\n\n### Sharpen fuzzy language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term. \"You're saying 'account': do you mean the Customer or the User? Those are different things.\"\n\n### Discuss concrete scenarios\n\nWhen domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.\n\n### Cross-reference with code\n\nWhen the user states how something works, check whether the code agrees. If you find a contradiction, surface it: \"Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?\"\n\n### Update GLOSSARY.md inline\n\nWhen a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).\n\n`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n","frontmatter":{"name":"domain-modeling","description":"Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR."},"isInternal":false,"tokens":777,"sizeBytes":3346},{"name":"openai.yaml","path":".agents/skills/grill-me/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grill-me/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Grill Me\"\n  short_description: \"Sharpen a plan through interview\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":34,"sizeBytes":137},{"name":"SKILL.md","path":".agents/skills/grill-me/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grill-me/SKILL.md","title":"grill-me","category":"anthropic-skill","format":"markdown","content":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nCall the Skill tool with \"grilling\".\n","frontmatter":{"name":"grill-me","description":"A relentless interview to sharpen a plan or design.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":35,"sizeBytes":157},{"name":"openai.yaml","path":".agents/skills/grill-with-docs/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grill-with-docs/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Grill with Docs\"\n  short_description: \"Grill a design and write its docs\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":37,"sizeBytes":145},{"name":"SKILL.md","path":".agents/skills/grill-with-docs/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grill-with-docs/SKILL.md","title":"grill-with-docs","category":"anthropic-skill","format":"markdown","content":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nCall the Skill tool twice, for \"grilling\" and \"domain-modeling\".\n","frontmatter":{"name":"grill-with-docs","description":"A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":60,"sizeBytes":247},{"name":"openai.yaml","path":".agents/skills/grilling/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grilling/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Grilling\"\n  short_description: \"Stress-test thinking a round of questions at a time\"\n","isInternal":false,"tokens":27,"sizeBytes":113},{"name":"SKILL.md","path":".agents/skills/grilling/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/grilling/SKILL.md","title":"grilling","category":"anthropic-skill","format":"markdown","content":"---\nname: grilling\ndescription: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.\n---\n\nInterview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.\n\nWork the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.\n\nFormat a round like so:\n\n```\n❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n\n---\n\n❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n```\n\nWord each question so \"yes\" accepts your recommended answer.\n\nEach round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.\n\nFinding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.\n\nThe session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.\n","frontmatter":{"name":"grilling","description":"Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases."},"isInternal":false,"tokens":440,"sizeBytes":2049},{"name":"openai.yaml","path":".agents/skills/handoff/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/handoff/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Handoff\"\n  short_description: \"Compact a conversation into a handoff\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":34,"sizeBytes":141},{"name":"SKILL.md","path":".agents/skills/handoff/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/handoff/SKILL.md","title":"handoff","category":"anthropic-skill","format":"markdown","content":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS (`$TMPDIR`, else `/tmp`; `%TEMP%` on Windows) - not the current workspace.\n\nInclude a \"suggested skills\" section in the document, naming which skills the next agent should call the Skill tool for.\n\nDo not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n","frontmatter":{"name":"handoff","description":"Compact the current conversation into a handoff document for another agent to pick up.","argument-hint":"What will the next session be used for?","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":197,"sizeBytes":940},{"name":"openai.yaml","path":".agents/skills/implement-spec/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/implement-spec/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Implement Spec\"\n  short_description: \"Implement the result of /to-spec and /to-tickets in code.\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":41,"sizeBytes":168},{"name":"SKILL.md","path":".agents/skills/implement-spec/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/implement-spec/SKILL.md","title":"implement-spec","category":"anthropic-skill","format":"markdown","content":"---\nname: implement-spec\ndescription: \"Implement the result of /to-spec and /to-tickets in code.\"\ndisable-model-invocation: true\n---\n\nYou have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\nThe goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.\n\nThe tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.\n\nCommunication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.\n\n**Implementer subagents** should be run in the background where possible for maximum concurrency.\n\n## Steps\n\n1. Read the spec and tickets to understand the task graph.\n\n2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.\n\n3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.\n\n4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:\n   - confirms its worktree is based on the integration branch before starting, and resets onto it if not;\n   - calls the Skill tool with `tdd` to build the ticket;\n   - merges the integration branch tip into its own branch before reporting done\n\n5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.\n\n6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.\n\n7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.\n\n8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.\n\n9. Clean up all **implementer subagent** worktrees.\n","frontmatter":{"name":"implement-spec","description":"Implement the result of /to-spec and /to-tickets in code.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":591,"sizeBytes":2780},{"name":"openai.yaml","path":".agents/skills/implement/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/implement/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Implement\"\n  short_description: \"Build work from a spec or tickets\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":33,"sizeBytes":139},{"name":"SKILL.md","path":".agents/skills/implement/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/implement/SKILL.md","title":"implement","category":"anthropic-skill","format":"markdown","content":"---\nname: implement\ndescription: \"Implement a piece of work based on a spec or set of tickets.\"\ndisable-model-invocation: true\n---\n\nImplement the work described by the user in the spec or tickets.\n\nIf the user passes a ticket reference, fetch it from the issue tracker and state its title before starting. If the reference is ambiguous, ask.\n\nCall the Skill tool with \"tdd\" where possible, at pre-agreed seams.\n\nRun typechecking regularly, single test files regularly, and the full test suite once at the end.\n\nOnce done, call the Skill tool with \"code-review\" to review the work.\n\nCommit your work to the current branch.\n","frontmatter":{"name":"implement","description":"Implement a piece of work based on a spec or set of tickets.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":135,"sizeBytes":622},{"name":"openai.yaml","path":".agents/skills/improve-codebase-architecture/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/improve-codebase-architecture/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Improve Codebase Architecture\"\n  short_description: \"Find and grill architecture improvements\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":35,"sizeBytes":166},{"name":"HTML-REPORT.md","path":".agents/skills/improve-codebase-architecture/HTML-REPORT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/improve-codebase-architecture/HTML-REPORT.md","title":"Improve-codebase-architecture Skill","category":"anthropic-skill","format":"markdown","content":"# HTML Report Format\n\nThe architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two: don't lean on Mermaid for everything, it'll start to look generic.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review for {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph. Straight into the candidates.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title**: short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **Badge row**: recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).\n- **Files**: monospaced list, `font-mono text-sm`.\n- **Before / After diagram**: the centrepiece. Two columns, side by side. See patterns below.\n- **Problem**: one sentence. What hurts.\n- **Solution**: one sentence. What changes.\n- **Wins**: bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable): one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same. Variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse a Mermaid `flowchart` or `graph` when the point is \"X calls Y calls Z, and look at the mess.\" Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for \"before: 6 round-trips; after: 1.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the \"after\" diagram to feel like one thick-bordered deep module with greyed-out internals, since Mermaid won't render that with the right weight.\n\n### Cross-section (good for layered shallowness)\n\nStack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo rectangles per module: one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).\n\n### Call-graph collapse\n\nBefore: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams, so they read as schematic, not as UI.\n- The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static: no app code, no interactivity beyond Mermaid's own rendering.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise, but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow: interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**Wins bullets** name the gain in glossary terms: *\"locality: bugs concentrate in one module\"*, *\"leverage: one interface, N call sites\"*, *\"interface shrinks; implementation absorbs the wrappers\"*. Don't write *\"easier to maintain\"* or *\"cleaner code\"*, because those terms aren't in the glossary and don't earn their place.\n\nNo hedging, no throat-clearing, no \"it's worth noting that…\". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in the `/codebase-design` glossary, reach for one that is before inventing a new one.\n","isInternal":false,"tokens":1610,"sizeBytes":6641},{"name":"SKILL.md","path":".agents/skills/improve-codebase-architecture/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/improve-codebase-architecture/SKILL.md","title":"improve-codebase-architecture","category":"anthropic-skill","format":"markdown","content":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities**: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- Call the Skill tool with \"codebase-design\" for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, \"the interface is the test surface\", \"one adapter = hypothetical seam, two = real\"). Use these terms exactly in every suggestion, and don't drift into \"component,\" \"service,\" \"API,\" or \"boundary.\"\n- The domain language in `GLOSSARY.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\n**Scope before you scan: YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:\n\n- If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.\n- Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.\n\nRead the project's domain glossary (`GLOSSARY.md`) and any ADRs in the area you're touching first.\n\nThen spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow**, with an interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A \"yes, concentrates\" is the signal you want.\n\n### 2. Present candidates as an HTML report\n\nWrite a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user (`xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows) and tell them the absolute path.\n\nThe report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.\n\nFor each candidate, render a card with:\n\n- **Files**: which files/modules are involved\n- **Problem**: why the current architecture is causing friction\n- **Solution**: plain English description of what would change\n- **Benefits**: explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram**: side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength**: one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**Use GLOSSARY.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `GLOSSARY.md` defines \"Order,\" talk about \"the Order intake module,\" not \"the FooBarHandler,\" and not \"the Order service.\"\n\n**ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _\"contradicts ADR-0007, but worth reopening because…\"_). Don't list every theoretical refactor an ADR forbids.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce the user picks a candidate, call the Skill tool with \"grilling\" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.\n\nSide effects happen inline as decisions crystallize; call the Skill tool with \"domain-modeling\" to keep the domain model current as you go:\n\n- **Naming a deepened module after a concept not in `GLOSSARY.md`?** Add the term to `GLOSSARY.md`. Create the file lazily if it doesn't exist.\n- **Sharpening a fuzzy term during the conversation?** Update `GLOSSARY.md` right there.\n- **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _\"Want me to record this as an ADR so future architecture reviews don't re-suggest it?\"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons (\"not worth it right now\") and self-evident ones.\n- **Want to explore alternative interfaces for the deepened module?** Call the Skill tool with \"codebase-design\" and use its design-it-twice parallel sub-agent pattern.\n","frontmatter":{"name":"improve-codebase-architecture","description":"Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1358,"sizeBytes":6000},{"name":"openai.yaml","path":".agents/skills/pr/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/pr/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"PR\"\n  short_description: \"Write a PR body that's fast to review\"\n","isInternal":false,"tokens":24,"sizeBytes":93},{"name":"CREDITS.md","path":".agents/skills/pr/CREDITS.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/pr/CREDITS.md","title":"Pr Skill","category":"anthropic-skill","format":"markdown","content":"# Credits\n\nThe **Summary** section's menu of visuals (pseudocode, call trees, component trees, file trees, Mermaid, diffs) and its placement guidance come from [Dex Horthy](https://github.com/dexhorthy)'s [`show-me`](https://github.com/humanlayer/humanlayer) skill, reproduced almost word for word and aimed at a diff instead of a live conversation. `pr` does not depend on `show-me` as a skill (it isn't part of this repo, and a hard dependency would break standalone installs), so the content is copied in rather than pointed at; this file is the attribution a dependency would otherwise have carried.\n","isInternal":false,"tokens":141,"sizeBytes":604},{"name":"SKILL.md","path":".agents/skills/pr/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/pr/SKILL.md","title":"pr","category":"anthropic-skill","format":"markdown","content":"---\nname: pr\ndescription: \"Use when writing a PR body.\"\nmetadata:\n  credits:\n    skill: show-me\n    author: Dex Horthy\n    organisation: Humanlayer\n    url: \"https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md\"\n---\n\nUse this template for writing the PR body:\n\n```markdown\n## Summary\n\n<diagram, diff-sketch, or tree>\n\n## Evidence\n\n- **Before:** <screenshot/output/failing test run>\n  **After:** <screenshot/output/passing test run>\n\n## Merge Danger\n\n**Door:** <one-way or two-way>\n\n<optional: description>\n\n**Blast Radius:** <one-word description>\n\n<optional: potential ramifications of merge>\n```\n\n## Sections\n\nSkip all preambles and keep prose brief. Use the user's domain language from `GLOSSARY.md`.\n\n### Summary\n\nPick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```text\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1);\n  return `use the ${skillName} skill`;\n}\n```\n\n#### Guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n\n### Evidence\n\nConcrete evidence that the change works. Show a before and after.\n\nScreenshots are S-tier - when the environment is set up for it and the change is visual.\n\nExecution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode.\n\n### Merge Danger\n\nDescribe whether it's a one-way or two-way door. You can walk back through two-way doors, but not one-way doors. A PR that is cheap to roll back is lower risk. Changes that involve destructive actions or hard-to-reverse decisions are one-way doors.\n\nThe blast radius is the potential impact or scope of the changes introduced by this PR. Consider all possibilities. Examples are layout shift, breakages for consumers, mobile responsiveness, etc.\n","frontmatter":{"name":"pr","description":"Use when writing a PR body.","metadata":{"credits":{"skill":"show-me","author":"Dex Horthy","organisation":"Humanlayer","url":"https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md"}}},"isInternal":false,"tokens":980,"sizeBytes":4169},{"name":"openai.yaml","path":".agents/skills/prototype/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/prototype/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Prototype\"\n  short_description: \"Prototype to answer a design question\"\n","isInternal":false,"tokens":21,"sizeBytes":100},{"name":"LOGIC.md","path":".agents/skills/prototype/LOGIC.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/prototype/LOGIC.md","title":"Prototype Skill","category":"anthropic-skill","format":"markdown","content":"# Logic Prototype\n\nA single, self-contained HTML file (a **shareable demo**) that lets anyone drive a state model by clicking buttons. Use this when the question is about **business logic, state transitions, or data shape**: the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.\n\nBecause it's one file with nothing to install, you can hand it to a non-developer (a designer, a PM, a domain expert) and let them feel the model for themselves. So it speaks their language, not the code's.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where someone wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like,\" this is the wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore writing code, write down what state model and what question you're prototyping. One paragraph, at the top of the demo (in a visible intro, not just a comment). A logic prototype that answers the wrong question is pure waste, so make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.\n\n### 2. Isolate the logic in a portable module\n\nPut the actual logic (the bit that's answering the question) in a single `<script>` block written as a small, pure module that could be lifted out and dropped into the real codebase later. The page around it is throwaway; this module isn't.\n\nThe right shape depends on the question:\n\n- **A pure reducer**: `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine**: explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state, just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a page. Keep it pure: no DOM, no `document`, no button handlers reaching inside it. The page calls into it; nothing flows the other direction. This is what makes the prototype useful past its own lifetime: once the question's answered, the validated reducer / machine / function set lifts into the real module on its own.\n\n### 3. Build the shareable HTML file\n\nOne file, plain HTML/CSS/JS: no framework, no bundler, no server, everything inline so it opens by double-click and survives being emailed around. Anyone should be able to run it by opening it.\n\nWrite it for a non-developer. Every label is in **domain language**, not code: buttons and state read like the business, not the reducer. Explain in plain words what's happening.\n\nLay it out with a clean hierarchy, top to bottom:\n\n1. **Title and one-line explanation** of what this demo lets you explore (the question from step 1).\n2. **Current state**: the full relevant state, rendered as a readable panel (labelled fields, not a raw JSON dump), re-rendered after every click so the change is visible. Where it helps a non-developer follow, call out what just changed.\n3. **Free-play buttons**: one button per action, always available, so anyone can poke at the model in any order. Each click dispatches its action and re-renders the state.\n4. **Guided walkthroughs**: a set of **scenarios**, one per tab. Each tab holds a short plain-language description of the scenario (the situation it sets up and what to watch for) and underneath it, the ordered **buttons to press** for that scenario. Each step is a real button: clicking it performs that action and moves to the next step. Starting a walkthrough resets to a known initial state so the scenario runs the same way every time.\n\nChoose scenarios that demonstrate the awkward cases, the ones hard to reason about on paper: the happy path, a tricky edge case, an attempt at something that should be illegal.\n\nKeep it beautiful but restrained: clean typography, generous spacing, one accent colour. No animations, no gimmicks: nothing that competes with the state and the buttons.\n\n### 4. Hand it over\n\nSend them the file, or open it for them. They'll click through the walkthroughs and free-play whenever they get to it; the interesting moments are when they say \"wait, that shouldn't be possible\" or \"huh, I assumed X would be different\"; those are the bugs in the _idea_, which is the whole point. If they want new actions or a new scenario, add them. Prototypes evolve.\n\n### 5. Capture the answer and the prototype\n\nOnce the prototype has answered its question, capture the answer, then capture the prototype the way the [SKILL](SKILL.md) describes. The logic-specific mapping: the validated reducer / machine / function set lifts into the real module (the decision, absorbed); the HTML shell rides along to the throwaway branch that keeps the prototype as a primary source, and being one self-contained file, it stays trivially re-runnable there.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use in-memory state unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **Don't blur the logic and the page together.** If the pure module references the DOM, `document`, or button handlers, it's no longer liftable. Keep the page as a thin shell over a pure module.\n- **Don't reach for a framework, bundler, or server.** One file the recipient double-clicks; a React app or a dev server defeats \"shareable\".\n- **Don't ship the HTML shell into production.** The page is optimised for being clicked through by hand. The logic module behind it is the bit worth keeping.\n","isInternal":false,"tokens":1341,"sizeBytes":6036},{"name":"SKILL.md","path":".agents/skills/prototype/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/prototype/SKILL.md","title":"prototype","category":"anthropic-skill","format":"markdown","content":"---\nname: prototype\ndescription: Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"Does this logic / state model feel right?\"** → [LOGIC.md](LOGIC.md). Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.\n- **\"What should this look like?\"** → [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.\n\nThe two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.\n\n## Rules that apply to both\n\n1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.\n2. **Trivial to run.** A UI prototype starts from one command in the project's task runner: `pnpm <name>`, `python <path>`, `bun <path>`, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it.\n3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear \"PROTOTYPE, wipe me\" name.\n4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast.\n5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.\n6. **Capture it when done.** Fold any validated decision into the real code, then capture the prototype itself as a **primary source**: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.\n","frontmatter":{"name":"prototype","description":"Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like."},"isInternal":false,"tokens":648,"sizeBytes":2931},{"name":"UI.md","path":".agents/skills/prototype/UI.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/prototype/UI.md","title":"Prototype Skill","category":"anthropic-skill","format":"markdown","content":"# UI Prototype\n\nGenerate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.\n\nIf the question is about logic/state rather than what something looks like, this is the wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes: strongly prefer sub-shape A\n\nA UI prototype is much easier to judge when it's **butting up against the rest of the app**: real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.\n\n### Sub-shape A: adjustment to an existing page (preferred)\n\nThe route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay. Only the rendering swaps. This is the default; pick it unless there's a specific reason not to.\n\nIf the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow), it's still sub-shape A. Mount the variants inside the host page.\n\n### Sub-shape B: a new page (last resort)\n\nOnly use this when the thing being prototyped genuinely has no existing page to live inside (e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible).\n\nCreate a **throwaway route** following whatever routing convention the project already uses. Don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.\n\nBefore committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise, so cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants must be **structurally different**: different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit \"do not use a card grid\" guidance.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code, adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow**: cycles to the previous variant (wraps around).\n- **Variant label**: shows the current variant key and, if the variant exports a name, that name too. e.g. `B (Sidebar layout)`.\n- **Right arrow**: cycles forward (wraps around).\n\nBehaviour:\n\n- Clicking an arrow updates the URL search param (use the framework's router, e.g. `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- Hidden in production builds: gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **\"I want the header from B with the sidebar from C\"**, which is the actual design they want.\n\n### 6. Capture the answer and clean up\n\nOnce a variant has won, capture the answer (which variant and why), then capture the prototype the way the [SKILL](SKILL.md) describes. Fold the winner into the real code and move the rest onto the throwaway branch, not into main:\n\n- **Sub-shape A**: fold the winner into the existing page; drop the losing variants and the switcher from main.\n- **Sub-shape B**: promote the winning variant to a real route; drop the throwaway route and the switcher from main.\n\nThe full set of variants is the primary source, so it lands on the throwaway branch, not the bin, since variant components and the switcher left in the main branch rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.\n- **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub: the question is \"what should this look like\", not \"does the backend work\".\n- **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.\n","isInternal":false,"tokens":1586,"sizeBytes":6913},{"name":"openai.yaml","path":".agents/skills/research/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/research/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Research\"\n  short_description: \"Research from high-trust sources\"\n","isInternal":false,"tokens":21,"sizeBytes":94},{"name":"SKILL.md","path":".agents/skills/research/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/research/SKILL.md","title":"research","category":"anthropic-skill","format":"markdown","content":"---\nname: research\ndescription: Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent.\n---\n\nSpin up a **background agent** to do the research, so you keep working while it reads.\n\nIts job:\n\n1. Investigate the question against **primary sources** (official docs, source code, specs, first-party APIs), not a secondary write-up of them. Follow every claim back to the source that owns it.\n2. Write the findings to a single Markdown file, citing each claim's source.\n3. Save it where the repo already keeps such notes; match the existing convention, and if there is none, put it somewhere sensible and say where.\n","frontmatter":{"name":"research","description":"Investigate a question against high-trust primary sources and capture the findings as a Markdown file in the repo. Use when the user wants a topic researched, docs or API facts gathered, or reading legwork delegated to a background agent."},"isInternal":false,"tokens":169,"sizeBytes":794},{"name":"openai.yaml","path":".agents/skills/retro/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/retro/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"Retro\"\n  short_description: \"Conduct a retrospective on a coding session.\"\npolicy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":35,"sizeBytes":146},{"name":"SKILL.md","path":".agents/skills/retro/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/retro/SKILL.md","title":"retro","category":"anthropic-skill","format":"markdown","content":"---\nname: retro\ndescription: \"Conduct a retrospective on a coding session.\"\ndisable-model-invocation: true\n---\n\nThe user has asked for a **retrospective**. You are suggesting improvements to the coding agent's **environment** to improve future runs.\n\n## Steps\n\n1. Call the Skill tool with `writing-for-agents` for the writing style guide.\n\n2. Read the primary sources for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.\n\n3. Look for candidates for improvement in these categories.\n\n- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** make it easier? _Use when_ the session took a long time to find a piece of information.\n- **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but sits unwired or silently broken is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a standing missed opportunity, not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all.\n- **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a deterministic check, full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **judgement calls** (cross-file consistency, \"matches the surrounding style,\" anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake.\n- **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope.\n- **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call.\n- **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy.\n- **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.\n\n4. Present these candidates to the user, in order of severity.\n\n## Reference\n\n### Implementation vs Review\n\nRemember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.\n\nThe review agent has the least context pressure - it receives a diff, so no exploration needed. It often does not need to write code or debug.\n\nThis means that the review agent should be responsible for imposing coding standards, not the implementation agent.\n\n### Files\n\nYou have access to several files in the repo:\n\n- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be used incredibly sparingly, usually only for **navigation pointers** to other files.\n- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.\n- Docs: use docs as references files, pointed to by other files. Look for existing docs before writing new ones.\n- Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.\n","frontmatter":{"name":"retro","description":"Conduct a retrospective on a coding session.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":950,"sizeBytes":4369},{"name":"openai.yaml","path":".agents/skills/show-me/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/show-me/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"policy:\n  allow_implicit_invocation: false\n","isInternal":false,"tokens":11,"sizeBytes":43},{"name":"SKILL.md","path":".agents/skills/show-me/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/show-me/SKILL.md","title":"show-me","category":"anthropic-skill","format":"markdown","content":"---\nname: show-me\ndescription: Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.\ndisable-model-invocation: true\n---\n\nHelp the user understand the current topic of conversation visually. Skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear.\n\n- Show logic or an algorithm as pseudocode:\n\n```text\non(save)\n  if content is unchanged\n    return cached result\n  write new content\n  return fresh result\n```\n\n- Show runtime control flow as a call tree:\n\n```text\nsubmitForm\n  createSession\n    persistPrompt\n    launchAgent\n  navigateToSession\n```\n\n- Show UI structure as a component tree, including state and module boundaries that matter:\n\n```tsx\n<SessionPage> (apps/example/src/routes/session.tsx)\n  useSessionEvents()\n  <SessionToolbar>\n    <RunSkillButton> (packages/ui)\n```\n\n- Show file responsibility or a broad refactor as a shallow file tree:\n\n```text\nsrc/\n├── commands/       # parses user actions\n├── sessions/       # owns session state\n└── transport/      # sends API requests\n```\n\n- Show component interaction, control flow, or data flow with Mermaid:\n\n```mermaid\nsequenceDiagram\n    participant User\n    participant UI\n    participant Daemon\n    User->>UI: choose command\n    UI->>Daemon: send expanded prompt\n    Daemon-->>UI: stream result\n```\n\n- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.\n\nFor a component change:\n\n```diff\n <SessionPage>\n   useSessionEvents()\n   <SessionToolbar>\n+    <RunSkillButton />\n   <SessionTimeline>\n+    <SkillResultCard />\n```\n\nFor a file-layout change:\n\n```diff\n src/\n ├── commands/\n+│   └── show-me.ts       # expands the slash command\n ├── sessions/\n-└── transport.ts\n+└── transport/\n+    ├── client.ts\n+    └── stream.ts\n```\n\nFor a call-tree or call-stack change:\n\n```diff\n submitForm\n   createSession\n     persistPrompt\n+    expandSkillMention\n     launchAgent\n-  navigateToSession\n+  navigateToSession\n+    subscribeToEvents\n```\n\nFor a state or control-flow change:\n\n```diff\n on(save)\n-  write content\n+  if content is unchanged\n+    return cached result\n+  write new content\n+  invalidate cache\n```\n\n- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:\n\n```ts\nfunction expandSkill(command: string): string {\n  const skillName = command.slice(1)\n  return `use the ${skillName} skill`\n}\n```\n\n- For a visual UI, layout, state comparison, or concept too dense for Mermaid, write one focused HTML file — a diagram, an infographic, or a short slide deck, whichever fits the point. Match the product's colors, type, spacing, and components; use real labels and data; support desktop and mobile. Then open it for the user:\n\n```\nBash(open path/to/show-me-{description}.html)\n```\n\n### guidance\n\nPlace each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.\n\nYou may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.\n","frontmatter":{"name":"show-me","description":"Help the user understand the current topic visually with concise diagrams, code-shape sketches, and focused HTML artifacts.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":779,"sizeBytes":3328},{"name":"openai.yaml","path":".agents/skills/tdd/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/tdd/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"interface:\n  display_name: \"TDD\"\n  short_description: \"Test-driven red-green-refactor\"\n","isInternal":false,"tokens":22,"sizeBytes":87},{"name":"mocking.md","path":".agents/skills/tdd/mocking.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/tdd/mocking.md","title":"Tdd Skill","category":"anthropic-skill","format":"markdown","content":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n","isInternal":false,"tokens":331,"sizeBytes":1481},{"name":"SKILL.md","path":".agents/skills/tdd/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/tdd/SKILL.md","title":"tdd","category":"anthropic-skill","format":"markdown","content":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\nTDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\n## What a good test is\n\nTests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: \"user can checkout with valid cart\" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Seams: where tests go\n\nA **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.\n\n**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.\n\nAsk: \"What's the public interface, and which seams should we test?\" Give each proposed seam a one-line note on what it catches and what it misses.\n\nWhen the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with \"codebase-design\" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.\n\n## Anti-patterns\n\n- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.\n- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.\n- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.\n\n## Rules of the loop\n\n- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.\n- **One slice at a time.** One seam, one test, one minimal implementation per cycle.\n- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.\n","frontmatter":{"name":"tdd","description":"Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests."},"isInternal":false,"tokens":775,"sizeBytes":3629},{"name":"tests.md","path":".agents/skills/tdd/tests.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/tdd/tests.md","title":"Tdd Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftdd%2Ftests.md -->","isInternal":false,"tokens":503,"sizeBytes":2214},{"name":"openai.yaml","path":".agents/skills/teach/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":34,"sizeBytes":139},{"name":"GLOSSARY-FORMAT.md","path":".agents/skills/teach/GLOSSARY-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/GLOSSARY-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FGLOSSARY-FORMAT.md -->","isInternal":false,"tokens":488,"sizeBytes":2122},{"name":"LEARNING-RECORD-FORMAT.md","path":".agents/skills/teach/LEARNING-RECORD-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/LEARNING-RECORD-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FLEARNING-RECORD-FORMAT.md -->","isInternal":false,"tokens":586,"sizeBytes":2747},{"name":"MISSION-FORMAT.md","path":".agents/skills/teach/MISSION-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/MISSION-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FMISSION-FORMAT.md -->","isInternal":false,"tokens":354,"sizeBytes":1540},{"name":"RESOURCES-FORMAT.md","path":".agents/skills/teach/RESOURCES-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/RESOURCES-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FRESOURCES-FORMAT.md -->","isInternal":false,"tokens":441,"sizeBytes":1924},{"name":"SKILL.md","path":".agents/skills/teach/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/teach/SKILL.md","title":"teach","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fteach%2FSKILL.md -->","frontmatter":{"name":"teach","description":"Teach the user a new skill or concept, within this workspace.","disable-model-invocation":true,"argument-hint":"What would you like to learn about?","disableModelInvocation":true},"isInternal":false,"tokens":2004,"sizeBytes":9733},{"name":"EXAMPLE.md","path":".agents/skills/to-benchmark/EXAMPLE.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-benchmark/EXAMPLE.md","title":"bench-program-failure-recovery","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FEXAMPLE.md -->","frontmatter":{"name":"bench-program-failure-recovery","description":"Benchmark recovery from Program failures across coding agents on main and an optional branch.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":4002,"sizeBytes":16675},{"name":"KNOWN_ISSUES.md","path":".agents/skills/to-benchmark/KNOWN_ISSUES.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-benchmark/KNOWN_ISSUES.md","title":"To-benchmark Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FKNOWN_ISSUES.md -->","isInternal":false,"tokens":957,"sizeBytes":3791},{"name":"SKILL.md","path":".agents/skills/to-benchmark/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-benchmark/SKILL.md","title":"to-benchmark","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FSKILL.md -->","frontmatter":{"name":"to-benchmark","description":"Create a benchmark skill from an issue. The benchmark skill runs coding agents against main and an optional branch and reports whether the issue's behaviour improved.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1159,"sizeBytes":5061},{"name":"TEMPLATE.md","path":".agents/skills/to-benchmark/TEMPLATE.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-benchmark/TEMPLATE.md","title":"bench-<behaviour>","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-benchmark%2FTEMPLATE.md -->","frontmatter":{"name":"bench-<behaviour>","description":"Benchmark <behaviour> across coding agents on main and an optional branch.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":3465,"sizeBytes":14376},{"name":"openai.yaml","path":".agents/skills/to-questionnaire/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-questionnaire/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":38,"sizeBytes":166},{"name":"SKILL.md","path":".agents/skills/to-questionnaire/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-questionnaire/SKILL.md","title":"to-questionnaire","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-questionnaire%2FSKILL.md -->","frontmatter":{"name":"to-questionnaire","description":"Turn a decision you can't fully answer into a questionnaire for someone else to fill in.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":638,"sizeBytes":2904},{"name":"openai.yaml","path":".agents/skills/to-spec/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-spec/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":33,"sizeBytes":135},{"name":"SKILL.md","path":".agents/skills/to-spec/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-spec/SKILL.md","title":"to-spec","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-spec%2FSKILL.md -->","frontmatter":{"name":"to-spec","description":"Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":643,"sizeBytes":3043},{"name":"openai.yaml","path":".agents/skills/to-tickets/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-tickets/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":35,"sizeBytes":146},{"name":"SKILL.md","path":".agents/skills/to-tickets/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/to-tickets/SKILL.md","title":"to-tickets","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fto-tickets%2FSKILL.md -->","frontmatter":{"name":"to-tickets","description":"Break a plan, spec, or the current conversation into a set of tracer-bullet tickets, each declaring its blocking edges, published to the configured tracker (edges as text in one file per ticket locally, or native blocking links on a real tracker).","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1267,"sizeBytes":5812},{"name":"AGENT-BRIEF.md","path":".agents/skills/triage/AGENT-BRIEF.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/triage/AGENT-BRIEF.md","title":"Triage Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FAGENT-BRIEF.md -->","isInternal":false,"tokens":1822,"sizeBytes":7942},{"name":"openai.yaml","path":".agents/skills/triage/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/triage/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":33,"sizeBytes":135},{"name":"OUT-OF-SCOPE.md","path":".agents/skills/triage/OUT-OF-SCOPE.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/triage/OUT-OF-SCOPE.md","title":"Triage Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FOUT-OF-SCOPE.md -->","isInternal":false,"tokens":1047,"sizeBytes":4667},{"name":"SKILL.md","path":".agents/skills/triage/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/triage/SKILL.md","title":"triage","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Ftriage%2FSKILL.md -->","frontmatter":{"name":"triage","description":"Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1567,"sizeBytes":6558},{"name":"openai.yaml","path":".agents/skills/wait-what/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wait-what/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":40,"sizeBytes":158},{"name":"SKILL.md","path":".agents/skills/wait-what/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wait-what/SKILL.md","title":"wait-what","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwait-what%2FSKILL.md -->","frontmatter":{"name":"wait-what","description":"Stop. That last message did not land: re-pitch it.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":101,"sizeBytes":396},{"name":"openai.yaml","path":".agents/skills/wayfinder/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wayfinder/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":34,"sizeBytes":144},{"name":"SKILL.md","path":".agents/skills/wayfinder/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wayfinder/SKILL.md","title":"wayfinder","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwayfinder%2FSKILL.md -->","frontmatter":{"name":"wayfinder","description":"Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":2859,"sizeBytes":12380},{"name":"openai.yaml","path":".agents/skills/wizard/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wizard/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":20,"sizeBytes":96},{"name":"SKILL.md","path":".agents/skills/wizard/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/wizard/SKILL.md","title":"wizard","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwizard%2FSKILL.md -->","frontmatter":{"name":"wizard","description":"Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself."},"isInternal":false,"tokens":966,"sizeBytes":4123},{"name":"openai.yaml","path":".agents/skills/writing-for-agents/agents/openai.yaml","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/writing-for-agents/agents/openai.yaml","title":"Agents Skill","category":"anthropic-skill","format":"yaml","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2Fagents%2Fopenai.yaml -->","isInternal":false,"tokens":21,"sizeBytes":102},{"name":"SKILL-MECHANICS.md","path":".agents/skills/writing-for-agents/SKILL-MECHANICS.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/writing-for-agents/SKILL-MECHANICS.md","title":"Writing-for-agents Skill","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL-MECHANICS.md -->","isInternal":false,"tokens":553,"sizeBytes":2629},{"name":"SKILL.md","path":".agents/skills/writing-for-agents/SKILL.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/.agents/skills/writing-for-agents/SKILL.md","title":"writing-for-agents","category":"anthropic-skill","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=.agents%2Fskills%2Fwriting-for-agents%2FSKILL.md -->","frontmatter":{"name":"writing-for-agents","description":"Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md."},"isInternal":false,"tokens":2346,"sizeBytes":10886},{"name":"domain.md","path":"docs/agents/domain.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/docs/agents/domain.md","title":"Subagent: domain","category":"subagent-persona","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fdomain.md -->","isInternal":false,"tokens":139,"sizeBytes":625},{"name":"issue-tracker.md","path":"docs/agents/issue-tracker.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/docs/agents/issue-tracker.md","title":"Subagent: issue-tracker","category":"subagent-persona","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Fissue-tracker.md -->","isInternal":false,"tokens":483,"sizeBytes":1877},{"name":"triage-labels.md","path":"docs/agents/triage-labels.md","rawUrl":"https://raw.githubusercontent.com/withcoral/coral/HEAD/docs/agents/triage-labels.md","title":"Subagent: triage-labels","category":"subagent-persona","format":"markdown","content":"<!-- Skill available on-demand via /api/skills/withcoral/coral?path=docs%2Fagents%2Ftriage-labels.md -->","isInternal":false,"tokens":158,"sizeBytes":793}],"systemPromptSnippet":"<yakaai_skills repo=\"withcoral/coral\">\n<!-- File: AGENTS.md (Tokens: ~3587 | Category: root-instruction) -->\n# Repository guidance\n\n## Canonical context\n\n- Use `GLOSSARY.md` as the product glossary.\n- Issues live in `withcoral/coral`. Always pass `--repo withcoral/coral` to\n  `gh`; this checkout also has an unrelated `upstream` remote.\n- The PR title becomes the squash commit that release-please reads. Use\n  Conventional Commits, `type(scope): summary`, and keep the title current as\n  the branch changes. Only `feat`, `fix`, `perf`, and breaking (`type!:`)\n  titles open a release PR and reach the changelog, so give a user-visible\n  change one of those. The scope appears in the release notes, so name what a\n  user sees, not an internal codename: `ui` for Reef and Wax, never `reef`.\n  `.github/workflows/pr.yml` lists the rejected scopes.\n- Tracker conventions, triage labels, and domain-document rules are under\n  `docs/agents/`.\n\n## Durable boundaries\n\n- Keep transport and presentation adapters thin. Put domain behavior behind a\n  transport-neutral interface.\n- Read process environment only at process bootstrap. Pass explicit values to\n  domain code.\n- Route untrusted outbound HTTP through `coral-outbound::Client`. Pass the\n  bootstrap-resolved operator destination policy to domain modules. Identity and\n  inbound listener selection do not determine outbound permissions. See\n  [ADR 0008](docs/adr/0008-outbound-network-permissions.md) for composition defaults.\n- Keep cross-crate W3C propagation, safe telemetry fields, and export filtering\n  in `coral-telemetry`. Domain modules own signal timing. Application bootstrap\n  owns exporter configuration.\n- Keep generated files marked `linguist-generated` in `.gitattributes`.\n\n### Persistence\n\n- Keep domain database queries, table identifiers, row mapping, and persistence\n  encoding in `repository.rs`, `*_repository.rs`, or `repository/` modules.\n  Keep authorization decisions, lifecycle rules, and outcome selection in domain\n  code outside those files. Domain code owns transaction choreography; repository\n  facets join its transaction and retain scoping, locking, and conditional-write\n  predicates needed for atomicity. Return typed evidence rather than raw rows or\n  query expressions to domain callers.\n- Mark observable mutations with `Transaction::execute_change` in the owning\n  repository (or through its existing lifecycle/Run evidence write). Reads, row\n  locks, and worker-lease renewals use `execute`, or `fetch_optional_returning`\n  for a lock that returns its row; they must not wake activity observers or Run\n  waits. Time-dependent visibility also needs an observation deadline.\n- Open read-only work with `Database::begin_read_snapshot` and non-holding\n  checks. `Database::begin` takes SQLite's write lock at `BEGIN`, so it waits\n  behind every other writer.\n- The Dispatch Fence and the held rechecks before it read the fact rows\n  they never write (a Workspace, a Provider, a policy rule, an Account) with\n  `RowLock::Shared`\n  (`Transaction::fetch_optional_locked`; `coral_db::RowLock` documents what\n  each backend does). Other decisions still take the exclusive no-op `UPDATE`\n  hold on those rows; a row the transaction goes on to write always keeps it.\n  A row that two shared-hold decisions may both create for the first time (an\n  Account placeholder, a connection request) is inserted with\n  `ON CONFLICT DO NOTHING` and reread, since no shared hold serializes its\n  creators.\n- A waiting Invocation parks with its Run Owner and never polls or\n  subscribes to the change signal itself; the owner wakes it (the\n  Wake-ups bullet of\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md)). A\n  wake-up is a hint; the held recheck decides.\n- A nonterminal Run's row and Events are written only through its Run\n  Owner: the Program paths (Emissions, Logs, Invocation admission, held\n  rechecks, the Dispatch Fence, Invocation completion), the outside\n  requests (an approval decision, a cancellation) and the owner's timers\n  (the Run deadline, each Approval Request's and connection request's\n  deadline) alike. An Event is applied in owner memory, a row write is a\n  `ChunkWork` that joins the owner's chunk commit, and an intent (a\n  cancellation, the deadline) rides a chunk's head update or the owner's\n  terminal write; every chunk commit asserts the head the owner tracks in\n  memory. A timer is armed as an effect and fires as a message into the\n  owner's mailbox, so the clock never decides state outside the owner (ADR\n  0018): a Run's timeout and an Approval Request's expiry are decided in the\n  owner's pure `apply`, in mailbox order (when the timer fires, or first\n  when a decision, a cancel or the periodic precheck of parked waits applied\n  before it finds the deadline passed),\n  the owner's own writes read the\n  clock only for their own sample (the start mark, the terminal write and a\n  recovered owner's one chunk date a timeout they find passed; the Dispatch\n  Fence judges an approved\n  request's deadline at dispatch, contract line 3, and records no expiry),\n  and no chunk commit is predicated on the clock (contract line 5). Nothing\n  outside the owner compares `now` with those deadlines to write TimedOut\n  or Expired: readers show the recorded state beside the deadline. A\n  connection request is Account-owned and shared across Runs: the Account\n  module records its expiry when a holder reads it, and the owner's timer\n  only wakes the Invocations parked on it. Do not open a transaction that\n  holds the Run row from any of these paths, and do not write a nonterminal\n  Run's row from outside its owner. A Run whose owner retired or whose\n  process is gone without ending it gets its owner back from the\n  expired-lease sweep (the Recovery section of ADR 0018); a panicked owner\n  task's supervisor ends its Run at once instead. Retention holds and\n  deletes terminal Runs only.\n  [ADR 0018](docs/adr/0018-run-owner-coordinates-each-run.md) has the\n  request model (requests keyed by the entity they decide, the first wins).\n- A Run Owner's write ends on the database's answer, never on the clock: an\n  unanswered write (`Error::is_operational`: a lost connection, a pool\n  timeout, a lock race) means a reread and a retry with bounded backoff until\n  the answer comes or the owner has retired, and a definite answer (a\n  rejection, a claim mismatch, an ended Run, a corrupt head) stops it; the\n  Interrupted record alone retries every answer but a claim mismatch or an\n  ended Run. The worker lease is ownership between processes, renewed by\n  every commit: never write a Run whose live lease another process holds.\n  The lease never ends a Run from inside its own process. The owner's\n  own bounds do (suspect after one lease without a commit, self-interrupt\n  after three, constants in `crates/coral-run/src/execution.rs`), and the\n  supervisor of a panicked owner task writes the same one Interrupted chunk.\n- Give each independently identified entity one stable ID as its sole primary\n  key. Use a composite primary key only when the tuple is the domain identity.\n- For Workspace-owned data, every externally influenced read or write must\n  match both the Workspace and entity identity, even when the entity ID is\n  globally unique.\n- Add every schema migration to `crates/coral-db/migrations`, the one shared\n  chain. Write one portable file that both databases run. When SQLite and\n  Postgres must perform a step differently, add one file with the same name to\n  both `postgres/` and `sqlite/` instead.\n- Change a schema only by adding a migration. Never delete a migration that\n  is on `main`, or change its file name or bytes: databases created from an\n  earlier `main` must keep booting.\n  `scripts/check-migrations.sh` checks this.\n  Keep the fence that rejects state written by Coral 0.x.\n- Keep schemas portable across SQLite and Postgres and fail on schema drift;\n  do not use `IF NOT EXISTS` to hide unexpected state.\n- When a migration needs a database feature whose availability it cannot\n  ensure or diagnose clearly, such as `pg_trgm` or FTS5's trigram tokenizer,\n  check it at boot before the chain runs, as `coral_search::prepare_storage`\n  does. The check names the feature and what the operator can do about it.\n- Run shared repository behavior tests against SQLite and Postgres. Use\n  `make postgres-tests` for Rust repository tests. For Reel's Postgres product\n  evidence, use the E2E scope and cadence under Validation.\n  Both own disposable databases through `scripts/postgres.ts`.\n\n### Reef and Desktop\n\n- Wax (`apps/reef/app/wax`) owns reusable visual behavior and styling. Extend\n  its primitives when a UI needs a missing capability; app-specific modules\n  compose Wax and own layout, not a parallel set of controls or theme values.\n- When a table row opens a page, pass the path to `Table.Row`'s `to` so a\n  click anywhere in the row opens it, and link its name with `Table.RowLink`.\n  Do not make only the name a link, or style the name as a link.\n  Use `Table.useRowCursor` so ↑, ↓ and Enter reach the rows.\n- Match a filter field's text with `filterQuery` (`apps/reef/app/utils/filter-query.ts`),\n  not `includes`, so every filter reads `^`, `$` and `*` the same way. To bold\n  the matches, use Wax's `HighlightedMatches`.\n- Do not show status or meaning with color alone. Pair color with a distinct\n  icon shape or text, so color-blind users can read it (WCAG 1.4.1).\n- Browser access to Coral belongs in React Router server loaders, actions, and\n  explicit resource routes. Live updates are the one exception:\n  `apps/reef/app/lib/activity-stream.ts` holds the only streaming connection,\n  to a same-origin resource route. Loaders supply initial data; streams only\n  push later changes. Reef's `.oxlintrc.json` and\n  `app/__tests__/architecture.test.ts` enforce the rest of this boundary.\n- Add or extend Reef Vitest coverage when a change fixes a reproducible bug,\n  introduces branching behavior (validation, state transitions, or error handling),\n  or affects security or an architecture invariant. Name the failure the test\n  catches and assert observable behavior through the owning module's interface.\n  For bug fixes, verify that the regression test fails without the fix.\n- Keep tests beside the behavior they protect. Exercise existing module boundaries;\n  do not extract single-use helpers solely to test them or assert implementation\n  details. Use Storybook and Chromatic for visual states and browser tests for\n  behavior that depends on browser APIs or a complete user journey. `npm test`\n  runs every story's `play` function in Chromium, so an assertion there is a\n  test; give each behavior one home, a story or a Vitest test, and query by role\n  and label with Testing Library in both. Styling and\n  static markup changes alone do not need Vitest coverage. Vitest coverage does\n  not replace required product-journey or local/remote parity evidence.\n- Use vanilla-extract, not Tailwind.\n- Reef has one build for every deployment. Do not add a Desktop build marker\n  or branch Reef on its host. Desktop's window behavior belongs in the\n  `apps/desktop` main process.\n- Reef copy follows simplified technical English (ASD-STE100): address the\n  reader as \"you\", give one instruction per sentence in the imperative, keep\n  sentences under 20 words with one idea each, use the active voice and the\n  present tense. Do not narrate what Coral does behind the scenes (\"Coral then\n  returns you here.\", \"Coral reads it once.\", \"Coral is updating this page.\").\n  Name a consequence only when the reader must act on it or would otherwise\n  lose something. Show progress as a short status: \"Completing sign-in…\".\n  Use one word for one thing: provider, workspace, organization, operation,\n  program, account, sign in. These words are lowercase in the interface; the\n  glossary and code keep their capitals.\n\n### Tests\n\n- Test each rule once, at its owner: the crate or module that implements it.\n  Transport and route tests assert their contract (status, reason, projection)\n  and leave domain rules to the owner's tests.\n- Assert a denial's exact error variant and that the denial changed nothing. A\n  bare error check also passes on a database failure.\n- Assert deltas and domain properties, not totals. Event counts, byte sizes, and\n  page sizes move whenever unrelated behavior changes.\n- Extend the nearest shared helper (`coral-test-support` or the crate's test\n  harness) and write near-duplicate cases as one table test. After a TDD loop,\n  fold the tracer tests into that table before you open the PR.\n- Inject faults through the owning crate's API or\n  `TestDatabase::execute_fixture_sql`, so the test runs on both databases.\n  Production `#[cfg(test)]` hooks only synchronize timing; every tested path is\n  one production runs.\n\n### Credentials\n\n- Tests that use dummy credentials must select filesystem credential storage.\n  Do not write test credentials to the OS keychain.\n\n## Validation\n\nUse focused unit/integration tests during implementation. Run the applicable\nrequired gates below after the change stabilizes, then report what ran:\n\n| Change                   | Required gate                                                                                                                                                                                |\n| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Dev scripts              | `./dev test`                                                                                                                                                                                 |\n| Rust                     | `make rust-checks`                                                                                                                                                                           |\n| coral-v8 embedded JS     | `npm run check --prefix crates/coral-v8`                                                                                                                                                     |\n| Postgres-backed behavior | `make postgres-tests`                                                                                                                                                                        |\n| Reef                     | `npm run check --prefix apps/reef`, `npm run typecheck --prefix apps/reef`, `npm test --prefix apps/reef`, `npm run build --prefix apps/reef`, then `npm run test:server --prefix apps/reef` |\n| Desktop                  | `npm run check --prefix apps/desktop`, `npm test --prefix apps/desktop`, then the Reel `desktop` suite: `npm run test:e2e --prefix apps/reef -- --suite desktop`                             |\n| Runtime or Reef image    | `make docker-test`                                                                                                                                                                           |\n\n### E2E scope and cadence\n\n- Give each scenario a cross-process journey or local/remote parity claim that\n  lower-level tests cannot prove. Test form state, copy, and status tables in\n  Vitest or server tests.\n- Treat E2E as an acceptance gate, not the default edit–test loop. Batch changes\n  before running affected scenarios; use a focused browser test during debugging\n  when lower-level tests cannot reproduce the failure.\n- Select affected scenarios for browser-dependent changes. Read\n  [Reel's run guide](apps/reef/e2e/README.md) for file/folder filters and suite\n  selection. Run database and deployment variants required by the affected\n  behavior or the issue's acceptance criteria.\n- Reserve full-suite runs for the final integration checkpoint or explicit\n  acceptance requirements. With multiple agents, designate one integration agent\n  to own full-suite validation of the combined changes.\n- After a failure, rerun the failing selection while fixing it. Repeat required\n  broader validation at the final checkpoint after fixes.\n- Preserve required product-journey and local/remote parity evidence. Report\n  scenario selection, database, deployment suite, and unrun required checks;\n  a focused pass is not a full-suite pass.\n\n## Maintaining agent guidance\n\n- Keep an `AGENTS.md` rule only when it is durable, non-obvious, and changes a\n  contributor's decision.\n- Do not copy repo maps, temporary implementation details, generic engineering\n  advice, or facts that a nearby manifest already makes clear.\n- Link to a canonical spec or tool instead of copying its full contract.\n- When a rule becomes stale or enforced clearly by code, tests, or tooling,\n  delete it.\n- If a change creates a new durable contributor constraint, update the nearest\n  relevant `AGENTS.md` and validate that the guidance matches the behavior.\n\n<!-- File: apps/AGENTS.md (Tokens: ~20 | Category: root-instruction) -->\n# App guidance\n\n- Format the files you change with the owning app's `npm run format`.\n\n<!-- File: .agents/skills/add-recipe/agents/openai.yaml (Tokens: ~34 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Add Recipe\"\n  short_description: \"Write a Provider Recipe for a service\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/add-recipe/SKILL.md (Tokens: ~1571 | Category: anthropic-skill) -->\n---\nname: add-recipe\ndescription: Research an upstream service and write a Provider Recipe for it in apps/reef/recipes.\nargument-hint: \"Service name, e.g. notion\"\ndisable-model-invocation: true\n---\n\nWrite a **Provider Recipe** for the service the user names. A recipe states facts about one Upstream Service (its source, how to authenticate, its inputs and servers) so Reef can pre-fill Provider Setup. It lives at `apps/reef/recipes/<id>/recipe.yaml`, with an optional icon beside it.\n\nBefore you start, read:\n\n- `GLOSSARY.md`, the **Provider Recipe** entry.\n- ADRs 0002, 0003 and 0004 in `docs/adr/`.\n- `apps/reef/recipes/schema.json`: the recipe format. Its `description` fields are the field docs.\n- Example recipes: `linear` (MCP, OAuth discovery), `github` (OpenAPI, device code, public client) and `sentry` (region input, owner-configured client, servers).\n\n## 1. Check the id\n\nDerive the id from the service name: lowercase, `[a-z][a-z0-9_]*`. If `apps/reef/recipes/<id>/` exists, stop and ask the user whether to update that recipe or pick a new id.\n\n## 2. Find a source\n\nCoral reads two kinds of source:\n\n- An **OpenAPI 3.0 or 3.1** document, fetched once from a URL without following redirects. Swagger 2.0 fails.\n- An **MCP server over Streamable HTTP**. Standalone SSE and stdio servers fail.\n\nSearch the vendor's official docs for both. Record the URL of every doc page you rely on; the PR description cites them.\n\nDone when you hold at least one usable source URL, or have reported that none exists.\n\n## 3. Plan, then wait\n\nShow the user a short plan and wait for their approval. Cover each point:\n\n- **Recipes and ids.** One source: use the bare id. OpenAPI and MCP both: offer two recipes, `<id>` for OpenAPI and `<id>_mcp` for MCP. Give both the same `display_name` and set `service: <id>` in the MCP recipe, so the catalog shows both on one card and suggests one namespace (as `github_mcp` does). A self-hosted edition with its own host: offer `<id>_self_hosted` as well.\n- **Source URLs**, and for a third-party document, the audit result and why you pinned it or not.\n- **Authentication options** and the `default` (see below).\n- **Scopes** for each OAuth option, or why it names none.\n- **Inputs and servers**, e.g. a region.\n- **Icon** source.\n- **Gaps**: anything the format cannot express.\n\nAuthentication rules:\n\n- Include every method the service supports that a recipe `method` can express, e.g. OAuth and an API key.\n- Default to OAuth when it needs no extra setup: `oauth_discovery` for MCP, or device code or authorization code with a public client. Otherwise default to the API key or personal access token.\n- Leave the OAuth client id out, so the owner configures one (as `sentry` does). Coral could register its own application later; list that as a follow-up.\n- Name scopes whenever the service reads them from the authorization request. This includes an `oauth_discovery` server that does not advertise them (as `github_mcp` does). Request every scope it offers, read and write, with a comment naming what each grants. Coral reads and writes through providers.\n- Name no scopes when the service supplies them another way: an `oauth_discovery` server that advertises them (as `hubspot` does), or a service that takes them from the app's settings (as `attio` does). Omit `scopes` for `oauth_discovery`. The other OAuth methods require the field, so write `scopes: []`. Add a comment saying why the recipe names none, and for app settings, list the scopes the owner must turn on.\n- If the only way to authenticate needs a method the format lacks, stop and report the gap and what a new method would need. Extending the format touches Reef, proto and Rust, and is out of scope here.\n\nModel regions and similar choices as an `inputs` enum inside one recipe.\n\n## 4. Write the recipe\n\nFor each approved recipe, write `apps/reef/recipes/<id>/recipe.yaml`. Start it with `# yaml-language-server: $schema=../schema.json`, then match the shape of the example recipes.\n\n- `description` follows the pattern \"Issues, events and releases from Sentry.\"\n- Write `label` and `description` text in the Reef copy style from `AGENTS.md`.\n- Comment anything a reader cannot tell from the YAML alone.\n\nFor the icon, use the vendor's official brand SVG from their brand or press page, or the Simple Icons one. If you find no clean SVG, or its terms are unclear, leave `icons` out and list it as a follow-up.\nName the logo under `icons.light`. Reef shows it on a white plate in the light theme and a dark plate in the dark theme. If it does not read on the dark plate, e.g. a black glyph, add the vendor's official or Simple Icons light variant under `icons.dark`, named `<name>-dark.svg`. If there is no clean variant or its terms are unclear, leave `icons.dark` out and list it as a follow-up.\n\nDone when every approved recipe has its file and the plan's decisions all appear in it.\n\n## 5. Test\n\nRun, and fix until both pass:\n\n```sh\nnpm ci --prefix apps/reef   # once, if apps/reef/node_modules is missing\n(cd apps/reef && npx vitest run --project server recipes.server)\nnpm run check --prefix apps/reef\n```\n\nDo not use `npm test -- recipes.server`. It also runs the Storybook tests, which match no file and exit 1.\n\nThe recipe test also enforces rules the schema cannot, such as no undeclared `{{input.x}}` and no unused credential fields.\n\nCheck each source directly:\n\n- **OpenAPI**: fetch the URL. Confirm a 200 with no redirect, and an `openapi` field of `3.0.x` or `3.1.x`.\n- **MCP**: POST an `initialize` request to the URL. Confirm a Streamable HTTP response, or a 401 that points at OAuth when the server needs sign-in.\n\nThen give the user steps for a live test, which needs their browser and account:\n\n1. Run `./dev run` (see `docs/development.md`).\n2. In Reef, open `/workspaces/<workspace>/providers/new?recipe=<id>`.\n3. Sign in, publish the provider, and run a query against one of its tables.\n\n## 6. Summarise\n\nReport:\n\n- The files you wrote.\n- Test results, including the source checks.\n- Follow-ups: missing icon, OAuth client to register, the third-party audit result, format gaps.\n- A draft PR description that cites the vendor doc URLs.\n\nThen offer to open the PR. If the user accepts, create a branch named `<prefix>/add-<id>-recipe`, using the user's usual branch prefix, and commit there.\n\n<!-- File: .agents/skills/ask-matt/agents/openai.yaml (Tokens: ~33 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Ask Matt\"\n  short_description: \"Find the right skill or workflow\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/ask-matt/PHASE-BOUNDARIES.md (Tokens: ~956 | Category: anthropic-skill) -->\n# Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *\"ok, we're done with that\"*.\n\nThe **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.\n\n## The five options\n\n| Option       | What it does                                                    |\n| ------------ | --------------------------------------------------------------- |\n| **Continue** | Stay in the session. No context switch at all.                    |\n| **`/clear`** | Empty the context window and start from nothing.                  |\n| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |\n| **Subagent** | Send the task to its own context window and get a report back.     |\n| **`/compact`** | Compress this context and seed a fresh session with the summary.  |\n\n## The tree\n\nWork top to bottom at the boundary. The first **yes** wins.\n\n**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.\n\n**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.\n\nThe cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.\n\n**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:\n\n- swapping to a **new harness** (Claude → Codex),\n- moving to a **new directory** or repo,\n- sending the work to a **colleague**,\n- or forking a side task you found **mid-phase** without derailing what you're doing.\n\nThat list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.\n\n**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.\n\n**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.\n\n`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.\n\n## Primary and secondary sources\n\nEvery move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:\n\n| Source                            | Information | Noise | Room to move |\n| --------------------------------- | ----------- | ----- | ------------ |\n| Primary (Continue)                | Full        | Lots  | Little       |\n| Secondary (`/compact`, `/handoff`) | Lossy       | Less  | Lots         |\n\nThis is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.\n\n## These are judgement calls\n\nThe questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.\n\n<!-- File: .agents/skills/ask-matt/SKILL.md (Tokens: ~3009 | Category: anthropic-skill) -->\n---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nBefore stating what a skill does or recommending a step be skipped, read that skill's SKILL.md: the summaries here are for orientation only.\n\nA **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `GLOSSARY.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)\n2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch: is this a multi-session build?**\n   - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. Then work the tickets one of two ways:\n     - **`/implement`** per ticket, **`/clear`ing context between each one**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed. Each ticket is self-contained, so the last one's context is disposable.\n     - **`/implement-spec`** for the whole spec in one run. It reads the tickets as a **task graph**, runs implementer subagents across the ready **frontier** in parallel, and lands everything on one **integration branch**. Reach for it when you'd rather orchestrate the build than drive each ticket yourself.\n   - **No** → **`/implement`** right here, in the same context window.\n\n   Either way, the code gets built by driving **`/tdd`** (one red-green slice at a time) and closes out with **`/code-review`**, a two-axis review (Standards + Spec) of the diff. `/implement` runs both per ticket; `/implement-spec`'s implementers each drive `/tdd`, and it runs one `/code-review` over the integration branch. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.\n\n   When the work goes up as a pull request, **`/pr`** shapes the body: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call. It's model-invoked, so the agent reaches for it whenever it writes a PR.\n\n4. **`/retro`** closes the loop. After a build, and especially one that went sideways, it looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards. The next build then starts from a better environment.\n\n### Context hygiene\n\nKeep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket. Run `/retro` in the session it's looking back on, before you clear; after clearing, point it at that session's log instead.\n\nThe limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.\n\n- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Once the fix is in, run **`/retro`** in the same session to ask what would have prevented the bug; where the real finding is that there's no good seam to lock it down, that's a job for **`/improve-codebase-architecture`**.\n\n- **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.\n\n  When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.\n\n## Codebase health\n\nNot feature work, just upkeep.\n\n- **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.\n\n## Vocabulary underneath\n\nTwo model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.\n\n- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word (\"account\" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `GLOSSARY.md` a clean glossary.\n- **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.\n\n## Phase boundaries\n\nA **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:\n\n- **Continue**: stay put. Costs nothing, loses nothing.\n- **`/clear`**: empty the window, when nothing here matters to what's next.\n- **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.\n- **Subagent**: send a tightly-scoped task to its own window and get a report back.\n- **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.\n\nRead [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `GLOSSARY.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.\n- **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.\n- **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.\n- **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.\n- **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.\n- **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.\n- **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.\n- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.\n\n## Precondition\n\n**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.\n\n<!-- File: .agents/skills/code-review/agents/openai.yaml (Tokens: ~23 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Code Review\"\n  short_description: \"Review a diff on standards and spec\"\n\n<!-- File: .agents/skills/code-review/SKILL.md (Tokens: ~1517 | Category: anthropic-skill) -->\n---\nname: code-review\ndescription: \"Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \\\"review since X\\\".\"\n---\n\nTwo-axis review of the diff between `HEAD` and a fixed point the user supplies:\n\n- **Standards**: does the code conform to this repo's documented coding standards?\n- **Spec**: does the code faithfully implement the originating issue / spec?\n\nBoth axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\n## Process\n\n### 1. Pin the fixed point\n\nWhatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.\n\nCapture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.\n\nBefore going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.\n\n### 2. Identify the spec source\n\nLook for the originating spec, in this order:\n\n1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.\n2. A path the user passed as an argument.\n3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.\n4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report \"no spec available\".\n\n### 3. Identify the standards sources\n\nSearch the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.\n\nOn top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:\n\n- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.\n- **Always a judgement call.** Each smell is a labelled heuristic (\"possible Feature Envy\"), never a hard violation. Like any standard here, skip anything tooling already enforces.\n\nEach smell reads *what it is* → *how to fix*; match it against the diff:\n\n- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.\n- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.\n- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.\n- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.\n- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.\n- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.\n- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.\n- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.\n- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.\n- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.\n- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.\n- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.\n\n### 4. Spawn both sub-agents in parallel\n\nIssue both sub-agent calls together, in the foreground, and aggregate the reports they return.\n\n**Standards sub-agent prompt** should include:\n\n- The full diff command and commit list.\n- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).\n- The brief: \"Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words.\"\n\n**Spec sub-agent prompt** should include:\n\n- The diff command and commit list.\n- The path or fetched contents of the spec.\n- The brief: \"Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words.\"\n\nIf the spec is missing, skip the Spec sub-agent and note this in the final report.\n\n### 5. Aggregate\n\nPresent the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).\n\nEnd with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.\n\n## Why two axes\n\nA change can pass one axis and fail the other:\n\n- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**\n- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**\n\nReporting them separately stops one axis from masking the other.\n\n<!-- File: .agents/skills/codebase-design/agents/openai.yaml (Tokens: ~23 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Codebase Design\"\n  short_description: \"Vocabulary for deep-module design\"\n\n<!-- File: .agents/skills/codebase-design/DEEPENING.md (Tokens: ~542 | Category: anthropic-skill) -->\n# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.\n\nRecommendation shape: *\"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network.\"*\n\n### 4. True external (Mock)\n\nThird-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.\n\n## Seam discipline\n\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.\n- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.\n\n<!-- File: .agents/skills/codebase-design/DESIGN-IT-TWICE.md (Tokens: ~607 | Category: anthropic-skill) -->\n# Design It Twice\n\nWhen the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on \"Design It Twice\" (Ousterhout): your first idea is unlikely to be the best.\n\nUses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel. Each must produce a **radically different** interface for the deepened module.\n\nPrompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:\n\n- Agent 1: \"Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility: support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller: make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params, plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs: where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.\n\nAfter comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.\n\n<!-- File: .agents/skills/codebase-design/SKILL.md (Tokens: ~1357 | Category: anthropic-skill) -->\n---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.\n- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n\n<!-- File: .agents/skills/diagnosing-bugs/agents/openai.yaml (Tokens: ~26 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Diagnosing Bugs\"\n  short_description: \"Diagnose hard bugs and regressions\"\n\n<!-- File: .agents/skills/diagnosing-bugs/SKILL.md (Tokens: ~2040 | Category: anthropic-skill) -->\n---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen exploring the codebase, read `GLOSSARY.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.\n\n## Redact\n\nThis skill has you show commands, outputs and captured artifacts. **Redact every secret first**: write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.\n\nIf the redacted output is not enough to diagnose the bug, say so and ask the user.\n\n## Phase 1: Build a feedback loop\n\n**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug (one that goes red on _this_ bug), you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one, in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug: unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) that drives the UI and asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate \"boot at state X, check, repeat\" so you can `git bisect run` it.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight, a debugging superpower.\n\n### Non-deterministic bugs\n\nThe goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not, so keep raising the rate until it's debuggable.\n\n### When you genuinely cannot build a loop\n\nStop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.\n\n### Completion criterion: a tight loop that goes red\n\nPhase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** (a script path, a test invocation, a curl) that you have **already run at least once** (show the invocation and its output, redacted), and that is:\n\n- [ ] **Red-capable**: it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not \"runs without erroring\"; it must be able to _catch this specific bug_.\n- [ ] **Deterministic**: same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast**: seconds, not minutes.\n- [ ] **Agent-runnable**: you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf you catch yourself reading code to build a theory before this command exists, **stop: jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.\n\n## Phase 2: Reproduce + minimise\n\nRun the loop. Watch it go red as the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described, not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut, and keep only what's load-bearing for the failure.\n\nWhy bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.\n\nDone when **every remaining element is load-bearing**: removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3: Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe: discard or sharpen it.\n\n**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly (\"we just deployed a change to #3\"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it; proceed with your ranking if the user is AFK.\n\n## Phase 4: Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.\n\n**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.\n\n## Phase 5: Fix + regression test\n\nWrite the regression test **before the fix**, but only if there is a **correct seam** for it.\n\nA correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.\n\n**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail. If you forced the red by mutating code or a fixture, `diff` against a pristine copy to prove the mutation landed before you trust it.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6: Cleanup\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message, so the next debugger learns\n\n<!-- File: .agents/skills/domain-modeling/ADR-FORMAT.md (Tokens: ~628 | Category: anthropic-skill) -->\n# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n\n<!-- File: .agents/skills/domain-modeling/agents/openai.yaml (Tokens: ~22 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Domain Modeling\"\n  short_description: \"Build and sharpen a domain model\"\n\n<!-- File: .agents/skills/domain-modeling/GLOSSARY-FORMAT.md (Tokens: ~544 | Category: anthropic-skill) -->\n# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `GLOSSARY.md` at the repo root.\n\n**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Glossary Map\n\n## Contexts\n\n- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders\n- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `GLOSSARY-MAP.md` exists, read it to find contexts\n- If only a root `GLOSSARY.md` exists, single context\n- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n\n<!-- File: .agents/skills/domain-modeling/SKILL.md (Tokens: ~777 | Category: anthropic-skill) -->\n---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── GLOSSARY.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── GLOSSARY-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── GLOSSARY.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── GLOSSARY.md\n│       └── docs/adr/\n```\n\nCreate files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. \"Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?\"\n\n### Sharpen fuzzy language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term. \"You're saying 'account': do you mean the Customer or the User? Those are different things.\"\n\n### Discuss concrete scenarios\n\nWhen domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.\n\n### Cross-reference with code\n\nWhen the user states how something works, check whether the code agrees. If you find a contradiction, surface it: \"Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?\"\n\n### Update GLOSSARY.md inline\n\nWhen a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).\n\n`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n\n<!-- File: .agents/skills/grill-me/agents/openai.yaml (Tokens: ~34 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Grill Me\"\n  short_description: \"Sharpen a plan through interview\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/grill-me/SKILL.md (Tokens: ~35 | Category: anthropic-skill) -->\n---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nCall the Skill tool with \"grilling\".\n\n<!-- File: .agents/skills/grill-with-docs/agents/openai.yaml (Tokens: ~37 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Grill with Docs\"\n  short_description: \"Grill a design and write its docs\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/grill-with-docs/SKILL.md (Tokens: ~60 | Category: anthropic-skill) -->\n---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nCall the Skill tool twice, for \"grilling\" and \"domain-modeling\".\n\n<!-- File: .agents/skills/grilling/agents/openai.yaml (Tokens: ~27 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Grilling\"\n  short_description: \"Stress-test thinking a round of questions at a time\"\n\n<!-- File: .agents/skills/grilling/SKILL.md (Tokens: ~440 | Category: anthropic-skill) -->\n---\nname: grilling\ndescription: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.\n---\n\nInterview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.\n\nWork the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.\n\nFormat a round like so:\n\n```\n❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n\n---\n\n❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>\n\n➡️ <your recommended answer>\n```\n\nWord each question so \"yes\" accepts your recommended answer.\n\nEach round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.\n\nFinding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.\n\nThe session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.\n\n<!-- File: .agents/skills/handoff/agents/openai.yaml (Tokens: ~34 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Handoff\"\n  short_description: \"Compact a conversation into a handoff\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/handoff/SKILL.md (Tokens: ~197 | Category: anthropic-skill) -->\n---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS (`$TMPDIR`, else `/tmp`; `%TEMP%` on Windows) - not the current workspace.\n\nInclude a \"suggested skills\" section in the document, naming which skills the next agent should call the Skill tool for.\n\nDo not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n\n<!-- File: .agents/skills/implement-spec/agents/openai.yaml (Tokens: ~41 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Implement Spec\"\n  short_description: \"Implement the result of /to-spec and /to-tickets in code.\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- File: .agents/skills/implement-spec/SKILL.md (Tokens: ~591 | Category: anthropic-skill) -->\n---\nname: implement-spec\ndescription: \"Implement the result of /to-spec and /to-tickets in code.\"\ndisable-model-invocation: true\n---\n\nYou have been provided a spec. This spec should have tickets associated with it, describing how to implement the spec.\n\nThe issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.\n\nThe goal is the entire spec implemented on a single **integration branch**, with every ticket resolved the way the issue tracker closes work.\n\nThe tickets are not a list of steps. They are a **task graph** with blocking relationships between them. This means there is always a **frontier** of tickets which are ready to be grabbed.\n\nCommunication to and from subagents should be sparse. Communicate primarily through **context pointers**: to the spec, tickets, research notes, and previous commits. Don't duplicate information already available via pointers.\n\n**Implementer subagents** should be run in the background where possible for maximum concurrency.\n\n## Steps\n\n1. Read the spec and tickets to understand the task graph.\n\n2. (optional) Use an **exploration subagent** to conduct any exploration required by the tickets - relevant codebase files or external documentation. Ensure the exploration subagent can save files - it should save its markdown notes in a directory outside the repo, accessible by all future subagents. This lets **implementer subagents** focus on implementation rather than exploration.\n\n3. Create the integration branch. If the issue tracker closes work through PRs, or the user asks for one, open a draft PR after the first merge in step 5 (a branch with no commits ahead of main can't open one), marked as closing the spec and tickets.\n\n4. Use **implementer subagents** to implement each ticket, each in its own worktree on its own branch. Each implementer subagent:\n   - confirms its worktree is based on the integration branch before starting, and resets onto it if not;\n   - calls the Skill tool with `tdd` to build the ticket;\n   - merges the integration branch tip into its own branch before reporting done\n\n5. Once an **implementer subagent** completes, merge its work to the integration branch with a **merger subagent**.\n\n6. If this changes the **frontier** of available tickets, kick off more **implementer subagents** to work on the new tickets. This allows for maximum concurrency.\n\n7. Once all tickets are complete, call the Skill tool with `code-review` on the integration branch. Fix all issues raised by the code review in a single **implementer subagent**.\n\n8. If a draft PR exists, mark it ready for review. Otherwise, resolve each ticket the way the issue tracker closes work, and report the integration branch.\n\n9. Clean up all **implementer subagent** worktrees.\n\n<!-- File: .agents/skills/implement/agents/openai.yaml (Tokens: ~33 | Category: anthropic-skill) -->\ninterface:\n  display_name: \"Implement\"\n  short_description: \"Build work from a spec or tickets\"\npolicy:\n  allow_implicit_invocation: false\n\n<!-- ... +53 more modular skills available via /api/skills/withcoral/coral?path={path} -->\n</yakaai_skills>"}