본문으로 건너뛰기
cccskills
무료GitHub에 공개

git-worktree

Create a separate Git working directory for feature development without switching your current branch. The skill checks branch names and ignore settings, prepares dependencies, and starts background checks, with options for separate dependency installation.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Create isolated git worktrees for feature development without switching branches

연동 도구PostgreSQL
설치 방법 보기

이럴 때 유용합니다

  • Starting feature work in a separate working directory
  • Preparing a workspace for a bug fix
  • Testing dependency upgrades with a fresh installation
  • Considering database isolation before schema changes

포함된 파일(1)

  • SKILL.md7.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Git worktree setup

Create isolated git worktrees for feature development without switching branches.

Core principle: Smart directory selection + symlink optimization + background verification = fast, reliable isolation.

Requires: Git 2.5.0+ (July 2015)

Companion commands: /git-worktree-status | /git-worktree-remove | /git-worktree-clean

Process

  1. Validate Branch Name: Check naming convention and conflicts
  2. Check Existing Directories: .worktrees/ or worktrees/
  3. Verify .gitignore: Ensure worktree dir is ignored
  4. Create Worktree: git worktree add
  5. Symlink Dependencies: Reuse node_modules/ from main worktree
  6. Detect Database Provider: Check for DB branching capability
  7. Install Dependencies: Auto-detect package manager (if not symlinking)
  8. Run Background Verification: Type check + tests in background
  9. Report Location: Confirm ready with status

Flags

FlagEffect
--fastSkip dependency install and baseline tests
--isolatedFresh node_modules install (no symlink)
--skip-installSkip dependency install, keep baseline tests

Branch name validation

# Auto-prefix based on naming convention
# "auth" → "feat/auth" (default prefix)
# "fix/login-bug" → kept as-is
# "refactor/db-layer" → kept as-is

# Accepted prefixes: feat/, fix/, refactor/, chore/, docs/, test/, perf/
# If no prefix → default to feat/

# Reject invalid characters
echo "$BRANCH_NAME" | grep -qE '^[a-zA-Z0-9/_-]+$' || exit 1

# Check branch doesn't already exist
git show-ref --verify --quiet "refs/heads/$BRANCH_NAME" && echo "Branch already exists" && exit 1

Directory selection

Priority order

# 1. Check existing directories
ls -d .worktrees 2>/dev/null     # Preferred (hidden)
ls -d worktrees 2>/dev/null      # Alternative

# 2. Check CLAUDE.md for preference
grep -i "worktree.*director" CLAUDE.md 2>/dev/null

# 3. Ask user if neither exists

If both exist: .worktrees/ wins.

Safety verification

For project-local directories:

# Check if directory in .gitignore
grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore

If NOT in .gitignore:

  1. Add line to .gitignore
  2. Commit the change
  3. Proceed with worktree creation

Why critical: Prevents accidentally committing worktree contents.

Creation steps

# 1. Detect project name
project=$(basename "$(git rev-parse --show-toplevel)")

# 2. Create worktree with new branch
git worktree add .worktrees/$BRANCH_NAME -b $BRANCH_NAME

# 3. Navigate
cd .worktrees/$BRANCH_NAME

Dependency optimization (node.js)

Default behavior: Symlink node_modules from main worktree to avoid duplicate installs (~30s saved).

# Symlink node_modules (default, unless --isolated)
if [ -d "../../node_modules" ] && [ ! "$ISOLATED" = true ]; then
  ln -s "$(cd ../.. && pwd)/node_modules" node_modules
  echo "Symlinked node_modules from main worktree"
fi

# With --isolated: fresh install
if [ "$ISOLATED" = true ]; then
  pnpm install   # or npm/yarn based on lockfile detection
fi

When to use --isolated:

  • Schema changes requiring different package versions
  • Testing dependency upgrades
  • Debugging node_modules issues

Auto-Detect setup (multi-stack)

# Node.js (if not symlinked)
if [ -f package.json ] && [ ! -L node_modules ]; then
  pnpm install   # Detect from lockfile: pnpm-lock.yaml / yarn.lock / package-lock.json
fi

# Rust
if [ -f Cargo.toml ]; then cargo build; fi

# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi

# Go
if [ -f go.mod ]; then go mod download; fi

Background verification

Instead of blocking on full test suite, run verification in background:

# Create log directory
mkdir -p .worktree-logs

# Background type check (Node.js)
if [ -f tsconfig.json ]; then
  npx tsc --noEmit > .worktree-logs/typecheck.log 2>&1 &
  echo "Type check running in background (check with /git-worktree-status)"
fi

# Background test run
if [ -f package.json ]; then
  npx vitest run --reporter=json > .worktree-logs/tests.log 2>&1 &
  echo "Tests running in background (check with /git-worktree-status)"
fi

With --fast: Skip all verification.

Final report

Worktree ready at <full-path>
Branch: feat/auth (created from main)
Dependencies: symlinked from main worktree
Background checks: type check + tests running
Check status: /git-worktree-status

Ready to implement <feature-name>

Database branch suggestion

After worktree creation, detect database provider and suggest isolation.

Quick command reference

ProviderSuggested Command
Neonneonctl branches create --name <branch> --parent main
PlanetScalepscale branch create <db> <branch>
Local Postgrespsql -c "CREATE SCHEMA <schema>;"
OtherManual setup or shared DB

Example output:

Worktree created at .worktrees/feat/auth

DB Isolation: neonctl branches create --name feat-auth --parent main
   Then update .env with new DATABASE_URL
   Full guide: ../workflows/database-branch-setup.md

.worktreeinclude setup

Critical for environment variables:

# .worktreeinclude (at project root)
.env
.env.local
.env.development
**/.claude/settings.local.json

Why: Without this, .env files won't be copied to worktrees.

When to create database branch

ScenarioCreate Branch?
Schema migrationsYes
Data model refactoringYes
Bug fix (no schema change)No
Performance experimentsYes

See: Database Branch Setup Guide for complete workflows.

Quick reference

SituationAction
.worktrees/ existsUse it (verify .gitignore)
worktrees/ existsUse it (verify .gitignore)
Both existUse .worktrees/
Neither existsCheck CLAUDE.md, then ask user
Not in .gitignoreAdd + commit immediately
No branch prefixAuto-prefix with feat/
Node.js projectSymlink node_modules by default
--fast flagSkip install + tests
--isolated flagFresh node_modules install
Neon detectedSuggest neonctl branches create
PlanetScale detectedSuggest pscale branch create
No .worktreeincludeCreate with .env pattern

Common mistakes

Skipping .gitignore verification

  • Worktree contents get tracked, pollute git status

Assuming directory location

  • Follow priority: existing > CLAUDE.md > ask

Installing full node_modules in every worktree

  • Wastes disk and time. Use symlink by default, --isolated only when needed

Not copying .env to worktree

  • Symptom: Claude fails with "DATABASE_URL not found"
  • Fix: Add .env to .worktreeinclude

Using shared database for schema changes

  • Symptom: Migration conflicts, broken dev environment
  • Fix: Create database branch before modifying schema

Usage

/git-worktree auth
/git-worktree fix/session-bug
/git-worktree feature/new-api --fast
/git-worktree refactor/db-layer --isolated

Branch name: $ARGUMENTS

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Evaluate Claude Code agents, skills, and commands with weighted quality criteria. Get scores, readiness grades, template comparisons, and practical improvement suggestions in Markdown or JSON reports to guide reviews before release.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Review skills before release
  • Compare agent definitions with reference templates
  • Quickly check critical quality criteria
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

Assess a codebase across seven areas, including exposed credentials, security, dependencies, structure, and tests. Receive category scores, findings tied to file locations, and a prioritized improvement plan with smaller tasks that can be completed quickly.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Assessing the overall health of an inherited project
  • Reviewing exposed credentials and security risks
  • Identifying dependency and test coverage gaps
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

Measure code patterns such as casts to any or disabled lint rules, then run repeated, targeted edits. Keep changes that improve the chosen metric, revert unsuccessful changes, and track results for each improvement loop.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Finding code patterns to prioritize for cleanup
  • Preparing measurement files for an improvement loop
  • Repeating targeted edits to reduce casts to any
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

best-of-n

무료

Generate several separate solutions, compare them against criteria fixed in advance, and verify the selected result through executable checks or an independent reviewer. Keep a proof log documenting candidates, evidence, failures, and remaining limits.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Comparing implementation options before choosing one
  • Verifying a solution when a wrong choice would be costly
  • Keeping evaluation evidence for delivery or audit
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

canary

무료

Monitor a live application after deployment and compare it with a saved baseline, a record of its earlier state. Check page responses, loading times, and new errors, flag persistent changes, and produce a per-page health report.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Recording a healthy baseline before deployment
  • Monitoring production immediately after deployment
  • Checking key pages for slower responses or failures
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

catchup

무료

Rebuild project context after clearing a conversation or returning to work. Review recent Git history, uncommitted changes, and TODO markers to get a structured summary of project status and suggested next steps.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Restoring project context after /clear
  • Reviewing recent changes after a long break
  • Checking unfinished work before choosing the next task
FlorianBruniaux/claude-code-ultimate-guide6.2천2026년 10월 18일 업데이트

FlorianBruniaux의 스킬 모두 보기

이 스킬의 문제 신고