port-allocation-strategy

Allocate deterministic, non-overlapping local ports for each worktree to avoid collisions across concurrent development sessions.

Content Preview
# Port Allocation Strategy

## Objective

Allocate deterministic, non-overlapping local ports for each worktree to avoid collisions across concurrent development sessions.

## Default Mapping

- App HTTP: `3000`
- Postgres: `5432`
- Redis: `6379`
- Stride per worktree: `10`

Formula by slot index `n`:

- `app = 3000 + (10 * n)`
- `db = 5432 + (10 * n)`
- `redis = 6379 + (10 * n)`

Examples:

- Slot 0: `3000/5432/6379`
- Slot 1: `3010/5442/6389`
- Slot 2: `3020/5452/6399`

## Collision Avoidance
How to Use

Recommended: Install to project (local)

mkdir -p .claude/skills
curl -o .claude/skills/port-allocation-strategy.md \
  https://raw.githubusercontent.com/alirezarezvani/claude-skills/main/engineering/git-worktree-manager/references/port-allocation-strategy.md

Skill is scoped to this project only. Add .claude/skills/ to your .gitignoreif you don't want to commit it.

Alternative: Clone full repo

git clone https://github.com/alirezarezvani/claude-skills

Then reference at engineering/git-worktree-manager/references/port-allocation-strategy.md

Related Skills