Env Doctor
Diagnose the local environment before changing application code. Treat the project as innocent until the environment is ruled out.
Workflow
- Detect project type from files:
- Node:
package.json
- Python:
requirements.txt, pyproject.toml, Pipfile, or manage.py
- Go:
go.mod
- Docker:
Dockerfile or docker-compose.yml
- Check runtime availability and versions:
- Node:
node --version and npm --version
- Python:
python --version or python3 --version
- Go:
go version
- Docker:
docker --version and docker compose version
- Check dependencies:
- Node projects with no
node_modules/: flag as high priority and suggest npm install.
- Python projects with no
.venv/, venv/, or active virtual environment: flag and suggest creating one, then installing requirements.
- Go projects: run
go mod tidy only after explaining it mutates go.mod/go.sum; otherwise suggest it as the fix.
- Docker projects: check whether Docker is running before suggesting rebuilds.
- Check common port conflicts for
3000, 3001, 5000, 8000, and 8080.
- Detect the operating system before providing commands.
- On macOS/Linux, inspect listeners with
lsof -nP -iTCP:<port> -sTCP:LISTEN, then identify the PID with ps.
- On Windows PowerShell, inspect listeners with
Get-NetTCPConnection -LocalPort <port>, then identify the owning PID with Get-Process.
- Report the PID, executable or service name, and available ownership evidence before suggesting any stop action.
- Prefer the application's documented stop command,
Ctrl+C in its owning terminal, or a targeted service stop.
- Never assume a listener is stale or belongs to the project. Do not terminate any process without the user's explicit approval.
- Never default to
kill -9, Stop-Process -Force, or a broad process-name kill. Escalation to a force-kill requires a confirmed target, a failed normal stop, and separate explicit approval.
- Validate environment variables:
- Compare
.env.example against .env when both or either exist.
- Flag missing
.env if .env.example exists.
- Flag missing required variables listed in
.env.example.
- Always flag missing
DATABASE_URL when it appears in .env.example but is absent from .env.
- Treat every value after the first
= as a secret, including comments or examples that resemble credentials.
- Parse only key names and whether each value is empty. Never print, quote, store, summarize, or retain values in findings, evidence, logs, or commands.
- Do not use raw-display commands such as
cat .env, Get-Content .env, or unredacted grep output.
- Redact accidental value exposure immediately and refer to variables by key name only.
- Check file permissions:
- Verify the project directory is writable before running installers or build commands.
- For Unix-like scripts referenced by
package.json, Makefile, Docker, or shell commands, check whether executable bits may be required and suggest chmod +x <script>.
- Check background services when the project appears to need them:
- Postgres: referenced by
DATABASE_URL, postgres, pg, psycopg, Prisma, Django, Rails-like config, or docker-compose.yml.
- Redis: referenced by
REDIS_URL, redis, Celery, BullMQ, Sidekiq-like config, or docker-compose.yml.
- MySQL: referenced by
MYSQL_URL, mysql, mysqlclient, pymysql, or docker-compose.yml.
- Prefer non-destructive status checks. Suggest start commands only after identifying the likely service.
Reference Loading
Read references/checks.md when the project type is known, when the user asks for a checklist, or when framework-specific .env validation is needed for Express, Django, Gin, or Flask. Read references/safety-fixtures.md before evaluating or changing the port or .env behavior of this skill.
Output Shape
Return a prioritized checklist, highest impact first:
**Env Doctor Findings**
1. [High] <issue>
Evidence: `<command output or file reference>`
Fix:
<Use a `powershell` code fence on Windows or a `bash` code fence on macOS/Linux. Include only the matching OS command.>
2. [Medium] <issue>
Evidence: `<command output or file reference>`
Fix:
<Use a `powershell` code fence on Windows or a `bash` code fence on macOS/Linux. Include only the matching OS command.>
**Likely Start Command**
`<command>`
**What I Checked**
Node/Python/Go/Docker runtimes, dependencies, ports, .env key presence, permissions, services. No .env values were displayed or retained.
If no issue is found, say that the environment looks healthy and identify the next best application-level debugging step.
Required Quality Cases
- Missing
node_modules/ in a Node project must be reported with npm install.
- Port
3000 in use must be reported with an OS-appropriate inspection command and ownership evidence before any stop action.
- Missing
DATABASE_URL in .env, when required by .env.example, must be reported as a high-priority environment variable issue.
.env findings and evidence must contain key names and empty/present state only, never values.
- An unrelated process that owns a common port must not be stopped or given an unconditional termination command.
- POSIX commands must use a
bash block and Windows commands must use a powershell block.
1---2name: env-doctor-free3description: Diagnose local project environment issues that prevent apps from starting or running. Use when the user says "why won't this run", "check my environment", "env doctor", "diagnose startup issue", "it works on my machine", or asks for help debugging missing dependencies, runtime versions, port conflicts, .env problems, file permissions, or stopped services.4license: MIT5---6# Env Doctor
7
8Diagnose the local environment before changing application code. Treat the project as innocent until the environment is ruled out.
9
10## Workflow
11
121. Detect project type from files:
13 - Node: `package.json`
14 - Python: `requirements.txt`, `pyproject.toml`, `Pipfile`, or `manage.py`
15 - Go: `go.mod`
16 - Docker: `Dockerfile` or `docker-compose.yml`
172. Check runtime availability and versions:
18 - Node: `node --version` and `npm --version`
19 - Python: `python --version` or `python3 --version`
20 - Go: `go version`
21 - Docker: `docker --version` and `docker compose version`
223. Check dependencies:
23 - Node projects with no `node_modules/`: flag as high priority and suggest `npm install`.
24 - Python projects with no `.venv/`, `venv/`, or active virtual environment: flag and suggest creating one, then installing requirements.
25 - Go projects: run `go mod tidy` only after explaining it mutates `go.mod`/`go.sum`; otherwise suggest it as the fix.
26 - Docker projects: check whether Docker is running before suggesting rebuilds.
274. Check common port conflicts for `3000`, `3001`, `5000`, `8000`, and `8080`.
28 - Detect the operating system before providing commands.
29 - On macOS/Linux, inspect listeners with `lsof -nP -iTCP:<port> -sTCP:LISTEN`, then identify the PID with `ps`.
30 - On Windows PowerShell, inspect listeners with `Get-NetTCPConnection -LocalPort <port>`, then identify the owning PID with `Get-Process`.
31 - Report the PID, executable or service name, and available ownership evidence before suggesting any stop action.
32 - Prefer the application's documented stop command, `Ctrl+C` in its owning terminal, or a targeted service stop.
33 - Never assume a listener is stale or belongs to the project. Do not terminate any process without the user's explicit approval.
34 - Never default to `kill -9`, `Stop-Process -Force`, or a broad process-name kill. Escalation to a force-kill requires a confirmed target, a failed normal stop, and separate explicit approval.
355. Validate environment variables:
36 - Compare `.env.example` against `.env` when both or either exist.
37 - Flag missing `.env` if `.env.example` exists.
38 - Flag missing required variables listed in `.env.example`.
39 - Always flag missing `DATABASE_URL` when it appears in `.env.example` but is absent from `.env`.
40 - Treat every value after the first `=` as a secret, including comments or examples that resemble credentials.
41 - Parse only key names and whether each value is empty. Never print, quote, store, summarize, or retain values in findings, evidence, logs, or commands.
42 - Do not use raw-display commands such as `cat .env`, `Get-Content .env`, or unredacted `grep` output.
43 - Redact accidental value exposure immediately and refer to variables by key name only.
446. Check file permissions:
45 - Verify the project directory is writable before running installers or build commands.
46 - For Unix-like scripts referenced by `package.json`, `Makefile`, Docker, or shell commands, check whether executable bits may be required and suggest `chmod +x <script>`.
477. Check background services when the project appears to need them:
48 - Postgres: referenced by `DATABASE_URL`, `postgres`, `pg`, `psycopg`, Prisma, Django, Rails-like config, or `docker-compose.yml`.
49 - Redis: referenced by `REDIS_URL`, `redis`, Celery, BullMQ, Sidekiq-like config, or `docker-compose.yml`.
50 - MySQL: referenced by `MYSQL_URL`, `mysql`, `mysqlclient`, `pymysql`, or `docker-compose.yml`.
51 - Prefer non-destructive status checks. Suggest start commands only after identifying the likely service.
52
53## Reference Loading
54
55Read `references/checks.md` when the project type is known, when the user asks for a checklist, or when framework-specific `.env` validation is needed for Express, Django, Gin, or Flask. Read `references/safety-fixtures.md` before evaluating or changing the port or `.env` behavior of this skill.
56
57## Output Shape
58
59Return a prioritized checklist, highest impact first:
60
61```markdown
62**Env Doctor Findings**
63
641. [High] <issue>
65 Evidence: `<command output or file reference>`
66 Fix:
67 <Use a `powershell` code fence on Windows or a `bash` code fence on macOS/Linux. Include only the matching OS command.>
68
692. [Medium] <issue>
70 Evidence: `<command output or file reference>`
71 Fix:
72 <Use a `powershell` code fence on Windows or a `bash` code fence on macOS/Linux. Include only the matching OS command.>
73
74**Likely Start Command**
75`<command>`
76
77**What I Checked**
78Node/Python/Go/Docker runtimes, dependencies, ports, .env key presence, permissions, services. No .env values were displayed or retained.
79```
80
81If no issue is found, say that the environment looks healthy and identify the next best application-level debugging step.
82
83## Required Quality Cases
84
85- Missing `node_modules/` in a Node project must be reported with `npm install`.
86- Port `3000` in use must be reported with an OS-appropriate inspection command and ownership evidence before any stop action.
87- Missing `DATABASE_URL` in `.env`, when required by `.env.example`, must be reported as a high-priority environment variable issue.
88- `.env` findings and evidence must contain key names and empty/present state only, never values.
89- An unrelated process that owns a common port must not be stopped or given an unconditional termination command.
90- POSIX commands must use a `bash` block and Windows commands must use a `powershell` block.