worktree
Skill2 starsChanged 53 days agoMITView on GitHub
Create a git worktree and open it in a new VSCode window
- Reads credentials
69 other projects use a version of this.
Adopted by
Most recently taken up by
- oberemokis/skillstheir own version, first seen Nov 29, 2026
- artberri/skillstheir own version, first seen Nov 29, 2026
- Rune-kit/runetheir own version, first seen Nov 29, 2026
- DGouron/review-flowtheir own version, first seen Nov 29, 2026
- devin-integration-bot/skillstheir own version, first seen Nov 29, 2026
- kostya-epifanov/claude-gantrytheir own version, first seen Nov 29, 2026
Used with
Projects with it also use worktree-merge, resolve-conflicts and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
leessjuSkillworktree-merge
Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message.
Also in 3 projects that use this
ralphkraussSkillresolve-conflicts
Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.
Also in 5 projects that use this
PydanticSkillcoverage
Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.
Also in 4 projects that use this
SentrySkille2e
Run E2E tests for Sentry JavaScript SDK test applications
Also in 5 projects that use this
hdcolaSkillpr-comments
Fetch unresolved review comments from a GitHub PR or mark comments as resolved. Use this when managing PR review feedback, checking pending comments, or marking review threads as resolved. Supports GitHub URLs or explicit owner/repo/PR-number from anywhere, or PR number auto-detection from within a git repository.
Also in 3 projects that use this
johnlindquistSkilldiagram
Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.
Also in 5 projects that use this
Other versions69 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 69
- Significant-Gravitas/AutoGPT★ 188ksame name
- kortix-ai/CompanyOS★ 21ksame name
- kortix-ai/suna★ 21ksame name
- gitkraken/vscode-gitlens★ 10ksame name
- Zipstack/unstract★ 7.5ksame name
- mistralai/mistral-vibe★ 5.4ksame name
- nubjs/nub★ 4.5ksame name
- raine/workmux★ 3.1ksame name
- astashov/liftosaur★ 793same name
- nudgebee/nudgebee★ 524same name
59 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository88 other files it gives its agents.
- acceptance-criteriaSkill
- android-emulatorSkill
- architect-guideSkill
- architect-reviewSkill
- audit-fixerSkill
- avo-admin-expertSkill
- backend-services-expertSkill
- bug-hunt-allSkill
- bug-hunt-fixSkill
- bug-hunt-orchestratorSkill
- bug-huntSkill
- build-feature-remoteSkill
- build-featureSkill
- codeSkill
- component-testSkill
- controller-expertSkill
- create-qa-documentSkill
- debugSkill
- devops-expertSkill
- execute-qaSkill
- feature-qaSkill
- fix-bug-indexSkill
- fix-honeybadgerSkill
- fix-spec-bugsSkill
- fix-system-testSkill
- frontend-expertSkill
- frontend-reviewSkill
- full-qa-fixSkill
- full-qaSkill
- full-reviewSkill
- green-ciSkill
- group-issuesSkill
- honeybadger-auditSkill
- ideateSkill
- impact-assessmentSkill
- improveSkill
- ios-simulatorSkill
- issue-readySkill
- issues-readySkill
- merge-mainSkill
- model-expertSkill
- model-testSkill
- native-bug-hunt-fixSkill
- native-bug-huntSkill
- next-issuesSkill
- page-speedSkill
- plan-questionsSkill
- planSkill
- plan-system-testsSkill
- plan-workSkill
- policy-testSkill
- prdSkill
- prd-worktreeSkill
- product-questionSkill
- product-question-tldrSkill
- project-newSkill
- project-stepSkill
- qa-branchSkill
- qa-testerSkill
- rcm-auditSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 9 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 56 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Create a new git worktree named "$1" and open it in a new VSCode window.
- Distinctive: line 20
Verify we're in a git repository
- Distinctive: line 21
Check that the worktree name "$1" is provided and valid
- Distinctive: line 26
Create the worktree using the following approach:
- Very specific: line 27
Location: Create worktree in a sibling directory: ../<repo>-$1 (e.g.
- Very specific: line 29
Branch: Create a new branch named $1 for the worktree
- Distinctive: line 30
Base Branch: Use the current main branch (main) as the base
- Distinctive: line 35
Ensure "$1" is not empty
- Distinctive: line 36
If empty, prompt user to provide a worktree name
- Distinctive: line 55
Verify the new directory exists
- Very specific: line 93
Verify: bin/rails runner 'puts ActiveRecord::Base.connection_db_config.database' run in the worktree should print the suffixed name, NOT …
- Very specific: line 97
Use the open command to launch VSCode with the new worktree
- Very specific: line 108
SSL certs not found: If <main-repo>/config/certs doesn't exist, warn the user they'll need to generate certificates with mkcert (or skip …
- Very specific: line 109
.env not found: If <main-repo>/.env doesn't exist, warn the user they'll need to create it with the required environment variables
- Distinctive: line 144
Shared git history: All worktrees share the same git repository and history
“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Worktree Creation and VSCode Integration
Create a new git worktree named "$1" and open it in a new VSCode window.
Throughout this skill, <main-repo> means the absolute path of the main repository checkout
(the directory this skill is run from), and <app> means your application's database name
prefix (whatever config/database.yml uses, e.g. myapp for myapp_development /
myapp_test).
Prerequisites Validation
First, validate the environment:
- Verify we're in a git repository
- Check that the worktree name "$1" is provided and valid
- Confirm the worktree doesn't already exist
Worktree Creation Strategy
Create the worktree using the following approach:
- Location: Create worktree in a sibling directory:
../<repo>-$1(e.g. if the repo directory ismyapp, use../myapp-$1) - Branch: Create a new branch named
$1for the worktree - Base Branch: Use the current main branch (
main) as the base
Execution Steps
- Validate the worktree name:
- Ensure "$1" is not empty
- If empty, prompt user to provide a worktree name
- Validate it follows git branch naming conventions (no spaces, special characters)
- Check current repository status:
- Verify we're in a git repository
- Get the current working directory
- Confirm the main branch exists
- Create the git worktree:
This creates:git worktree add ../<repo>-$1 -b $1 main- A new directory at
../<repo>-$1 - A new branch named
$1based onmain - Checks out the new branch in the worktree
- A new directory at
- Verify worktree creation:
- List all worktrees to confirm creation
- Verify the new directory exists
- Copy SSL certificates (if your dev server uses local HTTPS):
- The development server may require SSL certificates that are in
.gitignore - Copy from the main repository to the new worktree:
cp -r <main-repo>/config/certs ../<repo>-$1/config/- This enables
bin/devto start with HTTPS support
- The development server may require SSL certificates that are in
- Copy environment file:
- The
.envfile contains required environment variables (API keys, etc.) and is in.gitignore - Copy from the main repository to the new worktree:
cp <main-repo>/.env ../<repo>-$1/.env- This ensures all environment variables are available in the new worktree
- The
- Create isolated databases:
- The worktree must NOT share
<app>_development/<app>_testwith the main repo — migrations run in the worktree would otherwise mutate the shared dev database. Haveconfig/database.ymlappendENV["DATABASE_SUFFIX"]to both database names (an unset var must be a no-op); setting it in the worktree's.envmeans every command run there (bin/rails,rspec,bin/dev) picks it up automatically via dotenv/foreman. The main repo (where the var is unset) is unaffected. - Sanitize "$1" into a Postgres-safe suffix (hyphens → underscores, lowercase alphanumerics
and underscores only, max 30 chars), append it to the worktree's
.env, and create the databases (run from inside the worktree directory):
DB_SUFFIX="_$(echo "$1" | tr '-' '_' | tr -cd 'a-z0-9_' | cut -c1-30)" # printf's leading newline matters: .env may not end in one, and a glued-on line is ignored printf '\nDATABASE_SUFFIX=%s\n' "$DB_SUFFIX" >> ../<repo>-$1/.env cd ../<repo>-$1 grep -E '^DATABASE_SUFFIX=' .env || { echo "DATABASE_SUFFIX not on its own line — fix .env" >&2; exit 1; } bin/rails db:create db:schema:load # <app>_development${DB_SUFFIX} + <app>_test${DB_SUFFIX} bin/rails db:seed # use a small seed profile here if your app has one- Verify:
bin/rails runner 'puts ActiveRecord::Base.connection_db_config.database'run in the worktree should print the suffixed name, NOT<app>_development
- The worktree must NOT share
- Open in VSCode:
- Use the
opencommand to launch VSCode with the new worktree - Command:
open -a "Visual Studio Code" ../<repo>-$1 - This opens a new VSCode window with the worktree directory
- Use the
Error Handling
Handle common issues:
- Missing worktree name: Prompt user to provide a name
- Invalid branch name: Suggest a valid alternative
- Worktree already exists: List existing worktrees and suggest alternatives
- Git errors: Display clear error messages and suggested fixes
- SSL certs not found: If
<main-repo>/config/certsdoesn't exist, warn the user they'll need to generate certificates with mkcert (or skip this step if the project doesn't use local HTTPS) - .env not found: If
<main-repo>/.envdoesn't exist, warn the user they'll need to create it with the required environment variables - Database setup fails (
db:schema:load/db:seederrors): Trybundle installin the worktree and retry once. If it still fails, warn the user — do NOT remove theDATABASE_SUFFIXline from.envas a workaround; working against the shared<app>_developmentdatabase is not acceptable - VSCode not found: Provide instructions for opening the directory manually
Success Confirmation
After successful creation:
- Confirm the worktree was created at
../<repo>-$1 - Confirm the branch
$1was created - Confirm SSL certificates were copied
- Confirm
.envfile was copied (including theDATABASE_SUFFIXline) - Confirm the isolated databases were created (report their names)
- Confirm VSCode opened with the new worktree
- Provide instructions for:
- Switching between worktrees
- Removing the worktree when done — drop the isolated databases FIRST (while the
worktree's
.envstill exists), then remove the worktree:
(If the worktree was already removed, drop leftovers withcd ../<repo>-$1 && bin/rails db:drop # drops <app>_development${DB_SUFFIX} and <app>_test${DB_SUFFIX} cd <main-repo> && git worktree remove ../<repo>-$1dropdb <name>— find them withpsql -lqt | grep <app>_) - Listing all worktrees:
git worktree list
Important Notes
- PRD-only work: to run
/prdthen/build-feature, use/prd-worktreeinstead — it skips every step below except creating the worktree and opening VSCode, and/build-featureremoves it once a PR opens - Worktree isolation: Each worktree is independent with its own working directory
- Database isolation: Each worktree gets its own
<app>_development_*/<app>_test_*databases viaDATABASE_SUFFIXin its.env. The main repo is unaffected (the var is unset there, andconfig/database.ymltreats that as a no-op). Remember tobin/rails db:dropfrom the worktree before removing it - Shared git history: All worktrees share the same git repository and history
- Branch management: Each worktree should have its own branch to avoid conflicts
- Cleanup: Remember to remove worktrees when done to keep your workspace clean
- Claude Code compatibility: Claude Code works seamlessly in worktrees
- Dev server port: Sibling worktrees serve on the default port like the main checkout, which
collides with it. To run one alongside it, assign a port with
bin/worktree-port --assign .env(writesPORT=<n>in the 3010–3099 range;bin/devhonors it, andbin/dev-urlreports the resulting base URL for the QA/bug-hunt skills)./worktree-sweepremoves these../<app>-*worktrees too once nothing in them is worth keeping
Example Usage
/worktree feature-payments
/worktree bugfix-auth
/worktree experiment-uiExecute the worktree creation workflow now, ensuring all steps are completed successfully.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

