Local Dev Setup Skill

Write a local development environment setup guide for a service or project — covering prerequisites, repository setup, environment variables, local service dependencies, database seeding, running the service, running tests, common gotchas, IDE recommendations, and first-contribution checklist.

Local Dev Setup Skill — The Skill Playground: pick the Executive Update skill, fill in a few notes, hit run, and watch a structured executive… (from the mohitagw15856/pm-claude-skills README)

From the mohitagw15856/pm-claude-skills README — shows the whole collection, not only this skill. · view on GitHub

How to use it

Claude Code
  1. Run the line below. It pulls the whole folder into ~/.claude/skills/local-dev-setup, including the files SKILL.md points to.
  2. Describe your job in plain words. Claude Code follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit mohitagw15856/pm-claude-skills/skills/local-dev-setup#main ~/.claude/skills/local-dev-setup

For one project only, change the path to .claude/skills/local-dev-setup. This skill also uses CONTRIBUTING.md, Node.js, kafka-topics.sh, requirements-dev.txt, app.py, docker-compose.yml — copying SKILL.md alone won't be enough. See the folder on GitHub.

Claude (web or desktop app)
  1. On this page open ⋯ → Download .md.
  2. Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
  3. Pick the file and Save. Claude shows the name and description and runs a security scan.
  4. Check the skill is switched on.
  5. Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
  1. ChatGPT: make a Project and paste it into Instructions.
  2. Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Source of Local Dev Setup Skill

Show the full text493 lines
namedescription
local-dev-setupWrite a local development environment setup guide for a service or project — covering prerequisites, repository setup, environment variables, local service dependencies, database seeding, running the service, running tests, common gotchas, IDE recommendations, and first-contribution checklist. Use when asked to write a dev setup guide, create onboarding documentation for engineers, document local environment setup, or write a getting-started guide for a codebase. Produces a complete setup guide that a new engineer can follow from zero to running tests in under 30 minutes, with a troubleshooting section for the most common setup failures.

Local Dev Setup Skill

Produce a complete local development environment setup guide for a service or project — walking a new engineer from zero (a clean laptop) to a working local environment with passing tests in under 30 minutes. A good setup guide reduces onboarding time, prevents the "it works on my machine" problem, and lets engineers make their first contribution with confidence. Write every step as a concrete command or action — not a description of what needs to happen.

Required Inputs

Ask for these if not already provided:

  • Service name and what it does
  • Tech stack — language, framework, database, cache, message queue, and any external services
  • Dependencies — databases, caches, message queues, and external services (mocked or real)
  • Test framework — how tests are run and what the test suite covers
  • CI/CD platform — GitHub Actions, CircleCI, Jenkins, etc. (for context on what "passing CI" means locally)

Output Format


Local Development Setup: [Service Name]

Tech stack: [Language + version] | [Framework] | [Database] | [Cache] Estimated setup time: [20–30 minutes] on a clean machine Last verified: [Date] on [macOS Ventura 13.x / Ubuntu 22.04] Questions? Ask in [Slack: #[team-channel]] or ping [@tech-lead-handle]

First contribution? Complete setup first (this doc), then read [CONTRIBUTING.md] for code standards and PR process.


Prerequisites

Install these tools before starting. The versions listed are the minimum required — newer patch versions are fine, newer major versions may have compatibility issues.

Required Tools
Tool Required version Install
[Git] 2.x+ Pre-installed on most systems; or brew install git
[Language runtime — e.g. Go] [1.22+] [https://go.dev/dl/ or brew install go]
[Docker] 24.x+ [https://docs.docker.com/get-docker/]
[Docker Compose] 2.x+ Included with Docker Desktop; or brew install docker-compose
[Make] Any Pre-installed on macOS/Linux
[Tool — e.g. Node.js] [20.x+] [brew install node or https://nodejs.org]
[Tool — e.g. psql client] [15+] brew install postgresql@15 (client only)
Tool Purpose Install
[direnv] Auto-load .envrc environment variables brew install direnv + setup instructions
[jq] Pretty-print JSON in terminal brew install jq
[k9s] Kubernetes cluster UI (if using K8s locally) brew install k9s
[mkcert] Local HTTPS certificates brew install mkcert
Required Accounts and Access

Before starting, make sure you have:

  • GitHub access to [org/repo] — request via [access request process / Slack: #it-help]
  • [AWS / GCP / Azure] account with [dev environment] access — request via [process]
  • [Internal tool — e.g. 1Password] for retrieving development secrets — request via [process]
  • [VPN access] if required to reach internal services — request via [process]

1. Repository Setup

# Clone the repository
git clone [email protected]:[org]/[repo-name].git
cd [repo-name]

# Install git hooks (required — enforces commit message format and runs pre-commit checks)
make install-hooks
# Or manually:
# cp scripts/hooks/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit

# Verify your git setup
git config user.name   # should be your name
git config user.email  # should be your work email

If you see a permission denied error on clone: Your SSH key is not added to GitHub. Follow GitHub's SSH key guide or use HTTPS with a personal access token instead.


2. Environment Variables

The service requires environment variables for configuration. Never commit actual secrets to the repository.

Step 1 — Copy the example file
cp .env.example .env.local
Step 2 — Fill in the values

Open .env.local in your editor. Below is a description of every variable and where to get its value:

Variable Description Where to get it Example (not real)
APP_ENV Environment name Set to development development
APP_PORT Port the service listens on Set to 8080 for local 8080
DATABASE_URL PostgreSQL connection string Use value from Docker Compose (Section 3) postgres://app:password@localhost:5432/[service]_dev
REDIS_URL Redis connection string Use value from Docker Compose redis://localhost:6379
SECRET_KEY Application secret key Generate with: openssl rand -hex 32 [random 64-char hex]
[EXTERNAL_SERVICE]_API_KEY API key for [External Service] Retrieve from [1Password vault: "Dev API Keys"] or ask [name] —
[EXTERNAL_SERVICE]_BASE_URL Base URL for [External Service] Use sandbox URL: https://sandbox.[external-service].com https://sandbox.stripe.com
LOG_LEVEL Logging verbosity Set to debug for local development debug
[FEATURE_FLAG_SDK_KEY] Feature flag platform SDK key Retrieve from [LaunchDarkly/Split dev project] —

Using direnv (recommended): Rename .env.local to .envrc, add dotenv at the top, and run direnv allow. Variables will load automatically when you cd into the project.


3. Local Service Dependencies

All infrastructure dependencies run in Docker Compose. You do not need to install PostgreSQL, Redis, or Kafka locally.

# Start all dependencies (PostgreSQL, Redis, and any other services)
docker compose up -d

# Verify all containers are healthy
docker compose ps
# Expected output: all services show "healthy" status

# View logs if something is not healthy
docker compose logs [service-name]
What Docker Compose Starts
Service Port Purpose Health check
PostgreSQL [version] 5432 Primary database pg_isready -U app
Redis [version] 6379 Cache and session store redis-cli ping
[Kafka + Zookeeper] 9092 / 2181 Message queue kafka-topics.sh --list
[Mock server — e.g. WireMock] 8089 Mocks for external APIs in tests curl localhost:8089/__admin
[LocalStack] 4566 AWS service emulation (S3, SQS, etc.) aws --endpoint-url=http://localhost:4566 s3 ls

If a container exits immediately: See Troubleshooting section — common causes are port conflicts and Docker memory limits.

Stopping Dependencies
# Stop containers (preserves data volumes)
docker compose stop

# Stop and remove containers (clears data — use when you want a fresh start)
docker compose down -v

4. Install Dependencies and Build

# Install language dependencies
# Go:
go mod download

# Node.js:
npm install   # or: yarn install / pnpm install

# Python:
python -m venv .venv
source .venv/bin/activate   # On Windows: .venv\Scripts\activate
pip install -r requirements-dev.txt

# Verify build compiles cleanly
make build
# Expected: no errors; binary or compiled output in [./bin/ or ./dist/]

5. Database Setup and Seeding

# Run database migrations (creates tables and schema)
make db-migrate
# Or directly:
# [Migration command — e.g. "go run ./cmd/migrate up" or "alembic upgrade head" or "npm run db:migrate"]

# Verify migrations applied
# psql $DATABASE_URL -c "\dt"  # should list all tables

# Seed the database with development data
make db-seed
# Or directly:
# [Seed command — e.g. "go run ./cmd/seed" or "python scripts/seed.py" or "npm run db:seed"]

# Verify seed data is present
# psql $DATABASE_URL -c "SELECT COUNT(*) FROM [primary-table]"
# Expected: [N] rows

What the seed creates:

  • [N] test user accounts (credentials in [scripts/seed/README.md or .env.example])
  • [N] sample [resources] for development and testing
  • Admin account: [[email protected]] / password: see .env.example for dev password variable

To reset to a clean state:

docker compose down -v   # wipe database volume
docker compose up -d     # start fresh
make db-migrate
make db-seed

6. Running the Service

# Run the service locally
make run
# Or directly:
# [Run command — e.g. "go run ./cmd/server" or "python app.py" or "npm run dev"]

# Expected output:
# [Example of healthy startup log lines — e.g.:]
# {"level":"info","message":"Database connected","host":"localhost","port":5432}
# {"level":"info","message":"Redis connected","host":"localhost","port":6379}
# {"level":"info","message":"Server listening","port":8080}
Verify It's Working
# Health check
curl http://localhost:8080/health
# Expected: {"status":"ok","version":"[git-sha]"}

# Test a key endpoint (authenticated)
# First, get a dev token:
curl -X POST http://localhost:8080/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[dev-user-from-seed]@example.com","password":"[dev-password-from-env]"}'
# Copy the token from the response, then:

curl http://localhost:8080/api/v1/[resource] \
  -H "Authorization: Bearer [token-from-above]"
# Expected: 200 with JSON response
Hot Reload (for Development)
# Run with hot reload — service restarts automatically on file changes
make run-dev
# Or:
# [Hot reload command — e.g. "air" for Go / "uvicorn --reload" for Python / "npm run dev" for Node]

7. Running Tests

# Run the full test suite
make test
# Or:
# [Test command — e.g. "go test ./..." or "pytest" or "npm test"]

# Run tests with coverage report
make test-coverage
# Coverage report: [./coverage.html or stdout]

# Run a specific test file or test case
# Go: go test ./pkg/[package]/... -run TestFunctionName
# Python: pytest tests/test_[module].py::TestClass::test_method -v
# Node: npm test -- --testPathPattern=[filename]

# Run only unit tests (fast — no external dependencies)
make test-unit

# Run only integration tests (requires Docker Compose dependencies running)
make test-integration

Expected test results:

  • Unit tests: [N] tests, all pass, [<30] seconds
  • Integration tests: [N] tests, all pass, [<2] minutes
  • Coverage: [≥80]% (enforced in CI — tests fail below this threshold)

Before pushing a PR, always run:

make lint      # code linting — must pass
make test      # full test suite — must pass
make build     # verify compilation — must pass

8. IDE Setup

Install the recommended extensions (VS Code will prompt you automatically):

// .vscode/extensions.json — already in the repository
{
  "recommendations": [
    "[language-extension — e.g. golang.go]",
    "dbaeumer.vscode-eslint",
    "esbenp.prettier-vscode",
    "ms-azuretools.vscode-docker",
    "eamodio.gitlens"
  ]
}

Workspace settings are in .vscode/settings.json — format on save is enabled, linter is configured automatically.

[Language]-specific setup:

[e.g. Go: The gopls language server is installed automatically by the Go extension.
 Run "Go: Install/Update Tools" from the command palette after installing the extension.]
JetBrains (IntelliJ / GoLand / PyCharm / WebStorm)
  • Open the project root as the project directory
  • [Language SDK]: set to [version] — File → Project Structure → SDKs
  • Run configurations are checked into .idea/runConfigurations/ — they appear automatically
  • Enable "Run formatters on save" in Settings → Tools → Actions on Save

9. Common Gotchas and Troubleshooting

Docker container exits immediately on startup

Symptom: docker compose ps shows a container as Exited (1) seconds after starting.

# Check the container logs for the error
docker compose logs [container-name]

# Common causes:
# 1. Port already in use — find and kill the conflicting process:
lsof -ti tcp:[port] | xargs kill -9

# 2. Docker doesn't have enough memory — allocate at least 4GB in Docker Desktop:
# Docker Desktop → Settings → Resources → Memory → 4GB

# 3. M1/M2 Mac architecture mismatch — add platform directive to docker-compose.yml:
# platform: linux/amd64
Database connection refused

Symptom: Service fails to start with "connection refused" or "dial tcp localhost:5432: connect: connection refused"

# Is PostgreSQL actually running?
docker compose ps postgres
# If not running: docker compose up -d postgres

# Is it on the right port?
lsof -i :5432

# Can you connect manually?
psql postgres://app:password@localhost:5432/[service]_dev -c "SELECT 1"

# If using a custom DATABASE_URL, verify it matches the docker-compose.yml settings exactly
Migrations fail with "relation already exists"

Symptom: make db-migrate errors with "ERROR: relation [table] already exists"

# Check current migration state
[migration status command — e.g. "go run ./cmd/migrate status" or "alembic current"]

# The database may be in a partial state — reset it:
docker compose down -v
docker compose up -d
make db-migrate  # should now succeed on a clean database
Tests fail with "connection refused" or dependency errors

Symptom: Integration tests fail because they cannot connect to PostgreSQL or Redis.

# Integration tests need Docker Compose running
docker compose up -d

# Verify all containers are healthy before running tests
docker compose ps   # all should show "healthy"

# If containers are running but tests still fail, check environment variables:
make test-integration  # should pick up .env.local automatically
# If not: source .env.local && make test-integration
make lint fails on a fresh checkout

Symptom: Lint errors on files you have not modified.

# Formatting issue — auto-fix with:
# Go:
gofmt -w .
goimports -w .

# Python:
black .
isort .

# Node/TypeScript:
npm run lint:fix
# Or: npx eslint --fix . && npx prettier --write .

# Re-run lint to confirm
make lint
Environment variables not loading

Symptom: Service starts but immediately fails with "missing required environment variable: [VAR]"

# Verify .env.local exists and has all required variables
cat .env.local | grep "^[A-Z]" | awk -F= '{print $1}'

# Compare against required variables in .env.example
diff <(grep "^[A-Z_]*=" .env.example | cut -d= -f1 | sort) \
     <(grep "^[A-Z_]*=" .env.local | cut -d= -f1 | sort)

# Missing variables are shown in left column only (< prefix)

10. First Contribution Checklist

Before opening your first pull request, verify:

Setup complete:

  • make build passes with no errors
  • make test passes — all tests green
  • make lint passes — no lint errors
  • Service starts and health check returns 200
  • You can authenticate and call at least one API endpoint

Git and GitHub:

  • You have read [CONTRIBUTING.md] — code standards, commit message format, PR process
  • Your git user.name and user.email are set correctly
  • Pre-commit hooks are installed (ls .git/hooks/pre-commit should exist)
  • You have branched from main (not committing directly to main)

Development workflow:

  • You know how to run a specific test: [test command for single test]
  • You know how to reset the database: docker compose down -v && docker compose up -d && make db-migrate && make db-seed
  • You have joined [Slack: #[team-channel]] and [#[service-consumers-channel] if applicable]
  • You have read the [architecture overview doc / README] — you understand what this service does

First PR:

  • Changes are small and focused — one logical change per PR
  • Tests are added or updated for your change
  • make test && make lint && make build all pass locally before requesting review
  • PR description explains what changed and why (use the [pr-description-writer skill] if needed)

Quality Checks

  • A new engineer with no prior knowledge of the project can follow this guide from start to finish without asking anyone for help
  • Every command is tested on a clean environment — not written from memory and assumed to work
  • Environment variables table covers every variable in .env.example — no undocumented variables
  • The troubleshooting section covers the 5 most common real failures observed during onboarding — not theoretical issues
  • Docker Compose version and Docker Desktop memory requirements are stated explicitly
  • "Expected output" is shown for key commands so engineers know whether a step succeeded
  • Setup time estimate is honest — verified by timing a real onboarding session, not estimated

Anti-Patterns

  • Do not write setup steps from memory without testing them on a clean machine — steps that skip implicit knowledge break for new engineers
  • Do not leave environment variables undocumented — every variable in .env.example must appear in the Variables table with a description and source
  • Do not write troubleshooting entries for theoretical issues — only include problems that have actually occurred during real onboarding sessions
  • Do not assume Docker Desktop is configured correctly — memory limits and platform (M1/M2) compatibility must be explicitly called out
  • Do not omit expected output for key commands — without "expected output", engineers cannot tell whether a step succeeded or silently failed
1---
2name: local-dev-setup
3description: "Write a local development environment setup guide for a service or project — covering prerequisites, repository setup, environment variables, local service dependencies, database seeding, running the service, running tests, common gotchas, IDE recommendations, and first-contribution checklist. Use when asked to write a dev setup guide, create onboarding documentation for engineers, document local environment setup, or write a getting-started guide for a codebase. Produces a complete setup guide that a new engineer can follow from zero to running tests in under 30 minutes, with a troubleshooting section for the most common setup failures."
4---
5 
6# Local Dev Setup Skill
7 
8Produce a complete local development environment setup guide for a service or project — walking a new engineer from zero (a clean laptop) to a working local environment with passing tests in under 30 minutes. A good setup guide reduces onboarding time, prevents the "it works on my machine" problem, and lets engineers make their first contribution with confidence. Write every step as a concrete command or action — not a description of what needs to happen.
9 
10## Required Inputs
11 
12Ask for these if not already provided:
13- **Service name** and what it does
14- **Tech stack** — language, framework, database, cache, message queue, and any external services
15- **Dependencies** — databases, caches, message queues, and external services (mocked or real)
16- **Test framework** — how tests are run and what the test suite covers
17- **CI/CD platform** — GitHub Actions, CircleCI, Jenkins, etc. (for context on what "passing CI" means locally)
18 
19## Output Format
20 
21---
22 
23# Local Development Setup: [Service Name]
24 
25**Tech stack:** [Language + version] | [Framework] | [Database] | [Cache]
26**Estimated setup time:** [20–30 minutes] on a clean machine
27**Last verified:** [Date] on [macOS Ventura 13.x / Ubuntu 22.04]
28**Questions?** Ask in [Slack: #[team-channel]] or ping [@tech-lead-handle]
29 
30> **First contribution?** Complete setup first (this doc), then read [CONTRIBUTING.md] for code standards and PR process.
31 
32---
33 
34## Prerequisites
35 
36Install these tools before starting. The versions listed are the minimum required — newer patch versions are fine, newer major versions may have compatibility issues.
37 
38### Required Tools
39 
40| Tool | Required version | Install |
41|---|---|---|
42| [Git] | 2.x+ | Pre-installed on most systems; or `brew install git` |
43| [Language runtime — e.g. Go] | [1.22+] | [https://go.dev/dl/ or `brew install go`] |
44| [Docker] | 24.x+ | [https://docs.docker.com/get-docker/] |
45| [Docker Compose] | 2.x+ | Included with Docker Desktop; or `brew install docker-compose` |
46| [Make] | Any | Pre-installed on macOS/Linux |
47| [Tool — e.g. Node.js] | [20.x+] | [`brew install node` or https://nodejs.org] |
48| [Tool — e.g. psql client] | [15+] | `brew install postgresql@15` (client only) |
49 
50### Optional but Recommended
51 
52| Tool | Purpose | Install |
53|---|---|---|
54| [direnv] | Auto-load `.envrc` environment variables | `brew install direnv` + [setup instructions](https://direnv.net) |
55| [jq] | Pretty-print JSON in terminal | `brew install jq` |
56| [k9s] | Kubernetes cluster UI (if using K8s locally) | `brew install k9s` |
57| [mkcert] | Local HTTPS certificates | `brew install mkcert` |
58 
59### Required Accounts and Access
60 
61Before starting, make sure you have:
62- [ ] GitHub access to [org/repo] — request via [access request process / Slack: #it-help]
63- [ ] [AWS / GCP / Azure] account with [dev environment] access — request via [process]
64- [ ] [Internal tool — e.g. 1Password] for retrieving development secrets — request via [process]
65- [ ] [VPN access] if required to reach internal services — request via [process]
66 
67---
68 
69## 1. Repository Setup
70 
71```bash
72# Clone the repository
73git clone [email protected]:[org]/[repo-name].git
74cd [repo-name]
75 
76# Install git hooks (required — enforces commit message format and runs pre-commit checks)
77make install-hooks
78# Or manually:
79# cp scripts/hooks/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
80 
81# Verify your git setup
82git config user.name # should be your name
83git config user.email # should be your work email
84```
85 
86**If you see a permission denied error on clone:** Your SSH key is not added to GitHub. Follow [GitHub's SSH key guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) or use HTTPS with a personal access token instead.
87 
88---
89 
90## 2. Environment Variables
91 
92The service requires environment variables for configuration. **Never commit actual secrets to the repository.**
93 
94### Step 1 — Copy the example file
95 
96```bash
97cp .env.example .env.local
98```
99 
100### Step 2 — Fill in the values
101 
102Open `.env.local` in your editor. Below is a description of every variable and where to get its value:
103 
104| Variable | Description | Where to get it | Example (not real) |
105|---|---|---|---|
106| `APP_ENV` | Environment name | Set to `development` | `development` |
107| `APP_PORT` | Port the service listens on | Set to `8080` for local | `8080` |
108| `DATABASE_URL` | PostgreSQL connection string | Use value from Docker Compose (Section 3) | `postgres://app:password@localhost:5432/[service]_dev` |
109| `REDIS_URL` | Redis connection string | Use value from Docker Compose | `redis://localhost:6379` |
110| `SECRET_KEY` | Application secret key | Generate with: `openssl rand -hex 32` | `[random 64-char hex]` |
111| `[EXTERNAL_SERVICE]_API_KEY` | API key for [External Service] | Retrieve from [1Password vault: "Dev API Keys"] or ask [name] | — |
112| `[EXTERNAL_SERVICE]_BASE_URL` | Base URL for [External Service] | Use sandbox URL: `https://sandbox.[external-service].com` | `https://sandbox.stripe.com` |
113| `LOG_LEVEL` | Logging verbosity | Set to `debug` for local development | `debug` |
114| `[FEATURE_FLAG_SDK_KEY]` | Feature flag platform SDK key | Retrieve from [LaunchDarkly/Split dev project] | — |
115 
116**Using direnv (recommended):** Rename `.env.local` to `.envrc`, add `dotenv` at the top, and run `direnv allow`. Variables will load automatically when you `cd` into the project.
117 
118---
119 
120## 3. Local Service Dependencies
121 
122All infrastructure dependencies run in Docker Compose. You do not need to install PostgreSQL, Redis, or Kafka locally.
123 
124```bash
125# Start all dependencies (PostgreSQL, Redis, and any other services)
126docker compose up -d
127 
128# Verify all containers are healthy
129docker compose ps
130# Expected output: all services show "healthy" status
131 
132# View logs if something is not healthy
133docker compose logs [service-name]
134```
135 
136### What Docker Compose Starts
137 
138| Service | Port | Purpose | Health check |
139|---|---|---|---|
140| PostgreSQL [version] | `5432` | Primary database | `pg_isready -U app` |
141| Redis [version] | `6379` | Cache and session store | `redis-cli ping` |
142| [Kafka + Zookeeper] | `9092` / `2181` | Message queue | `kafka-topics.sh --list` |
143| [Mock server — e.g. WireMock] | `8089` | Mocks for external APIs in tests | `curl localhost:8089/__admin` |
144| [LocalStack] | `4566` | AWS service emulation (S3, SQS, etc.) | `aws --endpoint-url=http://localhost:4566 s3 ls` |
145 
146**If a container exits immediately:** See Troubleshooting section — common causes are port conflicts and Docker memory limits.
147 
148### Stopping Dependencies
149 
150```bash
151# Stop containers (preserves data volumes)
152docker compose stop
153 
154# Stop and remove containers (clears data — use when you want a fresh start)
155docker compose down -v
156```
157 
158---
159 
160## 4. Install Dependencies and Build
161 
162```bash
163# Install language dependencies
164# Go:
165go mod download
166 
167# Node.js:
168npm install # or: yarn install / pnpm install
169 
170# Python:
171python -m venv .venv
172source .venv/bin/activate # On Windows: .venv\Scripts\activate
173pip install -r requirements-dev.txt
174 
175# Verify build compiles cleanly
176make build
177# Expected: no errors; binary or compiled output in [./bin/ or ./dist/]
178```
179 
180---
181 
182## 5. Database Setup and Seeding
183 
184```bash
185# Run database migrations (creates tables and schema)
186make db-migrate
187# Or directly:
188# [Migration command — e.g. "go run ./cmd/migrate up" or "alembic upgrade head" or "npm run db:migrate"]
189 
190# Verify migrations applied
191# psql $DATABASE_URL -c "\dt" # should list all tables
192 
193# Seed the database with development data
194make db-seed
195# Or directly:
196# [Seed command — e.g. "go run ./cmd/seed" or "python scripts/seed.py" or "npm run db:seed"]
197 
198# Verify seed data is present
199# psql $DATABASE_URL -c "SELECT COUNT(*) FROM [primary-table]"
200# Expected: [N] rows
201```
202 
203**What the seed creates:**
204- [N] test user accounts (credentials in [scripts/seed/README.md or .env.example])
205- [N] sample [resources] for development and testing
206- Admin account: `[[email protected]]` / password: see `.env.example` for dev password variable
207 
208**To reset to a clean state:**
209```bash
210docker compose down -v # wipe database volume
211docker compose up -d # start fresh
212make db-migrate
213make db-seed
214```
215 
216---
217 
218## 6. Running the Service
219 
220```bash
221# Run the service locally
222make run
223# Or directly:
224# [Run command — e.g. "go run ./cmd/server" or "python app.py" or "npm run dev"]
225 
226# Expected output:
227# [Example of healthy startup log lines — e.g.:]
228# {"level":"info","message":"Database connected","host":"localhost","port":5432}
229# {"level":"info","message":"Redis connected","host":"localhost","port":6379}
230# {"level":"info","message":"Server listening","port":8080}
231```
232 
233### Verify It's Working
234 
235```bash
236# Health check
237curl http://localhost:8080/health
238# Expected: {"status":"ok","version":"[git-sha]"}
239 
240# Test a key endpoint (authenticated)
241# First, get a dev token:
242curl -X POST http://localhost:8080/api/v1/auth/login \
243 -H "Content-Type: application/json" \
244 -d '{"email":"[dev-user-from-seed]@example.com","password":"[dev-password-from-env]"}'
245# Copy the token from the response, then:
246 
247curl http://localhost:8080/api/v1/[resource] \
248 -H "Authorization: Bearer [token-from-above]"
249# Expected: 200 with JSON response
250```
251 
252### Hot Reload (for Development)
253 
254```bash
255# Run with hot reload — service restarts automatically on file changes
256make run-dev
257# Or:
258# [Hot reload command — e.g. "air" for Go / "uvicorn --reload" for Python / "npm run dev" for Node]
259```
260 
261---
262 
263## 7. Running Tests
264 
265```bash
266# Run the full test suite
267make test
268# Or:
269# [Test command — e.g. "go test ./..." or "pytest" or "npm test"]
270 
271# Run tests with coverage report
272make test-coverage
273# Coverage report: [./coverage.html or stdout]
274 
275# Run a specific test file or test case
276# Go: go test ./pkg/[package]/... -run TestFunctionName
277# Python: pytest tests/test_[module].py::TestClass::test_method -v
278# Node: npm test -- --testPathPattern=[filename]
279 
280# Run only unit tests (fast — no external dependencies)
281make test-unit
282 
283# Run only integration tests (requires Docker Compose dependencies running)
284make test-integration
285```
286 
287**Expected test results:**
288- Unit tests: [N] tests, all pass, [<30] seconds
289- Integration tests: [N] tests, all pass, [<2] minutes
290- Coverage: [≥80]% (enforced in CI — tests fail below this threshold)
291 
292**Before pushing a PR, always run:**
293```bash
294make lint # code linting — must pass
295make test # full test suite — must pass
296make build # verify compilation — must pass
297```
298 
299---
300 
301## 8. IDE Setup
302 
303### VS Code (Recommended)
304 
305Install the recommended extensions (VS Code will prompt you automatically):
306 
307```json
308// .vscode/extensions.json — already in the repository
309{
310 "recommendations": [
311 "[language-extension — e.g. golang.go]",
312 "dbaeumer.vscode-eslint",
313 "esbenp.prettier-vscode",
314 "ms-azuretools.vscode-docker",
315 "eamodio.gitlens"
316 ]
317}
318```
319 
320Workspace settings are in `.vscode/settings.json` — format on save is enabled, linter is configured automatically.
321 
322**[Language]-specific setup:**
323```
324[e.g. Go: The gopls language server is installed automatically by the Go extension.
325 Run "Go: Install/Update Tools" from the command palette after installing the extension.]
326```
327 
328### JetBrains (IntelliJ / GoLand / PyCharm / WebStorm)
329 
330- Open the project root as the project directory
331- [Language SDK]: set to [version] — File → Project Structure → SDKs
332- Run configurations are checked into `.idea/runConfigurations/` — they appear automatically
333- Enable "Run formatters on save" in Settings → Tools → Actions on Save
334 
335---
336 
337## 9. Common Gotchas and Troubleshooting
338 
339### Docker container exits immediately on startup
340 
341**Symptom:** `docker compose ps` shows a container as `Exited (1)` seconds after starting.
342 
343```bash
344# Check the container logs for the error
345docker compose logs [container-name]
346 
347# Common causes:
348# 1. Port already in use — find and kill the conflicting process:
349lsof -ti tcp:[port] | xargs kill -9
350 
351# 2. Docker doesn't have enough memory — allocate at least 4GB in Docker Desktop:
352# Docker Desktop → Settings → Resources → Memory → 4GB
353 
354# 3. M1/M2 Mac architecture mismatch — add platform directive to docker-compose.yml:
355# platform: linux/amd64
356```
357 
358### Database connection refused
359 
360**Symptom:** Service fails to start with "connection refused" or "dial tcp localhost:5432: connect: connection refused"
361 
362```bash
363# Is PostgreSQL actually running?
364docker compose ps postgres
365# If not running: docker compose up -d postgres
366 
367# Is it on the right port?
368lsof -i :5432
369 
370# Can you connect manually?
371psql postgres://app:password@localhost:5432/[service]_dev -c "SELECT 1"
372 
373# If using a custom DATABASE_URL, verify it matches the docker-compose.yml settings exactly
374```
375 
376### Migrations fail with "relation already exists"
377 
378**Symptom:** `make db-migrate` errors with "ERROR: relation [table] already exists"
379 
380```bash
381# Check current migration state
382[migration status command — e.g. "go run ./cmd/migrate status" or "alembic current"]
383 
384# The database may be in a partial state — reset it:
385docker compose down -v
386docker compose up -d
387make db-migrate # should now succeed on a clean database
388```
389 
390### Tests fail with "connection refused" or dependency errors
391 
392**Symptom:** Integration tests fail because they cannot connect to PostgreSQL or Redis.
393 
394```bash
395# Integration tests need Docker Compose running
396docker compose up -d
397 
398# Verify all containers are healthy before running tests
399docker compose ps # all should show "healthy"
400 
401# If containers are running but tests still fail, check environment variables:
402make test-integration # should pick up .env.local automatically
403# If not: source .env.local && make test-integration
404```
405 
406### `make lint` fails on a fresh checkout
407 
408**Symptom:** Lint errors on files you have not modified.
409 
410```bash
411# Formatting issue — auto-fix with:
412# Go:
413gofmt -w .
414goimports -w .
415 
416# Python:
417black .
418isort .
419 
420# Node/TypeScript:
421npm run lint:fix
422# Or: npx eslint --fix . && npx prettier --write .
423 
424# Re-run lint to confirm
425make lint
426```
427 
428### Environment variables not loading
429 
430**Symptom:** Service starts but immediately fails with "missing required environment variable: [VAR]"
431 
432```bash
433# Verify .env.local exists and has all required variables
434cat .env.local | grep "^[A-Z]" | awk -F= '{print $1}'
435 
436# Compare against required variables in .env.example
437diff <(grep "^[A-Z_]*=" .env.example | cut -d= -f1 | sort) \
438 <(grep "^[A-Z_]*=" .env.local | cut -d= -f1 | sort)
439 
440# Missing variables are shown in left column only (< prefix)
441```
442 
443---
444 
445## 10. First Contribution Checklist
446 
447Before opening your first pull request, verify:
448 
449**Setup complete:**
450- [ ] `make build` passes with no errors
451- [ ] `make test` passes — all tests green
452- [ ] `make lint` passes — no lint errors
453- [ ] Service starts and health check returns 200
454- [ ] You can authenticate and call at least one API endpoint
455 
456**Git and GitHub:**
457- [ ] You have read [CONTRIBUTING.md] — code standards, commit message format, PR process
458- [ ] Your git user.name and user.email are set correctly
459- [ ] Pre-commit hooks are installed (`ls .git/hooks/pre-commit` should exist)
460- [ ] You have branched from `main` (not committing directly to main)
461 
462**Development workflow:**
463- [ ] You know how to run a specific test: `[test command for single test]`
464- [ ] You know how to reset the database: `docker compose down -v && docker compose up -d && make db-migrate && make db-seed`
465- [ ] You have joined [Slack: #[team-channel]] and [#[service-consumers-channel] if applicable]
466- [ ] You have read the [architecture overview doc / README] — you understand what this service does
467 
468**First PR:**
469- [ ] Changes are small and focused — one logical change per PR
470- [ ] Tests are added or updated for your change
471- [ ] `make test && make lint && make build` all pass locally before requesting review
472- [ ] PR description explains what changed and why (use the [pr-description-writer skill] if needed)
473 
474---
475 
476## Quality Checks
477 
478- [ ] A new engineer with no prior knowledge of the project can follow this guide from start to finish without asking anyone for help
479- [ ] Every command is tested on a clean environment — not written from memory and assumed to work
480- [ ] Environment variables table covers every variable in `.env.example` — no undocumented variables
481- [ ] The troubleshooting section covers the 5 most common real failures observed during onboarding — not theoretical issues
482- [ ] Docker Compose version and Docker Desktop memory requirements are stated explicitly
483- [ ] "Expected output" is shown for key commands so engineers know whether a step succeeded
484- [ ] Setup time estimate is honest — verified by timing a real onboarding session, not estimated
485 
486## Anti-Patterns
487 
488- [ ] Do not write setup steps from memory without testing them on a clean machine — steps that skip implicit knowledge break for new engineers
489- [ ] Do not leave environment variables undocumented — every variable in .env.example must appear in the Variables table with a description and source
490- [ ] Do not write troubleshooting entries for theoretical issues — only include problems that have actually occurred during real onboarding sessions
491- [ ] Do not assume Docker Desktop is configured correctly — memory limits and platform (M1/M2) compatibility must be explicitly called out
492- [ ] Do not omit expected output for key commands — without "expected output", engineers cannot tell whether a step succeeded or silently failed
493 

Discussion