Prompt
how to make local dev environment setup consistent
Latest observation
To make a local dev environment setup consistent across a team, the goal is to remove “works on my machine” variables and make setup repeatable, versioned, and automated.
Core practices
1. Use a single source of truth
Document and automate:
- required OS/tools
- exact language/runtime versions
- environment variables
- services needed locally
- setup commands
Best place: a README, but better is to also encode it in files the machine can execute.
2. Pin all versions
Avoid “latest”.
Examples:
- Node:
.nvmrcor.tool-versions - Python:
pyproject.toml+ lockfile, orrequirements.txtwith pinned versions - Ruby:
.ruby-version - Docker images: use explicit tags, not
latest - Package managers: lockfiles (
package-lock.json,pnpm-lock.yaml,poetry.lock, etc.)
3. Automate setup
Have a one-command bootstrap:
./scripts/setup.sh
# or
make setup
This should ideally:
- install dependencies
- copy
.env.exampleto.env - start local services
- run migrations/seed data
- verify prerequisites
4. Containerize dependencies
Use Docker / Docker Compose for things like:
- database
- Redis
- message queues
- search engines
This avoids inconsistent local installs.
Example:
- app runs locally
- infra runs in containers
Or even better:
- entire dev environment runs in containers
5. Standardize environment variables
Use:
.env.examplecommitted to repo.envignored by git- clear docs for each variable
Avoid undocumented secrets or machine-specific config.
6. Use a dev container or equivalent
If possible, use:
- Dev Containers (VS Code / Codespaces)
- Docker-based development
- Nix / direnv / asdf for consistent toolchains
This makes onboarding much smoother.
7. Make tasks repeatable
Use a task runner:
Makefilejustnpm scriptsrakeinvoke
Examples:
make install
make test
make lint
make dev
8. Keep setup idempotent
Running setup twice should not break anything.
Good setup scripts:
- check before installing
- safely overwrite only intended files
- can be rerun after partial failure
9. Validate the environment
Add checks like:
make doctor
This can verify:
- correct runtime version
- Docker running
- env vars present
- required ports free
10. Reduce manual steps
Manual steps lead to drift. Prefer:
- scripts over instructions
- templates over “copy this from Slack”
- checked-in config over personal setup
A good pattern
A solid setup often looks like this:
repo/
.tool-versions
.env.example
docker-compose.yml
Makefile
scripts/
setup.sh
doctor.sh
README.md
Example onboarding flow
- Clone repo
- Run
make setup - Run
make dev - Open app
That’s the target.
If you want maximum consistency
Use one of these:
- Dev Containers
- Nix
- Docker Compose + pinned tool versions
These are the strongest options for avoiding drift.
Quick checklist
- Versions pinned
- Lockfiles committed
-
.env.exampleexists - Setup script automated
- Local services containerized
- One-command startup
-
doctor/health check command - Setup is idempotent
- Docs match reality
If you want, I can also give you:
- a template repo structure,
- a sample
Makefile+ setup script, or - the best setup approach for your stack (Node/Python/Go/etc.).