Let a coding agent (Claude Code, Codex) stand a project up under hack — or adopt an existing setup — instead of doing it by hand. One canonical onboarding prompt drives every entry point below; the content lives in the CLI, so it is always current for your installed version.
| You have | Use |
|---|---|
| A fresh repo + an agent CLI installed | hack init --with claude|codex|both |
| An existing hack project | hack agent onboard (prints the prompt) |
| An agent session with the hack skills installed | /hack-init |
| A no-shell MCP client | the hack-init MCP prompt (hack setup mcp) |
cd /path/to/repo
hack init --auto --with claude # or codex, or both- Runs the normal init, then launches the agent CLI interactively with the full
onboarding prompt (
claude "<prompt>"/codex "<prompt>"). - If the agent CLI is not on PATH, the prompt is printed with copy-paste instructions instead.
- If
.hack/already exists, init is skipped and the handoff proceeds in existing-project mode. - With
--no-interactive(orHACK_NO_INTERACTIVE=1, or no TTY) nothing is spawned — the prompt is always printed.
hack agent onboard # prints the onboarding prompt for this project
hack agent onboard | pbcopy # copy it for any agent sessionThe prompt picks up the project name and dev host from .hack/hack.config.json
when present.
hack setup claude and hack setup codex install a thin hack-init skill
(.claude/skills/hack-init/SKILL.md / .codex/skills/hack-init/SKILL.md).
The skill tells the agent to run hack agent onboard (or fetch the hack-init
MCP prompt) and follow it — the content stays in the CLI, so installed skills
never go stale on substance.
- Inventory — package manager, workspaces, services and ports, databases/queues,
.env*files (they becomehack envcandidates), scripts that need env. - Setup —
hack init --autoor config edits, compose services with Caddy labels on thehack-devnetwork, dev_host/subdomain design,hack env add(--secretfor secrets;.envfiles get replaced by hack env +hack host exec). - Platform nuances — deps container pattern (named
node_modulesvolume so macOS-host installs never poison linux containers) and an ops/tooling container for migrations and one-off jobs. - Running things — the
hack run/hack exec/hack host exec/ Caddy-hostname decision guide. - Verification loop —
hack up --json→hack ps --json→hack open --json→ curl orhack logs, iterating untilhack doctoris clean.
Full containerization (every process in compose) is the default recommendation, but
it is not the only supported shape. hack works fine running only the backing
services — postgres, temporal, redis, and similar — while app dev servers (bun dev, dotnet watch, vite) stay on the host.
When to choose it:
- Heavy native toolchains (.NET, large native builds) develop faster on the host than in a container.
- The hot-path dev server (the one you restart constantly) benefits from host-native file watching, debuggers, or hot reload that containers make slower or flakier.
- The team already has a working host-based dev workflow and containerizing it is not worth the churn.
What hack still gives you in this shape:
- Stable hostnames and TLS for the backing services via Caddy (
postgres.<project>.hack,temporal.<project>.hack, ...), so host processes and containers address them the same way. - Branch instances for the containerized services (
--branch <name>), even though the host-run app processes are not branch-isolated on their own. - Committed, hack-managed env (
hack env add) for connection strings and secrets, instead of hand-maintained.envfiles. - Lifecycle hooks (
startup/lifecyclein.hack/hack.config.json) for host-side setup — tunnels, SSO bootstrap — that would otherwise be ad-hoc terminal steps.
How to wire it:
- Define only the backing services in
.hack/docker-compose.yml; add Caddy labels where a stable hostname is useful (databases usually don't need one — connect by container port — but admin UIs, queues, or shared services often do). - Give host dev servers their connection info via
hack host exec --scope <svc> -- <cmd>(injects the resolved env without touching.envfiles) orhack env listfor a one-off lookup. - App URLs can stay on plain
localhost:<port>for the fast path, or get promoted to a routed compose service later if you want a stable*.hackhostname for them too — the two are not mutually exclusive and can be migrated incrementally.
Tradeoffs vs full containerization:
- No single
hack upbrings up the whole stack for a newcomer — they still need to start the host dev servers themselves (document that step). - Host-run app processes are not branch-isolated by hack; running two branches side by side means varying ports/env per worktree yourself.
Partial adoption is a valid end state, not an incomplete migration — do not treat it as something to "finish" into full containerization unless the tradeoffs above actually bite.
Paste this into a fresh Claude Code / Codex session started at the repo root:
Set this repository up to run under the hack CLI. Run `hack agent onboard`
(pass --no-interactive to hack commands) and follow the printed onboarding
prompt exactly, phase by phase. If the hack CLI is missing, stop and tell me.
Finish only when `hack doctor` is clean and every routable service responds.