Set up a dev-local launcher for this codebase
Goal: produce one script (scripts/dev-local.sh) that a person or agent runs
to bring the whole local stack up — every long-lived dev server in its own tmux
window, plus any infra (DB, cache, queues) the app needs — and a short skill doc
so it's discoverable later.
Do NOT start any dev servers yourself. You are generating the launcher, not
running it. Build it, syntax-check it, then hand it to the user to run.
This is the local, single-stack launcher. For concurrent agents that each
need their own isolated stack (one laptop can't run N), see crabbox-setup — the
cloud counterpart. It reuses this script's service/port discovery, so set this up first.
Step 1 — Investigate the repo (don't guess)
Discover the real facts before writing anything:
- Package manager & layout — look for
pnpm-workspace.yaml / turbo.json /
nx.json / lerna.json (monorepo) or a single package.json, Cargo.toml,
go.mod, pyproject.toml, Makefile, Procfile, docker-compose.yml.
- Services to run — each app/package with a
dev/start/serve script, or
each Procfile line, or each docker-compose service. Note the exact command
to start each (e.g. pnpm --filter <name> run dev, npm run dev, cargo run,
uvicorn app:app --reload).
- Ports — grep configs and
.env for the port each service binds
(PORT, listen(, server.port, framework config like rsbuild.config,
vite.config, next.config). Record which talks to which.
- Infra dependencies — does a backend need Postgres / Supabase / MySQL /
Redis / Mongo / Kafka? Check
.env(.local), ORM config, docker-compose,
and connection-string defaults. Decide how to provide each locally
(supabase start, a Docker container, an existing docker-compose).
- First-run setup — migrations, seed, codegen,
install. Note the commands
but keep them OUT of the default up path (offer a separate subcommand).
- Env files — confirm a committed
.env.example/.env; never invent or
print secrets. The script must not inject credentials.
Write down a small table: service → command → port → depends-on. That table is
the spec for the script.
Step 2 — Generate scripts/dev-local.sh
Adapt the skeleton in assets/dev-local.template.sh (same directory as this
skill). Fill in the discovered services, ports, and infra. Keep these
invariants:
- One tmux session, one window per long-lived server. Idempotent: re-running
up leaves existing windows alone instead of duplicating them.
- Preflight that fails fast with install hints when a required tool is
missing (tmux, the package manager, Docker if infra needs it).
- Infra brought up before servers, reused if already running.
- Subcommands:
up, down (and down --all to stop infra), status (window
list + port check), logs <name>, restart <name>, attach, plus any
project-specific one-shots (migrate, seed).
- Resolve repo root from the script's own location so it works from any cwd.
- No secrets in the script. Print URLs and a port check at the end of
up.
If the repo has no infra needs, drop the Docker/DB parts entirely — keep it
to preflight + tmux windows. Match the script's complexity to the repo; simpler
is better.
Then: chmod +x scripts/dev-local.sh and bash -n scripts/dev-local.sh to
syntax-check. Verify the read-only status path runs cleanly. Do not run up.
Step 3 — Write a short skill doc
Create .claude/skills/dev-local/SKILL.md (or the repo's skills location) with:
frontmatter (name: dev-local, a description listing trigger phrases), a
service/port table, prerequisites, the subcommand list, and brief
troubleshooting (port-in-use, a window exited, infra not running). Keep it to one
screen — it documents the script, it doesn't re-explain it.
Step 4 — Hand off
Tell the user the exact commands: scripts/dev-local.sh up, plus any first-run
step (… migrate). List the URLs. Note any prerequisite they must install or
start (e.g. Docker Desktop) before the first up.
Principles
- Discover, don't assume. Ports and start commands come from the repo, never
from convention alone.
- Idempotent & safe to re-run. No duplicate servers, no clobbered infra.
- Right-sized. A 3-service monorepo with Postgres+Redis needs the full
skeleton; a single Vite app needs ~30 lines. Don't over-build.
- Never run servers or print secrets. Generate, syntax-check, hand off.
1---2name: dev-local-setup3description: Scaffold a one-command dev-local launcher for any codebase by investigating services, ports, and infra dependencies, then generating a single script with tmux session management.4---56# Set up a `dev-local` launcher for this codebase78Goal: produce **one script** (`scripts/dev-local.sh`) that a person or agent runs9to bring the whole local stack up — every long-lived dev server in its own tmux10window, plus any infra (DB, cache, queues) the app needs — and a short skill doc11so it's discoverable later.1213Do NOT start any dev servers yourself. You are *generating* the launcher, not14running it. Build it, syntax-check it, then hand it to the user to run.1516> This is the **local, single-stack** launcher. For **concurrent agents** that each17> need their own isolated stack (one laptop can't run N), see `crabbox-setup` — the18> cloud counterpart. It reuses this script's service/port discovery, so set this up first.1920## Step 1 — Investigate the repo (don't guess)2122Discover the real facts before writing anything:23241. **Package manager & layout** — look for `pnpm-workspace.yaml` / `turbo.json` /25 `nx.json` / `lerna.json` (monorepo) or a single `package.json`, `Cargo.toml`,26 `go.mod`, `pyproject.toml`, `Makefile`, `Procfile`, `docker-compose.yml`.272. **Services to run** — each app/package with a `dev`/`start`/`serve` script, or28 each `Procfile` line, or each `docker-compose` service. Note the exact command29 to start each (e.g. `pnpm --filter <name> run dev`, `npm run dev`, `cargo run`,30 `uvicorn app:app --reload`).313. **Ports** — grep configs and `.env` for the port each service binds32 (`PORT`, `listen(`, `server.port`, framework config like `rsbuild.config`,33 `vite.config`, `next.config`). Record which talks to which.344. **Infra dependencies** — does a backend need Postgres / Supabase / MySQL /35 Redis / Mongo / Kafka? Check `.env`(`.local`), ORM config, `docker-compose`,36 and connection-string defaults. Decide how to provide each locally37 (`supabase start`, a Docker container, an existing `docker-compose`).385. **First-run setup** — migrations, seed, codegen, `install`. Note the commands39 but keep them OUT of the default `up` path (offer a separate subcommand).406. **Env files** — confirm a committed `.env.example`/`.env`; never invent or41 print secrets. The script must not inject credentials.4243Write down a small table: service → command → port → depends-on. That table is44the spec for the script.4546## Step 2 — Generate `scripts/dev-local.sh`4748Adapt the skeleton in `assets/dev-local.template.sh` (same directory as this49skill). Fill in the discovered services, ports, and infra. Keep these50invariants:5152- **One tmux session**, one window per long-lived server. Idempotent: re-running53 `up` leaves existing windows alone instead of duplicating them.54- **Preflight** that fails fast with install hints when a required tool is55 missing (tmux, the package manager, Docker if infra needs it).56- **Infra brought up before servers**, reused if already running.57- Subcommands: `up`, `down` (and `down --all` to stop infra), `status` (window58 list + port check), `logs <name>`, `restart <name>`, `attach`, plus any59 project-specific one-shots (`migrate`, `seed`).60- Resolve repo root from the script's own location so it works from any cwd.61- No secrets in the script. Print URLs and a port check at the end of `up`.6263If the repo has **no infra needs**, drop the Docker/DB parts entirely — keep it64to preflight + tmux windows. Match the script's complexity to the repo; simpler65is better.6667Then: `chmod +x scripts/dev-local.sh` and `bash -n scripts/dev-local.sh` to68syntax-check. Verify the read-only `status` path runs cleanly. Do not run `up`.6970## Step 3 — Write a short skill doc7172Create `.claude/skills/dev-local/SKILL.md` (or the repo's skills location) with:73frontmatter (`name: dev-local`, a `description` listing trigger phrases), a74service/port table, prerequisites, the subcommand list, and brief75troubleshooting (port-in-use, a window exited, infra not running). Keep it to one76screen — it documents the script, it doesn't re-explain it.7778## Step 4 — Hand off7980Tell the user the exact commands: `scripts/dev-local.sh up`, plus any first-run81step (`… migrate`). List the URLs. Note any prerequisite they must install or82start (e.g. Docker Desktop) before the first `up`.8384## Principles8586- **Discover, don't assume.** Ports and start commands come from the repo, never87 from convention alone.88- **Idempotent & safe to re-run.** No duplicate servers, no clobbered infra.89- **Right-sized.** A 3-service monorepo with Postgres+Redis needs the full90 skeleton; a single Vite app needs ~30 lines. Don't over-build.91- **Never run servers or print secrets.** Generate, syntax-check, hand off.