Skip to content
Skills Library
Programming · Building & coding

adding-an-operation

/adding-an-operation

Path of an operation from catalog to handler, store, CLI, MCP, generated files and tests. Use when you add or change an entry in packages/contracts/src/ops/catalog.ts or its handler. Don't use for field or break rules (use working-with-contracts) or CLI/MCP output (use designing-agent-surfaces).

Repository
spur-board ↗
Licence
MIT
Last repository change
13.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Path of an operation from catalog to handler, store, CLI, MCP, generated files and tests. Use when you add or change an entry in packages/contracts/src/ops/catalog.ts or its handler. Don't use for field or break rules (use working-with-contracts) or CLI/MCP output (use designing-agent-surfaces).

Original author description

Path of an operation from catalog to handler, store, CLI, MCP, generated files and tests. Use when you add or change an entry in packages/contracts/src/ops/catalog.ts or its handler. Don't use for field or break rules (use working-with-contracts) or CLI/MCP output (use designing-agent-surfaces).

How it works

  1. 1. Catalog entry
  2. 2. Core handler
  3. 3. Store
  4. 4. HTTP, CLI and MCP
  5. 5. MCP annotations
  6. 6. Generated files
  7. 7. Tests to extend
  8. 8. Reference operations
Original SKILL.md headings · 83 lines, 523 words
SKILL.md preview
---
name: adding-an-operation
description: Path of an operation from catalog to handler, store, CLI, MCP, generated files and tests. Use when you add or change an entry in packages/contracts/src/ops/catalog.ts or its handler. Don't use for field or break rules (use working-with-contracts) or CLI/MCP output (use designing-agent-surfaces).
---

# Adding an operation

One catalog entry drives the daemon route, the CLI command and the MCP tool. Work the steps in
path order. A PR that changes this path or these rules updates this skill in the same PR.

## 1. Catalog entry

- Add the entry to `OPERATIONS` in `packages/contracts/src/ops/catalog.ts`; shapes, grants,
  errors and bindings follow `.agents/skills/working-with-contracts/references/operation.md`,
  which names each check in `describe('catalog')` and `describe('snapshot')` of
  `packages/contracts/test/ops.test.ts`.

## 2. Core handler

- Write a `Mutation<'<id>'>` (`packages/core/src/app/commands.ts`) or `Query<'<id>'>`
  (`packages/core/src/app/queries.ts`) in the matching module under `packages/core/src/app/`, and
  register it in `createOperationRegistry` (`packages/core/src/app/registry.ts`).
- A mutation that must read an external source first adds `prepare`: `createApply` runs it after
  the input and key checks, a stored-key replay check and a read-only authorization, before the
  transaction, and passes its result as `ctx.prepared`. A stored key skips `prepare`, and a
  same-key call waits for the one in flight. `prepare` never writes. Reference: `task.submit` in
  `packages/core/src/app/turn-commands.ts`.
- `createOperationRegistry` returns the total `OperationHandlers`
  (`packages/core/src/app/operations.ts`), so a catalog entry without a registration fails
  `tsc`. `OperationRegistry` stays `Partial` for transports, and `dispatchOperation` answers
  `not_implemented` when the requested handler is missing or has a mismatched `id`. The coverage
  test is in
  `packages/core/test/app/registry.test.ts`.

## 3. Store

- A new table or column is a migration in `packages/core/src/store/migrations/` plus its types
  in `packages/core/src/store/schema.ts`; follow `working-with-storage`.

## 4. HTTP, CLI and MCP

- No per-operation code. `/v1/ops/:id` in `packages/core/src/api/server.ts`, `createProgram` in
  `packages/cli/src/cli.ts` and `createMcpServer` in `packages/cli/src/mcp.ts` loop over the
  catalog. An operation that seems to need a special case there needs a catalog field instead;
  raise it in the issue before implementing.
- Command, tool and output conventions: `designing-agent-surfaces`.

## 5. MCP annotations

- Leave `mcp.destructive` unset unless the mutation passes the additive rule under "Bindings" in
  `.agents/skills/working-with-contracts/references/operation.md`. Decide it by reading every
  write the handler reaches, helpers included; the pin sees only the catalog.

## 6. Generated files

- Run `pnpm gen` and commit every file it changes: `packages/contracts/ops.snapshot.json`, the
  product skill `packages/skills/spur-board/SKILL.md` with its pages in
  `packages/skills/spur-board/references/`, and `docs/cli.md`. The gen job in
  `.github/workflows/ci.yml` fails on a diff or an untracked page.
- Any catalog change moves the `version` in `packages/contracts/ops.snapshot.json`: a running
  daemon and live `board mcp` sessions answer `version_mismatch` until both restart. Say so in
  the PR Description.

## 7. Tests to extend

- The literal table under `describe('grants')` in `packages/contracts/test/ops.test.ts`.
- The non-destructive pin under `describe('catalog')` there, for a `destructive: false` entry.
- `packages/cli/test/__snapshots__/mcp.test.ts.snap`: rerun `packages/cli/test/mcp.test.ts` with
  `-u` and read the diff.
- A handler test in `packages/core/test/app/` that goes through `createOperationRegistry`.
- A daemon integration test in `packages/daemon/test/` when the operation reaches a gateway.
- Each changed expected value above, and the snap that `pnpm guardrails` reports, is a Changed
  checks entry (`gitflow`).

## 8. Reference operations

- `comment.add`, the plain mutation: its entry in `packages/contracts/src/ops/catalog.ts` ->
  `add` in `createBlockMutations` -> `addComment` (both `packages/core/src/app/blocks.ts`) ->
  `'comment.add'` in `createOperationRegistry` -> `dispatchOperation` -> `/v1/ops/:id` ->
  `createProgram` and `createMcpServer`. Tests: `describe('production query handlers')` in
  `packages/core/test/app/queries.test.ts`, which calls it through `createOperationRegistry`, and
  `describe('board mcp')` in `packages/cli/test/mcp.test.ts`.
- `block.ask`, through a gateway: `packages/daemon/test/worker-question.integration.test.ts`.
- `link.add`, a union input with `cli.modes` (`linkModes` in the catalog) and a migration
  (`packages/core/src/store/migrations/0010_manual_links.sql`); handler `createLinkMutations` in
  `packages/core/src/app/links.ts`.

Versions

The database has no other skills named adding-an-operation.

Database snapshot: 13.11.2026 · package version e5e3d1b207d5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100designing-agent-surfaces
    Rules for what agents see from the board - MCP tool names, descriptions, schemas and annotations, and CLI output, stdout and help. Use when you change packages/cli/ or how an operation reads to an agent. Don't use for adding an operation (use adding-an-operation) or errors (use handling-errors).
  • 100add-operation
    Points to the single how-to for adding a new LoreKit operation — an MCP tool, CLI command, or REST route — across the tool catalog, both permission mirrors, the audit vocabulary, and docs. Thin skill; the procedure lives in docs/adding-an-operation.md, never duplicated here.…
  • 100add-operation
    The end-to-end procedure for adding, overriding, or disabling a Kavo operation — registry entry, DTO slots, handler, route metadata, and tests. Use when a change introduces a new CRUD operation or a custom per-entity operation.
  • 100check-coverage
    Ensure comprehensive test coverage for a CLI handler. Use when adding a new command or auditing existing handler coverage.
  • 100adding-mcp-store-servers
    Add a third-party MCP server (Linear, Notion, GitHub, ...) to the PostHog MCP store catalog. Use when asked to "add X to the MCP store", expand the MCP server marketplace, or fix a broken catalog entry. Covers finding the vendor's remote MCP endpoint, probing it (handshake,…
  • 95add-command
    Add support for a new CLI command. Use when implementing a handler or adding to SIMPLE_SAFE.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.