---
name: dev-local-setup
description: Use when you want a one-command local dev launcher: scaffolds scripts/dev-local.sh (up/down/status/logs/restart) running every service in one tmux session.
---
# Dev Local Setup
## What this does
Investigates a repo to find its services, ports and infra dependencies, then generates one script, `scripts/dev-local.sh`, that brings the whole local stack up. Each long-lived dev server gets its own tmux window. It also writes a short skill doc so the launcher is easy to find later.
## When to use
Use when someone says "set up dev-local", "make a one-command dev launcher", "I want one script to start this repo", or "scaffold dev-local for this project".
## How to run it
Do NOT start any dev servers yourself. You are generating the launcher, not running it.
### Step 1: Investigate the repo (don't guess)
1. Package manager and layout: look for `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`, a single `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `Makefile`, `Procfile`, `docker-compose.yml`.
2. Services to run: each app or package with a `dev`/`start`/`serve` script, each `Procfile` line, each `docker-compose` service. Note the exact start command for each (e.g. `pnpm --filter <name> run dev`, `npm run dev`, `cargo run`, `uvicorn app:app --reload`).
3. Ports: grep configs and `.env` for the port each service binds (`PORT`, `listen(`, `server.port`, vite/next/rsbuild config). Record which service talks to which.
4. Infra dependencies: Postgres, Supabase, MySQL, Redis, Mongo, Kafka? Check `.env`/`.env.local`, ORM config, `docker-compose`, connection-string defaults. Decide how to provide each locally (`supabase start`, a Docker container, an existing compose file).
5. First-run setup (migrations, seed, codegen, install): note the commands but keep them OUT of the default `up` path. Offer them as separate subcommands.
6. Env files: confirm a committed `.env.example`/`.env`. Never invent or print secrets. The script must not inject credentials.
Write a small table: service -> command -> port -> depends-on. It is the spec for the script.
### Step 2: Generate `scripts/dev-local.sh`
Keep these invariants:
- One tmux session, one window per long-lived server. Idempotent: re-running `up` leaves existing windows alone.
- Preflight that fails fast with install hints when a required tool is missing (tmux, the package manager, Docker if infra needs it).
- Infra is brought up before servers and reused if already running.
- Subcommands: `up`, `down` (and `down --all` to stop infra), `status` (window list + port check), `logs <name>`, `restart <name>`, `attach`, plus project one-shots (`migrate`, `seed`).
- Resolve the 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. Match complexity to the repo: a single Vite app needs about 30 lines; a 3-service monorepo with Postgres and Redis needs the full version.
Then run `chmod +x scripts/dev-local.sh` and `bash -n scripts/dev-local.sh`. 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), the service/port table, prerequisites, the subcommand list, and brief troubleshooting (port in use, a window exited, infra not running). Keep it to one screen.
### Step 4: Hand off
Give the user the exact commands: `scripts/dev-local.sh up`, plus any first-run step (`... migrate`). List the URLs. Name any prerequisite to install or start first (e.g. Docker Desktop).
## Principles
- Discover, don't assume: ports and commands come from the repo.
- Idempotent and safe to re-run: no duplicate servers, no clobbered infra.
- Right-sized: don't over-build.
- Never run servers or print secrets. Generate, syntax-check, hand off.
## Output
- `scripts/dev-local.sh`, executable and syntax-checked.
- A short `dev-local` skill doc.
- A handoff message with commands, URLs and prerequisites.
Credit: Based on public content by AI-Builder-Club, packaged by Orbit.