一键导入
t1k-worktree
Manage git worktrees: create, session, sync (rebase), envsync, diff, status, remove, merge. Parallel development in monorepos and standalone repos.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage git worktrees: create, session, sync (rebase), envsync, diff, status, remove, merge. Parallel development in monorepos and standalone repos.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Asset Hunter Pro — unused asset detection, dependency graph, duplicate finder, project cleanup automation for Unity
Practical tools and validation methods for game balance — DPS calculators, EHP formulas, spreadsheet layouts, stat audits, difficulty spike detection
GDD structure, templates, and living documentation patterns for game projects — wiki pages, design docs, section layout, sync triggers
Game feel and juice — screen shake, hit stop, particles, animation curves, input responsiveness, feedback timing. Makes actions feel satisfying.
Mobile game design patterns — session design, retention mechanics, notification strategy, portrait/landscape, battery/thermal constraints, FTUE
Create or update TheOneKit agent .md files with canonical structure. Use when adding a new agent, updating maxTurns/model, or fixing frontmatter fields.
| name | t1k:worktree |
| description | Manage git worktrees: create, session, sync (rebase), envsync, diff, status, remove, merge. Parallel development in monorepos and standalone repos. |
| argument-hint | <subcommand> [args] — subcommands: create, session, sync, envsync, diff, status, list, remove, info, merge |
| version | 1.0.0 |
| effort | low |
| origin | theonekit-core |
| repository | The1Studio/theonekit-core |
| module | null |
| protected | true |
Comprehensive worktree lifecycle management: create, launch sessions, sync code/env, diff, and status.
This skill handles git worktree operations including merging worktree branches back to base via PR.
$HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs
All commands: node $SCRIPT <command> [args] [--json] [--dry-run]
| Command | Usage | Description |
|---|---|---|
create | create [project] <feature> --prefix <type> | Create worktree with branch |
remove | remove <name-or-path> | Remove worktree and branch |
session | session <name-or-path> | Get session command for worktree |
sync | sync [--worktree <name>] | Rebase worktrees from base branch |
envsync | envsync [--source <path>] [--dry-run] | Sync .env files across worktrees |
diff | diff [--worktree <name>] | Diff status per worktree vs base |
status | status | Combined overview of all worktrees |
info | info | Repo info, worktree location |
list | list | List all worktrees |
merge | merge [--target <branch>] [--delete] [--reset] | Merge worktree branch to base via PR |
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs info --json
Parse: repoType, baseBranch, projects, worktreeRoot.
fixrefactordocstestchoreperffeat"add authentication" → add-auth. Max 50 chars, kebab-case.
If monorepo and project not specified, use AskUserQuestion with project options.
# Standalone
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs create "<SLUG>" --prefix <TYPE>
# Monorepo
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs create "<PROJECT>" "<SLUG>" --prefix <TYPE>
Detect lockfile → run install in background.
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs session "<NAME>" --json
Reports: worktree path, branch, session command (cd <path> && claude).
Then execute the session command for the user.
# Sync all worktrees
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs sync --json
# Sync specific worktree
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs sync --worktree "<NAME>" --json
Reports per worktree: status (success/conflict/skipped), ahead/behind, conflicts. Skips dirty worktrees. Auto-aborts failed rebases.
# Sync from main worktree to all others
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs envsync --json
# Preview only
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs envsync --dry-run --json
# Custom source
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs envsync --source /path/to/source --json
Reports per worktree: each .env file copied/skipped/differs.
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs diff --json
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs diff --worktree "<NAME>" --json
Reports: commits ahead/behind base, changed files list, dirty state, commit log.
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs status --json
Combined view: branch, dirty state, ahead/behind, env sync status per worktree.
Merges a worktree's branch back to base via GitHub PR. Handles the worktree constraint
(target branch checked out elsewhere) by using gh pr instead of local merge.
Why PR-based: In worktrees, the target branch (e.g., master) is checked out in the main worktree,
so you can't git checkout master here. Using gh pr merge avoids this entirely.
--target <branch> — Target branch (default: base branch from info)--delete — Delete worktree after merge (default: keep)--no-reset — Skip resetting worktree branch to target after merge (default: ALWAYS reset)--squash — Squash merge (default, tries squash first, falls back to rebase)# Get repo info for base branch
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs info --json
# Check dirty state
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs diff --worktree "<NAME>" --json
# Always rebase on target before creating PR — ensures clean merge
git fetch origin
git rebase origin/<target>
# If conflicts: abort, warn user, recommend manual resolution
git push origin <branch> --force-with-lease
--force-with-lease (safe force push) since rebase rewrites historygit push origin <branch>
Note: If Step 2 already pushed with --force-with-lease, this step may show "up-to-date".
gh pr list --head <branch> --state open --json number
# If no open PR:
gh pr create --base <target> --head <branch> --title "<title>" --body "<body>"
# Try squash first (most repos prefer this)
gh pr merge <number> --squash
# If squash disallowed, try rebase
gh pr merge <number> --rebase
# If rebase disallowed, try merge
gh pr merge <number> --merge
# ALWAYS reset worktree branch to match target after merge
git fetch origin
git reset --hard origin/<target>
Report the reset: show old HEAD vs new HEAD to confirm branch is in sync.
# --delete: Remove worktree entirely
node $HOME/.claude/skills/t1k-worktree/scripts/worktree.cjs remove "<NAME>"
# Pull latest in main worktree so it has the merged changes
cd <main-worktree-path> && git pull origin <target>
| Error | Action |
|---|---|
| Merge commits not allowed | Try --squash, then --rebase |
| PR has conflicts | Run sync to rebase first, re-push |
| Branch not pushed | Push before creating PR |
| Dirty worktree | Commit or stash first |
--json — JSON output for LLM parsing--dry-run — Preview without executing (create, envsync, sync)--worktree-root <path> — Override worktree location (create only)Every command MUST report before/after state to the user. Format:
Before execution: Show current state relevant to the operation. After execution: Show what changed.
| Command | Before | After |
|---|---|---|
create | Repo type, base branch, worktree root | Created path, branch name, env files copied, next steps |
session | Worktree path, branch, terminal detected | Launched confirmation, session command, layout (split panes) |
sync | Per-worktree: branch, ahead/behind, dirty state | Per-worktree: rebase result (success/conflict/skipped), new ahead/behind |
envsync | Source dir, env files found, target worktree count | Per-worktree per-file: copied/skipped/differs, total summary |
diff | Total worktrees being compared | Per-worktree: ahead/behind, changed files list, dirty state, commit log |
status | Total worktrees, base branch | Per-worktree: branch, dirty state, ahead/behind, env sync status |
remove | Worktree path, branch name | Removed confirmation, branch deleted/kept |
merge | Branch, dirty state, ahead/behind, existing PRs | PR created/found, merge result, reset confirmation (old HEAD → new HEAD), main worktree updated |
Summary line at end of every operation:
Summary: X worktrees synced, Y skipped, Z conflicts
.env*.example) auto-copied on createsummary for quick reporting