yun-spawn-worktree
Spawn an isolated git worktree for a synced repo so parallel work never collides. Use when the user wants to parallelize, work a task in isolation, or run one of several tickets on its own branch — or when another skill (e.g. yun-implement) needs an isolated worktree to build in. Creates .worktrees/<repo>/<task>/ on its own branch.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- yun-spawn-worktree
- description
- Spawn an isolated git worktree for a synced repo so parallel work never collides. Use when the user wants to parallelize, work a task in isolation, or run one of several tickets on its own branch — or when another skill (e.g. yun-implement) needs an isolated worktree to build in. Creates .worktrees/<repo>/<task>/ on its own branch.
03 SKILL.md 正文
yun-spawn-worktree
Spawn an ephemeral worktree — a second working tree of a synced repo, on its own branch,
so parallel agents each get an isolated tree and branch instead of editing or scanning each
other's. It only creates the worktree; removing it is the caller's job once the work lands
(git worktree remove, or the /yun-clean-worktree sweep). This is the light isolation rung —
pure git, local, no sandbox — the seam a heavier execution substrate plugs in above.
Preconditions
- You MUST be at the workspace root (the dir with
AGENTS.mdandskills/). Stay there — operate withgit -C, nevercdinto the repo or the worktree (AGENTS.md rule 1). repos/<repo>/exists and is a FULL clone — worktrees need full history, so a shallow clone won't do (yun-sync-repoclones full by default).
Inputs
<repo>— the synced repo underrepos/<repo>/.<task>— a kebab-case slug for the work; names both the worktree dir and its branch. It may carry slash-separated segments (<prefix>/<ticket>-<nonce>) so a caller spawning a whole set can group them under one branch namespace it can list and prune later; git takes the slashes in a branch name, and the worktree simply nests to match.<base>— the ref to branch from. A base the user or caller names is the base. Absent one, it is the repo's mainline, resolved by the rule inskills/_shared/execution-convention.md(a livedevelop, elsemainormaster, neverorigin/HEAD); none of them → STOP and ask for a base.
Steps
-
Resolve and check for collision. Confirm
repos/<repo>/is a repo. If.worktrees/<repo>/<task>/already exists, or a branch named<task>already exists in the repo, STOP and ask — never clobber another agent's worktree or branch. Done when the target path and branch name are both free. -
Spawn the worktree on a new branch. Add it at an ABSOLUTE path — a path passed to
git -Cis read against the repo dir, not the workspace root, so an absolute path is what keeps the worktree under.worktrees/(outside the repo's own tree, per rule 3):git -C repos/<repo> worktree add -b <task> "$(pwd)/.worktrees/<repo>/<task>" <base>Done when the command succeeds.
-
Verify isolation.
git -C repos/<repo> worktree listshows the new worktree on branch<task>.git statusat the workspace root does NOT list it —.worktrees/is gitignored; if it appears, the workspace.gitignoreis broken, so fix it before continuing. Done when both hold. -
Report. Give the ready path
.worktrees/<repo>/<task>/, its branch, and the base it was cut from. When the base was the mainline andrepos/<repo>has another branch checked out, name that branch too ("repos/<repo>is on<branch>; cut from<mainline>"), so a human who meant to stack on it sees it now. Work runs there viagit -C .worktrees/<repo>/<task>, from the workspace root. Done when the caller has the path and branch.
Cleanup
The caller's job once the work lands, not this skill's: git -C repos/<repo> worktree remove .worktrees/<repo>/<task>, or the /yun-clean-worktree sweep for every worktree whose work has
merged. Run git worktree prune BEFORE deleting a source repo, and
git worktree repair if the workspace moves (AGENTS.md rule 4).
04 同仓库更多 Skills
yun-write-wizard
Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.
yun-write-spec
Write the spec — consolidate a large task's settled decisions into one durable document before it is sliced into tickets. Use when the decisions are settled and the user wants them written up, or says "write the spec" / "escribí el spec". Declines small fixes that need no spec.
yun-write-pr
Write a pull request title and body that show the change — its ticket, its shape, the evidence it works, and how dangerous it is to merge.
yun-write-handoff
Compact the current session into a disposable handoff baton for the next agent, pointing at durable memory instead of duplicating it.
yun-write-agent-docs
Use when authoring or editing a document an agent reads in this workspace — a skill, a `skills/_shared/` contract, `AGENTS.md` or `skills/README.md` — deciding how it is invoked, what lives in it versus a linked file, naming it, or diagnosing why a skill misfires, bloats, or fires unreliably.
yun-tdd
Test-driven development — the red → green loop, tests written only at pre-agreed seams. Use when the user wants to build a feature or fix a bug test-first, or mentions TDD or red-green. Reached by the implement flow to drive a build at a seam.