Complete Git development workflow toolkit. Covers commit, push, PR creation, merge to main, branch cleanup, debug, PR comment resolution, issue-based worktree creation, task execution, and worktree hooks configuration. Use when users need any Git-based development workflow or worktree isolation setup.
Manages complete Git workflows including commits, PRs, merges, debugging, and isolated worktree creation from issues.
npx claudepluginhub leobrival/topographic-plugins-officialThis skill is limited to using the following tools:
scripts/worktree-hooks/on-create.shscripts/worktree-hooks/on-remove.shscripts/worktree-manager/README.mdscripts/worktree-manager/biome.jsonscripts/worktree-manager/config/default.jsonscripts/worktree-manager/config/profiles/fast.jsonscripts/worktree-manager/config/profiles/full.jsonscripts/worktree-manager/config/profiles/minimal.jsonscripts/worktree-manager/package.jsonscripts/worktree-manager/scripts/install.shscripts/worktree-manager/scripts/terminals/launcher.shscripts/worktree-manager/src/cli.tsscripts/worktree-manager/src/index.tsscripts/worktree-manager/src/lib/config.tsscripts/worktree-manager/src/lib/file-utils.tsscripts/worktree-manager/src/lib/formatters.tsscripts/worktree-manager/src/lib/git-bridge.tsscripts/worktree-manager/src/lib/github-integration.tsscripts/worktree-manager/src/lib/logger.tsscripts/worktree-manager/src/lib/package-manager.tsComplete development workflow toolkit covering the full Git lifecycle: from issue to merge.
Before executing any workflow, collect the current git state:
# Current branch
git branch --show-current
# Working tree status
git status
# Staged and unstaged changes
git diff HEAD
# Recent commits
git log --oneline -10
This context informs which workflow to use and how to proceed.
Used by multiple workflows. Detect in this order:
if [ -f "pnpm-lock.yaml" ]; then echo "pnpm"
elif [ -f "package-lock.json" ]; then echo "npm"
elif [ -f "yarn.lock" ]; then echo "yarn"
elif [ -f "bun.lockb" ]; then echo "bun"
fi
| Workflow | Trigger | Description |
|---|---|---|
| Commit | After code changes | Stage, validate, commit (Commitizen), push |
| Commit + PR | Feature complete | Commit, push, create pull request |
| Debug | Project issues | Detect, categorize, fix all validation errors |
| Fix PR Comments | After review | Resolve all unresolved PR review comments |
| Merge to Main | PR approved | Merge feature branch with conflict resolution |
| Clean Gone | After merges | Delete local branches removed from remote |
| Run Task | New task/issue | Full implementation from issue to PR |
| Issue Worktree | New issue | Create isolated worktree from GitHub issue |
Stage all changes, run validation, create a Commitizen-format commit, and push.
Model: Use haiku for speed (simple, repetitive task).
Detect package manager (see Package Manager Detection)
Stage all changes
git add .
Run validation (use parallel subagents if available)
[pm] run lint (if exists in package.json)[pm] run typecheck (if exists in package.json)[pm] run build (if exists in package.json)If any validation fails, stop and report errors.
Review staged diff
git diff --staged
Create commit (Commitizen convention)
type(scope): descriptionTypes:
feat: New featurefix: Bug fixrefactor: Code refactoringdocs: Documentationtest: Testschore: MaintenanceExamples:
feat: add user authenticationfix: resolve memory leak in parserrefactor: simplify validation logicdocs: update API documentationPush to remote
git push
Commit, push, and create a pull request in one flow.
Check current branch
main/master: create a new descriptive branch first (feat/..., fix/...)Stage all changes
git add .
Run validation (same as Workflow 1, step 3)
[pm] run lint (if exists)[pm] run typecheck (if exists)[pm] run build (if exists)If any validation fails, stop and report errors. Do NOT push or create PR with failing validation.
Create commit (Commitizen convention, same as Workflow 1 step 5)
Push to origin
git push -u origin <branch-name>
Create Pull Request
gh pr create --title "[Title]" --body "## Changes
- ...
## Testing
- All tests passing
- TypeScript compilation passes
- Linting passes
## Related Issues
Closes #123"
PR body should include:
gh CLI for PR creationDetect and fix all project issues (lint, typecheck, tests, build). Comprehensive project health check.
Detect stack and project structure
Check for:
package.json — Node.js/TypeScript projectrequirements.txt / pyproject.toml — Python projectgo.mod — Go projectCargo.toml — Rust projectExtract information:
Discover available commands
Scan package.json scripts (Node.js/TypeScript):
cat package.json | grep -E "lint|typecheck|type-check|test|build|format|validate"
Common command patterns to detect:
lint / eslint / biome lint / biome check — Lintingtypecheck / tsc --noEmit — Type checkingtest / vitest / jest — Unit testsbuild — Production buildformat / prettier — Code formattingRun all validation commands (use parallel subagents)
For each command:
Analyze and categorize issues
Critical — Blocks build/deploy:
High Priority — Code quality issues:
Medium Priority — Maintainability:
Create fix plan: Critical → High → Medium (Phase 1, 2, 3)
Execute fixes systematically
[pm] run format # or prettier --write .
Verify fixes (re-run all validation commands with parallel subagents)
Summary report
# Debug Session Complete
## Project Health: HEALTHY / NEEDS WORK / CRITICAL
**Stack detected:** [Framework info]
## Issues Fixed
- [List of fixed issues]
## Validation Results
- Linting: [status]
- Type checking: [status]
- Tests: [status]
- Build: [status]
## Next Steps
- [Recommendations]
Fetch and fix all unresolved PR review comments.
Check authentication
gh auth status
If not authenticated, stop and ask user to run gh auth login.
Detect current PR
gh pr view --json number,title,url
If no PR found, stop and inform user.
Fetch unresolved comments
gh pr view --comments | grep -A 5 "UNRESOLVED"
Extract:
Plan fixes
Apply fixes systematically
Commit and push
git add .
git commit -m "fix: resolve PR review comments"
git push
Summary report
Fixed N PR comments:
- src/utils/api.ts:45 - Added error handling
- src/components/User.tsx:112 - Fixed prop types
- tests/auth.test.ts:23 - Updated test assertion
Pushed to branch: feature/user-auth
PR: https://github.com/user/repo/pull/123
gh auth loginMerge current branch to main with conflict resolution and quality checks.
Prepare for merge
# Verify on feature branch (NOT main)
git branch --show-current
# Ensure all changes committed
git status
# Check for uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "Uncommitted changes found"
# Run Commit workflow first
fi
Fetch latest main:
git fetch origin main
Preview merge diff:
git diff origin/main...HEAD
Create PR (if none exists)
Finalize changes:
gh pr create \
--base main \
--title "[Feature] Clear description" \
--body "## Changes
- Implemented [feature]
- Fixed [issue]
## Testing
- All tests passing
- TypeScript compilation passes
- Linting passes
## Related Issues
Closes #123"
Conflict detection and resolution
gh pr view --json mergeable,mergeStateStatus
If conflicts detected:
Analyze conflicts:
git merge-tree $(git merge-base HEAD origin/main) HEAD origin/main
Resolution strategy:
Automatic resolution (when safe):
Manual resolution required:
Apply resolution:
git checkout main
git pull origin main
git merge <feature-branch>
# Resolve conflicts
# Test the merged code
Verify resolution:
Quality assurance
MANAGER=$(
if [ -f "pnpm-lock.yaml" ]; then echo "pnpm"
elif [ -f "yarn.lock" ]; then echo "yarn"
elif [ -f "bun.lockb" ]; then echo "bun"
else echo "npm"
fi
)
$MANAGER run lint
$MANAGER run typecheck
$MANAGER run test
$MANAGER run build
Wait for CI checks:
gh pr checks
Complete merge
gh pr merge --auto --squash --delete-branch
Merge options:
--squash: Squash all commits into one (cleaner history)--merge: Keep all commits (preserve history)--rebase: Rebase and merge (linear history)--delete-branch: Clean up feature branchCleanup and verification
git checkout main
git pull origin main
git log --oneline -5
# Delete local feature branch
git branch -d <feature-branch>
# Verify remote cleanup
gh pr list --state closed --limit 5
Post-merge summary
Merge Complete
Branch: feature/user-authentication
PR: #123 - Add user authentication
Merge type: Squash
Summary:
- X files changed
- Y insertions, Z deletions
- 0 conflicts (or N auto-resolved)
- All CI checks passed
Main branch updated successfully.
gh auth loginDelete local branches that no longer exist on remote.
Fetch and prune
git fetch --prune
Find gone branches
git for-each-ref --format '%(refname:short) %(upstream:track)' refs/heads | grep '\[gone\]'
Delete gone branches
git branch -d <branch-name>
Use -D (force) only if -d fails and after confirming with user.
Report results
Cleaned up branches:
- feature/old-feature (deleted)
- fix/resolved-bug (deleted)
Remaining branches:
- main
- develop
- feature/current-work
-d)Full implementation workflow from GitHub issue or task file to pull request.
$ARGUMENT can be:
https://github.com/user/repo/issues/123123./tasks/add-feature.md"Add email validation"Fetch task details
For GitHub issue:
gh issue view $ARGUMENT --json title,body,labels,assignees
For file path:
cat $ARGUMENT
Extract:
Plan implementation
Discovery phase:
Create detailed plan:
## Implementation Plan
### Context
[What needs to be built and why]
### Files to modify:
1. src/components/Feature.tsx
2. src/services/api.ts
3. tests/Feature.test.ts
### Steps:
1. [Specific implementation steps]
2. [...]
Implement changes
Systematic implementation:
Run validation before committing
[pm] run lint[pm] run typecheck[pm] run test[pm] run buildFix any failures before proceeding.
Commit (Commitizen convention)
git add .
git commit -m "feat: [clear description of changes]"
Create Pull Request
gh pr create --title "[Title]" --body "## Changes
- Implemented [feature]
- Fixed [issue]
## Testing
- TypeScript compilation passes
- All tests passing
- Linting passes
## Related Issues
Closes #123"
gh auth loginCreate an isolated git worktree from a GitHub issue with AI-powered branch naming.
Requires: Worktree Manager scripts in skills/git-workflow/scripts/worktree-manager/.
# Find the worktree-manager path
PLUGIN_DIR=$(dirname "$(find ~ -path "*/skills/git-workflow/scripts/worktree-manager/src/index.ts" -type f 2>/dev/null | head -1)")
cd "$PLUGIN_DIR/.." && bun install
https://github.com/user/repo/issues/123Parse argument
Execute Worktree Manager
bun <plugin-path>/scripts/worktree-manager/src/index.ts <github-issue-url> [options]
Automatically:
gh CLI.env* files| Option | Description |
|---|---|
--terminal <app> | Terminal app (Hyper, iTerm2, Warp, Terminal) |
--no-deps | Skip dependency installation |
--no-terminal | Don't open terminal |
--debug | Enable debug logging |
--branch <name> | Override branch name |
--profile <name> | Config profile (minimal, fast, full) |
--output <dir> | Custom worktree base directory |
issue-{number}-{contextual-description} (max 50 chars, kebab-case)issue-{number}-{sanitized-title}# List all worktrees
bun <plugin-path>/scripts/worktree-manager/src/index.ts list
# Clean up old worktrees
bun <plugin-path>/scripts/worktree-manager/src/index.ts clean
# Force cleanup
bun <plugin-path>/scripts/worktree-manager/src/index.ts clean --force
Configure Claude Code's WorktreeCreate and WorktreeRemove hook events for enriched worktree isolation.
When Claude Code creates an isolated worktree (via isolation: "worktree" in agents or claude --worktree), these hooks automatically:
.env* files from the source repo.worktree-meta.json) for trackingThe hook scripts are co-located with this skill:
skills/git-workflow/scripts/worktree-hooks/
├── on-create.sh # WorktreeCreate hook
└── on-remove.sh # WorktreeRemove hook
To find the absolute path on this system:
find ~ -path "*/skills/git-workflow/scripts/worktree-hooks/on-create.sh" -type f 2>/dev/null | head -1
HOOK_DIR=$(dirname "$(find ~ -path "*/skills/git-workflow/scripts/worktree-hooks/on-create.sh" -type f 2>/dev/null | head -1)")
echo "Hook scripts found at: $HOOK_DIR"
chmod +x "$HOOK_DIR/on-create.sh" "$HOOK_DIR/on-remove.sh"
~/.claude/settings.json under the hooks key:{
"hooks": {
"WorktreeCreate": [
{
"hooks": [
{
"type": "command",
"command": "<HOOK_DIR>/on-create.sh"
}
]
}
],
"WorktreeRemove": [
{
"hooks": [
{
"type": "command",
"command": "<HOOK_DIR>/on-remove.sh"
}
]
}
]
}
}
Replace <HOOK_DIR> with the absolute path found in step 1.
# Simulate WorktreeCreate (from a git repo directory)
echo '{"name":"test-hook","cwd":"'$(git rev-parse --show-toplevel)'"}' | "$HOOK_DIR/on-create.sh"
# Check if hooks are configured in settings.json
cat ~/.claude/settings.json | python3 -c "
import sys, json
settings = json.load(sys.stdin)
hooks = settings.get('hooks', {})
create = hooks.get('WorktreeCreate')
remove = hooks.get('WorktreeRemove')
print(f'WorktreeCreate: {\"configured\" if create else \"not configured\"}')
print(f'WorktreeRemove: {\"configured\" if remove else \"not configured\"}')
if create:
cmd = create[0]['hooks'][0]['command']
print(f' Create script: {cmd}')
if remove:
cmd = remove[0]['hooks'][0]['command']
print(f' Remove script: {cmd}')
"
# Check recent hook activity
tail -20 /tmp/worktree-hooks.log 2>/dev/null || echo "No hook logs yet"
# Check archived worktrees
ls ~/.claude/worktree-archive/ 2>/dev/null || echo "No archived worktrees yet"
for f in ~/.claude/worktree-archive/*.json; do
[ -f "$f" ] || continue
python3 -c "
import json
with open('$f') as fh:
m = json.load(fh)
print(f\"{m.get('name','?'):30s} {m.get('repo','?'):20s} created={m.get('created_at','?')[:19]} removed={m.get('removed_at','?')[:19]}\")
" 2>/dev/null
done
Remove the WorktreeCreate and WorktreeRemove entries from ~/.claude/settings.json to revert to default git worktree behavior.
Both scripts are configured via environment variables. Set them in your shell profile (~/.zshrc) or inline in the hook command.
on-create.sh:
| Variable | Default | Description |
|---|---|---|
WORKTREE_BASE_DIR | ~/Developer/worktrees | Base directory for worktrees |
WORKTREE_COPY_ENV | true | Copy .env* files from source repo |
WORKTREE_INSTALL_DEPS | true | Auto-install dependencies |
WORKTREE_LOG_FILE | /tmp/worktree-hooks.log | Log file path |
on-remove.sh:
| Variable | Default | Description |
|---|---|---|
WORKTREE_CLEANUP_BRANCH | true | Delete the local branch after removal |
WORKTREE_ARCHIVE_META | true | Archive metadata before deletion |
WORKTREE_ARCHIVE_DIR | ~/.claude/worktree-archive | Archive directory |
WORKTREE_LOG_FILE | /tmp/worktree-hooks.log | Log file path |
Example with custom config in settings.json:
{
"hooks": {
"WorktreeCreate": [
{
"hooks": [
{
"type": "command",
"command": "WORKTREE_BASE_DIR=/tmp/worktrees WORKTREE_INSTALL_DEPS=false <HOOK_DIR>/on-create.sh"
}
]
}
]
}
}
WorktreeCreate (on-create.sh):
Triggered when Claude Code needs an isolated worktree (isolation: "worktree" or claude --worktree).
Input: JSON on stdin with name (worktree identifier) and cwd (source repo path).
Steps:
git worktree add in $WORKTREE_BASE_DIR/<repo>-worktree/<name>.env* files from repo root (excludes node_modules/, .git/).worktree-meta.json inside the worktreeOutput: Absolute path to the created worktree directory (stdout). All logs go to stderr.
WorktreeRemove (on-remove.sh):
Triggered when Claude Code removes a worktree (session end or agent cleanup).
Input: JSON on stdin with worktree_path and cwd.
Steps:
.worktree-meta.json to ~/.claude/worktree-archive/ with removal timestampgit worktree remove --forceHook not triggering:
~/.claude/settings.json under hooks.WorktreeCreate / hooks.WorktreeRemovechmod +x on-create.sh on-remove.shtail -f /tmp/worktree-hooks.log"not a git repository" error:
cwd from the input JSON — make sure you're running claude --worktree from inside a git repoisolation: "worktree" in Task tool, the parent agent's cwd must be a git repoDependencies not installing:
which bun pnpm yarn npmWORKTREE_INSTALL_DEPS=false to skip installationWorktree path conflict:
git worktree list then git worktree remove <path>| Situation | Workflow |
|---|---|
| Just finished coding, want to save | Commit |
| Feature complete, ready for review | Commit + PR |
| Something is broken, need to fix everything | Debug |
| Got review comments on my PR | Fix PR Comments |
| PR approved, ready to ship | Merge to Main |
| Too many old local branches | Clean Gone |
| Starting work on an issue/task | Run Task |
| Need isolated environment for an issue | Issue Worktree |
All workflows share common error handling:
cd to a repogh auth logingh CLI required for PR/issue operationsActivates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.