using-git-worktrees
Skill1.3k starsChanged 7 months agoMITView on GitHub
Use when a coding task needs a concurrent checkout, unrelated dirty state blocks safe branch switching, or the user or repository explicitly requires a worktree.
- Installs packages
139 other projects use a version of this.
Trending
More talk lately.about the whole repository
Most recently taken up by
- JorgeMenaDev/skillstheir own version, first seen Oct 4, 2026
- LayneChai/superpowers-dshtheir own version, first seen Oct 3, 2026
- HanksChen0110/skillstheir own version, first seen Oct 3, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- lsy041015/orchestratheir own version, first seen Oct 2, 2026
- Wenaixi/dsh-superpowertheir own version, first seen Oct 1, 2026
Who's talking about GanyuanRan/Aegis
- hashgraph-online/awesome-codex-plugins“Add Aegis - agentic skills framework and software development methodology”GitHub · May 7, 2026 · 2 reactions
- sudosubin/agents.nix“agent-skills.github.ganyuanran.aegis: 2.10.7 → 2.12.1”GitHub · Oct 3, 2026
- ProSkillsMD/proskills“[Candidate] ganyuanran/aegis/skills/communicating-concisely - communicating-concisely”GitHub · Oct 2, 2026
- ProSkillsMD/proskills“[Candidate] ganyuanran/aegis/skills/brainstorming - brainstorming”GitHub · Oct 2, 2026
- ProSkillsMD/proskills“[Candidate] ganyuanran/aegis/skills/anti-entropy-governance - anti-entropy-governance”GitHub · Oct 2, 2026
The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 15
Talked about on GitHub (15 times).
On GitHub · 15
- May 7, 2026Add Aegis - agentic skills framework and software development methodology — hashgraph-online/awesome-codex-plugins2 reactions · 2 comments
- Oct 3, 2026agent-skills.github.ganyuanran.aegis: 2.10.7 → 2.12.1 — sudosubin/agents.nix0 reactions
- Oct 2, 2026[Candidate] ganyuanran/aegis/skills/communicating-concisely - communicating-concisely — ProSkillsMD/proskills0 reactions · 1 comment
- Oct 2, 2026[Candidate] ganyuanran/aegis/skills/brainstorming - brainstorming — ProSkillsMD/proskills0 reactions · 1 comment
- Oct 2, 2026[Candidate] ganyuanran/aegis/skills/anti-entropy-governance - anti-entropy-governance — ProSkillsMD/proskills0 reactions · 1 comment
10 more on GitHub
- Sep 30, 20260.1.22 在 DSH 0.2.0(会话格式 v4)下写入被拒:每轮对话结束抛未捕获的 promise rejection(附最小修复) — TelosmaYLX/dsh-session-notify0 reactions · 1 comment
- Sep 27, 2026agent-skills.github.ganyuanran.aegis: init at 2.10.7 — sudosubin/agents.nix0 reactions
- Sep 14, 2026Weekly discovery: new DeepSeek Harness ecosystem candidates — fendouai/awesome-deepseek-harness0 reactions · 1 comment
- Aug 29, 2026Misclassifies missing Git executable as plugin repository failure — dshplugin/dsh-plugin-hub0 reactions · 1 comment
- Aug 24, 2026fix: use explicit HTTPS URLs for GitHub plugin installs — dshplugin/dsh-plugin-hub0 reactions · 3 comments
- Aug 22, 2026[Audit] aegis — SoberReport-AI/DeepGuard0 reactions · 19 comments
- Jun 15, 2026weekly sync — 2026-06-15 — norbert-pap/claudebert0 reactions
- May 25, 2026Add Aegis — composio-community/awesome-claude-plugins0 reactions
- May 25, 2026Add Aegis — filipecalegario/awesome-vibe-coding0 reactions
- May 25, 2026Add skill: GanyuanRan/Aegis — VoltAgent/awesome-agent-skills0 reactions
Used with
Projects with it also use diagnosing-superpowers, chinese-git-workflow 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.
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 6 projects that use this
MorningStar0709Skillchinese-git-workflow
Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".
Also in 4 projects that use this
shibit-netSkillchinese-code-review
中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。
Also in 3 projects that use this
shibit-netSkillchinese-commit-conventions
中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。
Also in 3 projects that use this
MorningStar0709Skillworkflow-runner
Run an agency-orchestrator style YAML workflow inside the current Trae conversation by simulating or coordinating multiple roles. Use when the user provides a `.yaml` or `.yml` workflow, asks for multi-role collaboration, says things like “用多个角色一起评审这个 PRD”“多角色协作”“先生成工作流再执行”“让产品经理、架构师、QA 一起看一下”, or wants roles such as product manager, architect, reviewer, or QA to work together. Supports layered execution, role prompting, variable interpolation, document-backed inputs, and parallel steps only when the current environment has a clear subagent mapping. Do not use for ordinary implementation plans, simple code changes, or tasks already covered by `writing-plans`, `executing-plans`, `subagent-driven-development`, or single-purpose review/debug skills.
Also in 4 projects that use this
MicrosoftSkilltesting-anti-patterns
Use when writing or changing tests, adding mocks, or tempted to add test-only methods to production code - prevents testing mock behavior, production pollution with test-only methods, and mocking without understanding dependencies
Also in 3 projects that use this
- +1 more from shibit-net
Other versions139 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 139
- obra/superpowers★ 314ksame name
- jnMetaCode/superpowers-zh★ 8.3ksame name
- openai/plugins★ 7.3ksame name
- microsoft/FluidFramework★ 4.9ksame name
- usewhale/Whale★ 932same name
- coco-research/coco★ 437same name
- Ibrahim-3d/orchestrator-supaconductor★ 380same name
- KbWen/agentic-os★ 206same name
- totvs/engpro-advpl-tlpp-skills★ 138same name
- CommandCodeAI/agent-skills★ 131same name
129 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 repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- anti-entropy-governanceSkill
- brainstormingSkill
- communicating-conciselySkill
- dispatching-parallel-agentsSkill
- establishing-project-contextSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- first-principles-reviewSkill
- goal-framingSkill
- long-task-continuationSkill
- receiving-code-reviewSkill
- recording-architecture-decisionsSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- ui-ux-governanceSkill
- update-aegisSkill
- using-aegisSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 12 are distinctive, and 11 are very specific to this project.
0
Common
Most of the 132 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Core principle: create only with necessity and ownership evidence.
- Very specific: line 22
Before mutation, record the repository root, HEAD, branch/detached state, staged/unstaged/untracked paths, active Git operations, and:
- Very specific: line 38
Stop on unresolved conflicts, an active merge/rebase/cherry-pick/revert/bisect, or an unexplained detached HEAD.
- Distinctive: line 45
Before deciding necessity or placement, read the smallest relevant project AGENTS.md, CLAUDE.md, current authority, and existing worktree …
- Distinctive: line 52
Create at most one task-owned worktree only when one of these is true:
- Very specific: line 68
Use an existing repository convention only when the target directory is already ignored (git check-ignore).
- Distinctive: line 76
Prefer reusing an existing branch carrying the same goal.
- Distinctive: line 81
When the host surface declares task/chat-bound managed workspaces, use its native Worktree/Handoff lifecycle instead of shell creation.
- Distinctive: line 87
After the native lifecycle operation, or immediately when entering/reusing an already-bound managed workspace, and before the first task …
- Very specific: line 92
default command cwd without a command-level directory override.
- Very specific: line 96
All four must describe the same execution environment.
- Very specific: line 108
If an unbound manual worktree already exists, preserve it and report its exact path, HEAD, branch, status, and ownership evidence.
- Very specific: line 116
Use the shell path below only when trusted evidence positively classifies the current host/CLI surface as non-managed.
- Very specific: line 129
Read back git worktree list --porcelain, the new worktree's HEAD/branch, and its status.
- Very specific: line 135
Read the project's install docs, lockfiles, and existing setup scripts.
- Distinctive: line 140
Run the smallest relevant baseline verification.
- Very specific: line 150
Use finishing-a-development-branch after the task commit or integration decision.
- Distinctive: line 158
create a worktree only because a task modifies code.
- Distinctive: line 161
create one worktree per subagent.
- Very specific: line 162
treat Git readback, a path prefix, or command-level workdir as proof of managed task binding.
- Distinctive: line 164
use shell worktree creation merely because a host-native capability is deferred, UI-only, or absent from the initial tool list.
- Distinctive: line 166
run global prune or force cleanup as routine hygiene.
- Distinctive: line 167
remove dirty, untracked, locked, user-owned, or ownership-unknown resources.
“Common” is measured: kept by at least 6 in 10 of the 132 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
Using Git Worktrees
Overview
A worktree is an exception for simultaneously checking out another Git history, not a general safety badge. Prefer the current workspace and reuse an existing suitable worktree. A branch decision and a worktree decision are separate.
Core principle: create only with necessity and ownership evidence; pair every created worktree with a cleanup path.
Announce at start: explain which concrete checkout conflict requires a worktree.
Step 0: Environment Detection
Before mutation, record the repository root, HEAD, branch/detached state,
staged/unstaged/untracked paths, active Git operations, and:
git worktree list --porcelainClassify the current host surface's task/chat-bound managed workspace semantics
as managed, non-managed, or unknown. Use trusted host/session context, an
explicit host contract, or a host-native lifecycle result; do not infer the
classification from a product name, directory prefix, command-level workdir,
missing tool, or absent metadata. non-managed requires positive evidence that
the current surface lacks task-bound managed semantics. When the host exposes
workspace fields, record the task workspace and the command's default cwd
without a per-command directory override.
Stop on unresolved conflicts, an active merge/rebase/cherry-pick/revert/bisect, or an unexplained detached HEAD. A detached HEAD is acceptable only when trusted host binding evidence identifies it as the intended state of the current managed worktree; Codex-managed worktrees, for example, start detached by default. Preserve user state: no automatic stash, reset, clean, broad staging, or commit.
Before deciding necessity or placement, read the smallest relevant project
AGENTS.md, CLAUDE.md, current authority, and existing worktree convention.
Repository policy may require or forbid isolation and owns any approved
in-repo location; do not discover that policy after creating the checkout.
Step 1: Necessity Decision
Create at most one task-owned worktree only when one of these is true:
- another branch must remain checked out while this task proceeds;
- unrelated dirty state prevents a safe checkout in the current workspace;
- explicit user or current repository authority requires it.
Task complexity, planning, TDD, use of subagents, or a main/master branch
name is not sufficient. Same-task subagents share one workspace; do not create
per-subagent or nested worktrees. If independent history is unnecessary, do not
create a branch either.
Record: reason, branch, exact path, creating coordinator, and expected cleanup event. If the owner or cleanup condition is unknown, stop before creation.
Step 2: Safe Placement
Use an existing repository convention only when the target directory is already
ignored (git check-ignore). Never edit or commit .gitignore solely to host a
worktree. If no safe in-repo convention exists, use a task-specific external
user-level temporary directory outside the repository. Resolve and verify the
exact path before creation; do not target a broad home, workspace, or repo root.
Step 3: Create the Minimum Checkout
Prefer reusing an existing branch carrying the same goal. Create a branch only when the approved Git lifecycle requires independent history.
Managed-host binding gate
When the host surface declares task/chat-bound managed workspaces, use its native Worktree/Handoff lifecycle instead of shell creation. Reuse the current task only when trusted host evidence says it is already bound to the intended workspace. If the native operation creates or moves work into another task, continue only in that bound task.
After the native lifecycle operation, or immediately when entering/reusing an already-bound managed workspace, and before the first task content or Git history write, read back one joint postcondition:
- trusted task workspace;
- default command
cwdwithout a command-level directory override; - intended Git worktree root;
- intended
HEADand branch/detached state.
All four must describe the same execution environment. git worktree list, a
managed-looking path, or a per-command workdir proves only part of that
postcondition. If native creation/handoff is unavailable, only UI-driven, or
cannot be verified, stop before shell worktree creation or task content/history
writes and give the user the host-native re-entry action. Do not silently fall
back on git worktree add.
Compare resolved path identity using host-appropriate semantics, not raw path
strings. The default cwd may equal the worktree root or be inside it; running
Git from that default cwd must resolve to the intended worktree root.
An intended host-managed detached HEAD satisfies the Git-state component; do
not create a branch merely to make that state look like a generic checkout.
If an unbound manual worktree already exists, preserve it and report its exact
path, HEAD, branch, status, and ownership evidence. Dirty, untracked, or
ownership-unknown state is not auto-migrated, deleted, stashed, reset, or
overwritten. A later commit/patch transfer follows normal Git authorization and
must be verified in the new bound task before cleanup is offered.
Generic Git fallback
Use the shell path below only when trusted evidence positively classifies the
current host/CLI surface as non-managed. An unknown classification fails
closed; an absent native tool or missing binding metadata is not
generic-fallback evidence.
# Existing branch
git worktree add <exact-path> <branch>
# New independently justified branch
git worktree add -b <branch> <exact-path> <start-point>Read back git worktree list --porcelain, the new worktree's HEAD/branch, and
its status. Do not use force flags. A command-level workdir may target this
checkout on a generic host, but it never proves managed task binding.
Step 4: Authority-Led Setup and Baseline
Read the project's install docs, lockfiles, and existing setup scripts. Run
only setup the project explicitly requires. Do not infer npm install,
cargo build, pip install, poetry install, or dependency downloads merely
from manifest presence.
Run the smallest relevant baseline verification. If setup or tests fail, report the exact failure and preserve the worktree; do not hide it by mutating unrelated files.
Step 5: Handoff and Cleanup Ownership
Report the exact path, branch, start HEAD, baseline result, owner, and cleanup
trigger. The creating coordinator remains responsible until it proves cleanup
or explicitly hands ownership off.
Use finishing-a-development-branch after the task commit or integration
decision. A worktree may usually be removed while its unmerged branch remains;
an open PR does not require a permanent checkout.
Red Flags
Never:
- create a worktree only because a task modifies code;
- modify
.gitignoremerely to make worktree creation possible; - install dependencies blindly;
- create one worktree per subagent;
- treat Git readback, a path prefix, or command-level
workdiras proof of managed task binding; - use shell worktree creation merely because a host-native capability is deferred, UI-only, or absent from the initial tool list;
- run global prune or force cleanup as routine hygiene;
- remove dirty, untracked, locked, user-owned, or ownership-unknown resources.
Integration
Called conditionally by planning/execution workflows only after the necessity
decision. Pairs with finishing-a-development-branch for evidence-led cleanup.
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.

