detecting-port-conflicts — Claude Code skill: setup and usage
Detects EADDRINUSE and port conflicts in terminal output, identifies blocking processes with lsof, and kills them or picks an open port for your dev server.
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a claude-codeWhat detecting-port-conflicts does
The skill scans terminal logs for errors like EADDRINUSE, address already in use, or OSError: [Errno 98]. It grabs the blocked port number right away. Conflicting dev servers happen constantly. To diagnose the blocker, it runs lsof -i :<PORT> -P -n and identifies the PID and process name behind it.
Once diagnosed, the skill provides clean recovery paths. It can terminate the offending process with kill <PID> or kill -9 <PID>. Alternatively, it checks if the next port is free and adapts start commands for Vite or Next.js. When lsof returns empty, the port is likely stuck in TIME_WAIT state — waiting 30 seconds usually clears it.
The nuclear killall node command wipes out all running instances, so the skill only runs it after explicit user confirmation. Keep in mind that macOS requires root permissions for ports below 1024.
What it helps with
- resolve dev server startup failures caused by
EADDRINUSE - identify the blocking PID using
lsof - switch dev servers to an open port in Vite or Next.js
- detect zombie port binds left behind by stopped Docker containers
Example prompts for the agent
- The server failed with EADDRINUSE, find what is using the port
- Kill the process blocking the port and restart Vite
- Check why the port is busy, find the PID or run the server on the next free port
How to install detecting-port-conflicts
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a claude-code2Manually: put the files in place
~/.claude/skills/detecting-port-conflicts/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/detecting-port-conflicts/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a codex2Manually: put the files in place
.agents/skills/detecting-port-conflicts/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a cursor2Manually: put the files in place
.cursor/skills/detecting-port-conflicts/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install spencerpauly/awesome-cursor-skills detecting-port-conflicts2Manually: put the files in place
.github/skills/detecting-port-conflicts/SKILL.md1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a gemini-cli2Platform CLI
gemini skills install https://github.com/spencerpauly/awesome-cursor-skills --path resources/detecting-port-conflictsManually: put the files in place
.devin/skills/detecting-port-conflicts/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about detecting-port-conflicts
How to install detecting-port-conflicts in Claude Code?
Run npx skills add spencerpauly/awesome-cursor-skills --skill detecting-port-conflicts -a claude-code in your terminal.
What does detecting-port-conflicts do?
It intercepts port conflict errors in the terminal, pinpoints the blocking process ID, and either kills it or shifts your dev server to an open port.
What happens if lsof shows no process using the port?
The port might be in TIME_WAIT state. Wait 30 seconds for the system socket to close or bind your server to the next port.
Source text
SKILL.md · CC0-1.0
--- name: detecting-port-conflicts description: Detect EADDRINUSE and port conflicts, find what's using the port, and resolve it by killing the process or suggesting an alternative port. user-invocable: true --- # Detecting Port Conflicts When a dev server fails to start because a port is already in use, diagnose and resolve it. ## Detection Scan terminal output for these patterns: - `EADDRINUSE` - `address already in use` - `Port XXXX is already in use` - `bind: address already in use` - `OSError: [Errno 98] Address already in use` Extract the port number from the error message. ## Diagnosis Find what's using the port: ```bash lsof -i :<PORT> -P -n ``` This shows the PID, process name, and user. Common culprits: - A previous dev server that didn't shut down cleanly - Another project's dev server - A Docker container - A system service ## Resolution Options ### Option 1: Kill the blocking process ```bash kill <PID> # If it doesn't stop: kill -9 <PID> ``` Then restart the original server. ### Option 2: Use a different port Suggest the next available port: ```bash # Check if port+1 is free lsof -i :<PORT+1> -P -n ``` Update the dev server config or start command: - Next.js: `next dev -p <PORT>` - Vite: `vite --port <PORT>` - Express: set `PORT` env var - Django: `python manage.py runserver <PORT>` ### Option 3: Kill all node processes (nuclear option) ```bash killall node ``` Only suggest this if the user confirms — it kills everything. ## Tips - On macOS, ports below 1024 require root - Docker containers bind ports that persist even if the container is stopped — check `docker ps` - If `lsof` shows nothing, the port may be in TIME_WAIT state — just wait 30 seconds or use a different port
© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills