/dev-script:dev-scriptfrom dev-script
Generates idempotent dev.sh/dev.ps1 launchers for the current stack with Compose orchestration, healthchecks, port handling, HTTPS-on-LAN via mkcert+Caddy, and cross-platform migration guards.
Ships in dev-script. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill produces a single executable (dev.sh for Linux/macOS, dev.ps1 for Windows) that brings up the entire local development stack of the current project — containers, databases, APIs, frontend, IdP, and any bootstrap step — in one command. The generated script is idempotent, fails loudly with actionable messages, and cleans up after itself on Ctrl+C.
It is not a generic init: each script is shaped by what was detected in the project. Sections that don't apply (e.g., TLS termination when there's no IdP) are not emitted, so the result stays minimal and readable.
Use it whenever the user wants any of these outcomes — even if they don't say "dev.sh":
docker compose up + cd ... && npm run dev ritual"dev.ps1 for the Windows folks on the team"If the project already has a dev.sh / dev.ps1, default to improving it (read it first, propose a diff) rather than overwriting blindly. Confirm with the user before replacing existing infrastructure.
The skill works in five short phases. Don't skip phases — each one feeds the next.
Walk the project tree and identify:
docker-compose.yml, infra/docker/*.yml, infra/postgres/*.yml, compose.*.yml. Note services, ports, healthcheck blocks, volumes. Compose is the source of truth for what containerized infra exists.package.json workspaces, pnpm-workspace.yaml, turbo.json, nx.json, lerna.json. Identify each workspace's role from its own package.json (scripts.dev, scripts.start, declared deps).vite.config.*), Next (next.config.*), Astro, SvelteKit, Nuxt. Capture the configured port and any host setting. Read the config; do not modify it.tsx watch, nest start --watch, dotnet watch, air (Go), cargo watch. Capture port from .env/.env.example (PORT=). Note which package manager runs these scripts (yarn.lock / pnpm-lock.yaml / package-lock.json + a packageManager field) and resolve it Corepack-aware — a bare yarn/pnpm is often absent (Corepack isn't enabled by default) or shadowed by Debian's cmdtest impostor (pitfalls.md §P20).scripts/bootstrap-*.ts, infra/.../init/. These run after containers are healthy. Capture them — they typically generate IDs that downstream services depend on..env files — .env, .env.example, .env.local, packages/*/.env. List every key the dev script will need to read or patch. When the script reads a value out of a .env (container name, DB user, port) to drive docker exec / healthchecks, route it through a CRLF-stripping helper — Windows/WSL .env files are commonly CRLF and a trailing \r silently breaks docker exec / pg_isready while every log line looks correct (pitfalls.md §P18).command -v mkcert plus any existing infra/certs/ folder. If mkcert is installed and the user wants LAN access, that's the recipe.dev.sh / dev.ps1 / Makefile / Justfile / Taskfile.yml if present. Improve, don't replace.Read references/stack-detection.md when you need the exact patterns and grep recipes for this phase.
Before writing anything, state the plan as a short bullet list:
dev.sh (or dev.ps1) that does X, Y, Z."NODE_EXTRA_CA_CERTS, Vite via --config wrapper, frontend bootstrap of VITE_OIDC_CLIENT_ID from bootstrap.json."--no-lan, --no-https, --reset, --down, --host <ip>."dev.sh, infra/caddy/Caddyfile, .gitignore updates."vite.config.ts, packages/backend/src/server.ts — all customization via env/CLI/wrapper config."Wait for the user to confirm or redirect. Big tip: people often forget about a Windows or macOS teammate. Ask explicitly: "Do you also need dev.ps1 for Windows?" — if yes, both scripts share the same logic and you'll write them in lockstep.
The skill bundles two parallel templates:
assets/dev.sh.tmpl — bash, target Linux/macOS, default for most projects.assets/dev.ps1.tmpl — PowerShell ≥ 5.1 / pwsh 7+, target Windows; also runs on Linux/macOS via pwsh.Both templates are annotated with <<…>> placeholders — substitute them based on Phase 1 detection. Both are section-conditional: cut TLS/Caddy if the project has no IdP and the user said "no LAN sharing"; cut the bootstrap re-derivation block if there's no bootstrap.json source. Smaller is better.
The PowerShell template is not a literal port — it uses idiomatic PowerShell (Get-NetTCPConnection, Stop-Process, Register-EngineEvent for cleanup, $ErrorActionPreference = 'Stop' for set -e semantics). Read references/powershell-patterns.md for the equivalences before substituting.
Write the script(s) to the project root, plus any sidecar files (infra/caddy/Caddyfile, infra/docker/docker-compose.<idp>.override.yml.tmpl if generated at runtime, etc.). Make dev.sh executable (chmod +x).
Always update .gitignore for runtime artifacts the script creates: state files, generated overrides, mkcert-bootstrapped infra/certs/, the auto-generated Vite config wrapper. Spell these out in .gitignore so the user doesn't accidentally commit them.
Syntax-check the generated script before handing back: bash -n dev.sh / pwsh -NoProfile -Command "{ . ./dev.ps1 }".
After writing, summarize for the user:
./dev.sh (or pwsh dev.ps1) does, in a few lines.externalDomain — re-run with --reset to nuke it")../dev.sh).If you added LAN HTTPS, also mention that LAN clients need to install the mkcert root CA (mkcert -install on the client, or import rootCA.pem manually) — without that step, every browser will show a certificate warning.
These keep the output predictable and prevent the long tail of stack-specific bugs.
Do not edit vite.config.ts, next.config.js, packages/<pkg>/src/server.ts, etc. All customization rides on:
PORT, HOST, NODE_EXTRA_CA_CERTS, AUTH_AUDIENCE, …)vite --host 0.0.0.0, dotnet run --urls, …).vite.config.lan.ts that does mergeConfig(base, { server: { allowedHosts: true } }))Why: the dev script must coexist with CI, prod builds, and other contributors' workflows that consume the same config files. Mutating them is a leaking abstraction.
If the detected stack has no IdP, the generated dev.sh should not contain a --no-https flag, mkcert plumbing, or Caddy override — just omit those sections entirely. Flags and dead code are debt; future-you reading the script should see only what runs.
Re-running the script should converge, not diverge. Patterns from references/idempotency-and-state.md (read it when designing the state file or the re-run guards):
projectId, clientId) from the bootstrap output — never hardcode in .env files committed to the repo..dev.script.state or similar) capturing values that, if changed, require a destructive reset (e.g., Zitadel externalDomain). Compare against current invocation; abort with a clear message if reset is required, suggesting the precise flag.A sleep 30 between docker compose up and the next step is a smell. Each component has its own readiness signal:
pg_isready -U <user> inside the container.curl -fsS <base-url>/health (or /healthz, or /debug/ready for Zitadel).bootstrap.json).Spinlock with a timeout (max 30–60s, then fail with the exact URL/command that wasn't responding). See references/bash-patterns.md and references/powershell-patterns.md for the canonical loops.
trap cleanup EXIT SIGINT SIGTERM (bash) / Register-EngineEvent PowerShell.Exiting + try/finally (PS). Cleanup kills the dev servers (process group: kill -- "-$pgid" in bash) and only optionally the containers (gated behind --down because most users want containers persisted across re-runs).
The corollary: never leave orphans. If the script started 3 child processes, all 3 must die when the user hits Ctrl+C. Pid-array tracking + group-kill handles this — the alternative (pkill -f vite) is fragile in both directions: it kills too few (pitfalls.md §P9) and it can kill too many, starting with the shell running it, because -f matches your own wrapper's command line (§P9a).
Service ports get hit by two different failure modes that need different responses. Pick by who owns the port:
find_available_port and propagate the chosen port to peer services via per-subshell env vars (so the Vite proxy API_PORT, backend CORS APP_WEB_URL, OIDC redirect URIs all land on the right value). Non-destructive; right default for multi-process launchers where peers depend on each other's ports. Pairs well with strictPort: true downstream — pre-flight picks a free port, strictPort enforces the choice (no silent Vite fallback to 5174 that desyncs the proxy).pgrep -af pattern). Fallback chain fuser → lsof → ss (or Get-NetTCPConnection on Windows) covers distros and container setups that expose port-to-pid resolution differently.Conflating the two is the source of pitfall §P17: kill-reclaim against a foreign owner silently fails, then strictPort: true makes the downstream service hard-fail, and the parent's wait stays alive on remaining children — visually identical to a hang. See references/bash-patterns.md §"Port discovery" and §"Port reclaim with a fallback chain" for both code recipes and the rubric for choosing between them.
If the user wants other devices on the network to test, the script must generate HTTPS via mkcert + a reverse proxy. PKCE in OIDC SPAs uses crypto.subtle, which the browser only exposes in secure contexts; localhost and 127.0.0.1 are exceptions, but the LAN IP is not. Without HTTPS, clicking "Sign in" in the SPA does nothing — silently. See references/tls-https-recipe.md for the canonical mkcert + Caddy + Vite/Express plumbing.
These are the recurring traps in real stacks. Read references/pitfalls.md for the full list with symptoms; the highlights:
.vite.config.lan.ts wrapper with server.allowedHosts: true and run Vite with --config <wrapper> — don't ask the user to edit vite.config.ts.NODE_EXTRA_CA_CERTS=$(mkcert -CAROOT)/rootCA.pem is on the process. Inject it at the script level.externalDomain on first init. Changing IPs requires docker compose down -v. Detect drift via state file; refuse to start with a wrong-domain volume; require an explicit --reset flag.PUT /oidc_config returns 400 COMMAND-1m88i "No changes" when the bootstrap re-runs with identical config. Wrap the bootstrap step in a guard that catches this and treats it as no-op.RATE_LIMIT_PER_MINUTE=0 in dev (and document it)..env on Windows/WSL silently appends \r to every value read with grep|cut — docker exec "$name\r" fails with No such container and the healthcheck times out while every log line looks correct. Read .env values through a tr -d '\r' helper (§P18).node_modules built on another platform (repo carried Windows↔WSL) makes Vite/swc/esbuild crash with Failed to load native binding — the platform-specific optional binary is missing. Re-install inside the target OS; the launcher can warn when @swc/core has no core-* sibling (§P19).yarn resolves to the wrong binary: Corepack isn't enabled by default (so there's no yarn on PATH), and apt install yarn installs Debian's cmdtest impostor (Parsing scenario file …). Resolve the package manager Corepack-aware and validate it's genuine; corepack enable shadows the impostor (§P20).$PSStyle.OutputRendering = 'Ansi' on PS 7.x or Enable-VTMode shim on 5.1. The PowerShell template handles this in its preamble.| Read it when you need… | Reference |
|---|---|
| When detecting the stack: the exact things to grep/read in the project | references/stack-detection.md |
| When writing bash: idioms for healthchecks, port kill, trap, color logs | references/bash-patterns.md |
When writing dev.ps1: PowerShell equivalents (idiomatic, not literal ports) | references/powershell-patterns.md |
| When the stack needs LAN HTTPS: the full mkcert + Caddy + Vite + backend wiring | references/tls-https-recipe.md |
| When designing re-runs: state file format, drift detection, re-run discipline | references/idempotency-and-state.md |
| When encoding or debugging a trap: the recurring traps in real stacks, with symptoms | references/pitfalls.md |
assets/assets/dev.sh.tmpl — bash template with <<PLACEHOLDER>> markers + section comments showing what to keep/cut by stack.assets/dev.ps1.tmpl — PowerShell counterpart with idiomatic equivalents.assets/Caddyfile.tmpl — minimal reverse-proxy with TLS termination, three-port pattern (web/api/idp).Substitute placeholders by detection results from Phase 1; cut entire <<#IF …>> … <<#END>> blocks for absent components. The templates are starting points, not final output — read them, adapt them, omit what doesn't apply.
dev.sh is for human-driven local dev. CI uses the same compose files but with different invocation.cloudflared separately.After generating the script, ask the user to run it once in their environment and report any rough edges. The first real run is where stack-detection misses surface (a port already in use, an env var the user has locally that the script overwrites, a bootstrap script that needs a flag the skill didn't infer). Iterate based on that feedback before declaring done.
assets/Caddyfile.tmpl (opens in a new tab)assets/dev.ps1.tmpl (opens in a new tab)assets/dev.sh.tmpl (opens in a new tab)references/bash-patterns.md (opens in a new tab)references/idempotency-and-state.md (opens in a new tab)references/pitfalls.md (opens in a new tab)references/powershell-patterns.md (opens in a new tab)references/stack-detection.md (opens in a new tab)references/tls-https-recipe.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub j0ruge/skills --plugin dev-scriptOther plugins' skills for the same job