build-and-runlisted
Install: claude install-skill matejformanek/postgres-claude
# build-and-run
## Slash-command wrappers (use these first)
The recipes in this skill are also exposed as slash commands under
`.claude/commands/`. Prefer them — they encode the right flags and
guardrails:
- `/setup-pg` — first-time meson setup + build + install (idempotent;
`--force` to reconfigure).
- `/pg-start`, `/pg-stop`, `/pg-restart` — lifecycle.
- `/pg-psql` — `psql -h /tmp -d postgres` against the dev cluster.
- `/pg-test [--suite NAME] [--test PAT]` — meson test, always prepends
`--suite setup` so the initdb-template trap can't bite.
- `/pg-attach` — get a backend PID and print the `lldb -p` line.
- `/pg-tail-log` — follow `dev/data-debug/server.log`.
- `/pg-fresh --yes` — wipe `data-debug/`, re-initdb (preserves the build).
- `/pg-reclone-dev` — nuclear: re-clone the whole dev tree from the
read-only reference.
- `/setup-pg-asan` / `/pg-start-asan` — sibling profile built with
AddressSanitizer + UndefinedBehaviorSanitizer (see "Sanitizer builds"
below); use this when chasing memory bugs or undefined behavior.
The rest of this file is the underlying mechanics, for cases where you need
to deviate from the wrappers.
## Running these from a git worktree (gotcha)
Every `/pg-*` command above resolves paths via `$PWD/dev/...` and
`$PWD/source/...`. The `dev` and `source` symlinks live at the
**root of the postgres-claude repo**, and `git worktree add` (or this
project's `EnterWorktree` tool) does NOT propagate them into the new
worktree. Inside a worktree