brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
using-git-worktrees-liteUse when creating an isolated git worktree from the current branch for parallel development and only a build/compile check is required (no tests)
Independent GitHub snapshot · Automated classification · Original documentation governs
Create an isolated worktree from the current branch with a build/compile check instead of running tests.
Core principle: Confirm base branch + safe worktree directory + compile-only verification.
Announce at start: "I'm using the using-git-worktrees-lite skill to set up an isolated workspace."
Worktrees are very sensitive to your current working directory (CWD) when you use relative paths like .worktrees/....
Always capture the repo root and ensure you are operating from there before creating worktrees:
repo_root=$(git rev-parse --show-toplevel)
cd "$repo_root"
base_branch=$(git branch --show-current)
Confirm with the user that this is the branch to merge back into. Do not assume main or master.
Follow this priority order:
ls -d .worktrees 2>/dev/null
ls -d worktrees 2>/dev/null
If neither exists, check AGENTS.md for a preferred location. If still unknown, ask the user.
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
If not ignored, add the directory to .gitignore and commit. If you cannot commit now, stop and ask.
Use a naming convention to preserve the base branch in the worktree branch name:
<base-branch>__wt__<worktree-branch>
Example:
feature/auth__wt__login
# Example: git worktree add .worktrees/feature-auth__wt__login -b feature-auth__wt__login "$base_branch"
git worktree add "$path" -b "$branch_name" "$base_branch"
cd "$path"
# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo fetch; 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
# Java (Maven)
# No dependency install step needed here
AGENTS.md for project build/compile commands. If present, follow it.# Node.js (requires build script)
if [ -f package.json ]; then npm run -s build; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Go
if [ -f go.mod ]; then go build ./...; fi
# Python
if [ -f pyproject.toml ] || [ -f requirements.txt ]; then python -m compileall .; fi
# Java (Maven)
if [ -f pom.xml ]; then mvn -q clean compile; fi
If no build command is available (e.g., no npm build script), ask the user for the correct command.
If the build fails, report the failure and ask whether to proceed or investigate.
Worktree ready at <path>
Base branch: <base-branch>
Build/compile: <result>
Unless the user explicitly asks you to stay in the worktree to debug, return to the repo root at the end.
This prevents follow-up commands from accidentally running in the last worktree (and prevents creating nested worktrees due to relative paths).
cd "$repo_root"
| Step | Action |
|---|---|
| Base branch | Use current branch, confirm with user |
| Directory | Prefer .worktrees/, then worktrees/, else ask |
| Safety | git check-ignore for project-local directories |
| Build | Follow AGENTS.md or defaults; no tests |
| CWD | Normalize to repo root; return at end |
| Merge | Merge from the base-branch worktree, not the worktree branch |
Assuming main/master as base branch
Skipping ignore verification
git check-ignore before creating worktreeRunning tests instead of compile-only
Skipping build because no obvious command
Merging from the worktree branch directory
Staying in the last worktree directory
cd "$repo_root" after setup/build unless debugging is needed| Excuse | Reality |
|---|---|
| "I'll just merge this into main later" | Base branch is the current branch; confirm it now |
| "Tests are easier than a build" | Lite workflow requires build/compile only |
| "No build command, so I'll skip it" | Ask for the correct build command |
base_branch=$(git branch --show-current)
# Confirm base_branch with user
repo_root=$(git rev-parse --show-toplevel)
cd "$repo_root"
mkdir -p .worktrees
path=.worktrees/feature-x
branch_name=feature-x
git worktree add "$path" -b "$branch_name" "$base_branch"
cd "$path"
npm install
npm run -s build
cd "$repo_root"