hatchmark docs agent-setup prints the copy that matches the installed version; when the
two differ, follow the installed copy.
Run every command yourself. Ask the user only which data source to use and, for a database, to set
the variable that holds its connection string. Never invent data, file paths, table names or
credentials, and never write a password or connection string into a file.
1. Check the environment
2. Install the CLI
Hatchmark is thehatchmark package on npm. When the user’s directory has a package.json, add it
there, so the project and its MCP server run one pinned version:
"ok": true (a warn for the project is fine). From here on, wherever a command on
this page or in the skill says hatchmark, run npx -y hatchmark.
3. Ask for the data source
Ask the user which data to use, and wait for the answer before creating anything. Ask in the same question what the project is called, unless their request already says. If their directory already holds a data file, name it in the question:- A CSV, Parquet or JSON file: get its path.
- A DuckDB or SQLite file: get its path and the table or view to read.
- PostgreSQL, MySQL or SQL Server: get which one and the table or query. Ask the user to set an
environment variable, such as
SHOP_DATABASE_URL, to the connection string in the environment that runs your commands, and to tell you its name. - BigQuery: get the Google Cloud project that runs the queries, the
dataset.tableor query, and the location when it is notUS. Ask the user to set an environment variable to a credential (the absolute path of a service account key or similar credential file, its JSON, or an access token) and to tell you its name. - No data yet: offer the sample data, US orders that the sample project ships with.
4. Create or reuse the project
If the user’s directory already has ahatchmark.yaml, it is a project: skip init and go to
step 5.
Otherwise create one. For the user’s own data, start empty:
--name is what the user calls the project, such as Acme sales; pages show it above each
title. Take it from the user’s request, or ask with the data question in step 3. Never pass the
directory name. Without --name the project has no name and pages lead with their own title.
For the sample data, drop --template minimal: the sample project has US orders in
data/orders.csv, four metrics and a sales dashboard with a weekly revenue chart, and its source
orders is already connected.
init never prompts and never runs git. Its JSON result lists what it wrote: hatchmark.yaml, a
Hatchmark block in AGENTS.md (and a CLAUDE.md that includes it), entries in .gitignore, the
agent skill under .claude/skills/ and .agents/skills/, and the hatchmark MCP server in
.mcp.json and .codex/config.toml, set to run npx -y hatchmark mcp, which uses the project’s
installed hatchmark when there is one. Tell the user what it wrote. Your agent loads the skill and
the MCP server only after a restart, so keep using the CLI until then.
Run every later command from the project directory, or add --cwd <dir>.
5. Connect the data source
List the source undersources in hatchmark.yaml, replacing the empty sources: {} that
init --template minimal writes. The section of hatchmark docs named for each type has every
option:
- A CSV, Parquet or JSON file: move or copy it under
data/, also when it already sits in the project directory, thenorders: { type: csv, path: data/orders.csv }(type: parquetorjson).pathis relative tohatchmark.yaml. Seehatchmark docs sources. - A DuckDB or SQLite file: under
data/too, with the table:orders: { type: duckdb, path: data/shop.duckdb, table: orders }. Seehatchmark docs sources#duckdb-filesandhatchmark docs sources#sqlite-files. - PostgreSQL, MySQL or SQL Server:
orders: { type: postgres, env: SHOP_DATABASE_URL, table: public.orders }(type: mysqlorsqlserver;queryinstead oftablefor a SELECT).envis the variable’s name, never its value. Seehatchmark docs sources#database-sources. - BigQuery:
orders: { type: bigquery, env: BIGQUERY_CREDENTIALS, project: acme-analytics, table: sales.orders }. Seehatchmark docs sources#bigquery. - The sample data: nothing to do.
hatchmark.yaml first:
6. Build the first page
Follow the installed skill (.claude/skills/hatchmark/SKILL.md or .agents/skills/hatchmark/SKILL.md)
to write the metrics and a dashboard for what the user asked; its references/metrics.md and
references/dashboards.md have short examples. A chart over time is a line block with a
grain such as week (hatchmark docs line). A KPI computes its metric over the page’s whole
range (a sum under last_12_months is a 12-month total), so match the range to the question: for “how did last week go”, give the page
range: { last_complete: week } and keep the long trend on another page; when a page keeps
last_12_months, name that window in the KPI title (hatchmark docs kpi#match-the-question).
Trust hatchmark docs over memory:
hatchmark docs --search "<words>" finds a section. With the sample data, the sales dashboard
already exists.
7. Check that it worked
Setup is done only when both of these succeed:check must exit 0 with "error_count": 0; warnings and notes are fine and need no change.
build must exit 0 and lists the pages it wrote in pages. A database source needs its variable
set for build: check alone passes without it.
Then get the version from hatchmark doctor --json (its version field) and tell the user,
filling in the values from the JSON results, with one Built line per page and (sample data)
after the source when you used it:
npx hatchmark dev --open.
init points the MCP server at the same package.
After the block, say in a sentence or two what you added: the metrics and dashboards you wrote.
If a step fails, show the lines that passed, then the failing step with the diagnostic’s code,
message and help line, such as ✗ hatchmark check: HM2010 data file not found followed by
its help. hatchmark explain <code> explains any code. Fixing the cause and running the step
again is fine.
Troubleshooting
The diagnostics setup runs into most often (hatchmark docs diagnostics has the format):
HM0004frominit: the directory already has filesinitwould write. Use another directory, or reuse the project if it has ahatchmark.yaml.HM2010: a source’spathpoints at no file. Paths are relative tohatchmark.yaml.HM2018orHM2015: a metric names a column the data does not have, or the data cannot be read. Compare withhatchmark data describe <source> --json.HM2040: the variable a database source names inenvis not set. Ask the user to set it.HM0002fromdata describe: the source is not inhatchmark.yamlyet, or its name differs.HM2041: the database cannot be reached with that connection string. Its message gives the driver’s reason; ask the user to check the string and network access.