Dev Doctor
When to activate
Activate when a user reports that "the app won't start", "the database isn't connecting", or when experiencing generic ECONNREFUSED or startup errors. Invoked via /dev-doctor.
When NOT to use
Do not use for debugging specific syntax errors, failing unit tests, or logic bugs inside application code. This is strictly for environment and infrastructure health checks.
Instructions
- Pause whatever coding task you are currently on. You are now acting as a SysAdmin diagnosing a local developer environment.
- Systematically check the following common failure points using shell commands:
- Environment Variables: Check if
.env.exampleor.env.templateexists. If it does, compare its keys against the actual.envfile. Report any missing keys. - Ports in Use: Look at the project's configuration (e.g.,
docker-compose.yml,package.jsonscripts) to find expected ports (e.g., 3000, 5432, 6379, 8080). Uselsof -i :<port>ornetstat -tuln | grep <port>to check if those ports are already occupied by zombie processes. - Docker Daemon: If the project uses Docker, run
docker infoto verify the Docker daemon is actually running. - Dependency Drift:
- Node: Check if
node_modulesexists. Runnpm lsoryarn checkto see if dependencies need installing. - Python: Check if the virtual environment is activated and
pip freezematchesrequirements.txt.
- Node: Check if
- Environment Variables: Check if
- Provide a clear, color-coded (using emojis) diagnostic report:
- 🟢 Healthy
- 🔴 Failing
- 🟡 Warning
- For any 🔴 Failing items, propose a direct fix (e.g., "Run
kill -9 1234to free port 3000" or "Copy.env.exampleto.envand fill inDATABASE_URL"). Ask for permission before running the fix.
Example
User: /dev-doctor
Claude: Running environment diagnostics...
- 🔴 .env File: Missing! Found
.env.examplebut no.env. - 🔴 Ports: Port 5432 is already in use by PID 8891 (looks like an older local postgres instance, not the docker container).
- 🟢 Docker: Daemon is running.
- 🟢 Dependencies:
node_modulesis present and up to date.
Suggested Fixes:
- I can copy
.env.exampleto.env. - I can kill PID 8891 to free up port 5432. Shall I proceed with these fixes?