port-registry

Diagnose local dev-server port conflicts and compute deterministic port assignments per project and worktree.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/gmolike/Claude-Template --skill port-registry-gmolike
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: port-registry
Source: https://github.com/gmolike/Claude-Template/tree/main/.claude/skills/port-registry
Command: npx skills add https://github.com/gmolike/Claude-Template --skill port-registry-gmolike

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Local dev servers across multiple projects and Git worktrees collide on the same ports (five projects want 3000), causing EADDRINUSE errors, hard strictPort failures, or worse, silent fallback to a wrong port that breaks auth redirects. This Skill provides a registry of occupied ports with source locations and a deterministic, stateless formula for assigning collision-free ports. ## Core Features & Use Cases - Port Registry: Documents every occupied port in the repo and neighboring projects with file:line evidence, classified as hard-coupled (moving it breaks external config like auth allowlists or CSP) or freely movable skill defaults. - Deterministic Assignment Plan: Computes ports as 30000 + PROJECT_INDEX1000 + WORKTREE_SLOT10 + SERVICE_OFFSET, so the same worktree always gets the same port on any machine without bookkeeping. - Diagnostics: Provides PowerShell commands (Get-NetTCPConnection) to list listening ports and identify which process and worktree holds a given port, plus warnings about fail-open pitfalls like localized netstat output. - Use Case: A dev server fails with EADDRINUSE in a worktree. Use this Skill to find who holds the port, decide whether to stop it, and compute the correct deterministic port for your worktree instead of editing vite.config.ts. ## Quick Start Ask the assistant which port is free for a new dev server in the current worktree, or who is holding port 3000.

Frequently Asked Questions about port-registry

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix EADDRINUSE port already in use errors for a Vite dev server?

First identify which process holds the port using Get-NetTCPConnection with the OwningProcess lookup, which reveals the worktree via the command line. Then either stop that server or compute your worktree's deterministic port from the assignment plan instead of editing vite.config.ts.

How do I find which process is using port 3000 on Windows?

Run Get-NetTCPConnection -LocalPort 3000 -State Listen and resolve the OwningProcess with Get-CimInstance Win32_Process to see the command line. The command line reveals the project path and worktree for Node or Vite servers.

How do I assign unique ports to multiple Git worktrees?

Use the formula port = 30000 + PROJECT_INDEX*1000 + WORKTREE_SLOT*10 + SERVICE_OFFSET, where the slot is the sum of the worktree slug's character codes modulo 90. The same slug always yields the same port on any machine with no state to maintain.

Why does netstat grep LISTENING show no results on German Windows?

The netstat status column is localized, showing ABHÖREN instead of LISTENING, so the grep returns zero matches with exit code 0, looking like the port is free. Use Get-NetTCPConnection instead, or filter netstat output on the address column rather than the status word.

When should I not change the port in vite.config.ts?

Never change it when the port is hard-coupled to external configuration, such as an auth redirect allowlist in another repository. Moving the port breaks login for everyone until that external config is updated, which a local commit cannot do.