new-session

Create isolated git worktrees with environment files and unique dev server ports.

25|4|Updated Sep 5, 2010
One-click install
npx skills add https://github.com/divad12/dotfiles --skill new-session-divad12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-session
Source: https://github.com/divad12/dotfiles/tree/main/.claude/skills/new-session
Command: npx skills add https://github.com/divad12/dotfiles --skill new-session-divad12

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Quickly spin up isolated development workspaces by provisioning a dedicated git worktree that carries environment configurations and uses a unique, conflict-free dev server port.

Core Features & Use Cases

  • Mirror main repository environment files (.env, .env.local, .env.production.local) into the new worktree to recreate the correct runtime context.
  • Manage per-worktree ports by maintaining a lock-based port assignment (avoiding port 3000) and cleaning up stale locks to support multiple concurrent sessions.
  • Symlink node_modules from the main repo to ensure consistent dependencies and faster startup.
  • Provide a repeatable workflow for feature development, experimentation, and isolated debugging without cross-branch interference.

Quick Start

Create a new worktree session named after your branch and run the development server on a unique port.

Frequently Asked Questions about new-session

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

FAQPage Schema
How do I create isolated git worktrees with unique dev server ports?

Creating isolated git worktrees with unique dev server ports involves provisioning a dedicated worktree, copying environment files from the main repository, and assigning a unique port via a lock-based system to prevent cross-branch conflicts.

How do I prevent dev server port conflicts when running multiple worktrees?

Preventing dev server port conflicts when running multiple worktrees requires managing per-worktree port assignments using lock files stored under .claude/ports, which automatically cleans stale locks and avoids default port 3000 for concurrent sessions.

Do I need to copy env files when setting up a new git worktree?

Yes, you need to copy env files when setting up a new git worktree to recreate the correct runtime context. Mirroring environment files like .env.local from the main repository prevents environment drift across isolated development workspaces.

Can I symlink node_modules from the main repo into a new worktree?

Yes, you can symlink node_modules from the main repo into a new worktree to ensure consistent dependencies and achieve faster startup times without needing to reinstall packages for each isolated development workspace.

What is the best way to manage environment drift in git worktree sessions?

The best way to manage environment drift in git worktree sessions is to automatically mirror main repository environment files into the new worktree and maintain a lock-based port assignment system to isolate runtime contexts across branches.

Why does my dev server use port 3000 when I start a new worktree?

Your dev server might use port 3000 because a per-worktree port lock was not established. Managing port assignments under .claude/ports explicitly avoids port 3000 and assigns unique, conflict-free ports to support multiple concurrent sessions.