add-resource-command

Installation
SKILL.md

add-resource-command

Authoritative contract for adding a resource end-to-end. The work spans five layers — domain schema, resource methods, presentation view, commands, tests — plus a mandatory close-out (/review then /simplify) before the task is done. The order matters: earlier layers feed types into later ones, and deviating from house style at any step produces drift the type-checker can't catch.

A resource straddles both workspace packages. The schema and the endpoint knowledge are client surface and land in packages/client/src/domain/ and packages/client/src/resources/; the presentation binding and the commands that consume them are CLI surface and land in packages/cli/. Adding a domain file alone is not the unit of work — a schema without a method is unreachable, a resource without a command isn't useful, and a command without an e2e test isn't trustworthy.

The one-line shape of the whole thing: a command resolves its flags, calls client.<resource>.<method>(…), and renders the result. Every /api/ path, every query-parameter name, and every call to the HTTP transport lives in packages/client/src/resources/<r>.ts.

Step 0 — Pre-flight (mandatory)

Anchor to the existing house style. Skip this and you will produce drift the type-checker won't catch.

  1. ls packages/client/src/domain/ and read one existing resource schema file end-to-end (e.g. packages/client/src/domain/segment.ts).
  2. Read the matching packages/client/src/resources/segment.ts and its wire test packages/client/src/resources/segment.test.ts, then packages/client/src/client.ts for how a namespace is composed onto the client.
  3. Read packages/cli/src/output/view.ts (the CLI-side ColumnDef<T> / ResourceView<T> contract) and one existing packages/cli/src/output/views/<r>.ts presentation binding.
  4. Read one existing list command and one existing get command (look under packages/cli/src/commands/<noun>/). Note how <Resource>ListEnvelope, outputSchema, capabilities, parseId, renderList, renderItem, and defineMetabaseCommand compose.
  5. Read one existing e2e test (tests/e2e/<noun>.e2e.test.ts) and the harness (tests/e2e/run-cli.ts, tests/e2e/bootstrap-data.ts). The add-e2e-test skill's runtime contract is binding here — re-read it before writing the e2e file.
  6. Read packages/cli/src/output/types.ts for listEnvelopeSchema, the ListEnvelope<T> interface, and ListRange; then packages/cli/src/output/window.ts for the three window helpers (windowList, windowServerPage, collectForOutput) and the PageSource<T> / PageRequest contract.
Installs
5
GitHub Stars
13
First Seen
Jun 19, 2026
add-resource-command — metabase/metabase-cli