本文へ移動
cccskills
無料GitHub で公開

worktree

Name, create, and remove git worktrees for isolated working directories. Use when starting a new task that needs its own branch and directory, or when naming or cleaning up a worktree.

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-coreスター 34(GitHub 34 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.3 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Git Worktree Management

When to Use

At the start of a task, the user will tell you which environment to work in. This skill covers naming, creating, and removing worktrees — for starting the dev stack, see the dev-environment skill.

This skill does not prescribe a worktree tool. Use whichever one the environment provides; the naming, location, and setup below apply regardless.

Naming Convention

Every worktree gets one name, used for both its directory and its base branch:

<ticket-id>-<slug>
  • <ticket-id> is the lowercase Linear ID (ayc-1050). Unticketed maintenance uses ayc-000.
  • <slug> is 2–4 lowercase kebab-case words describing the work (provider-factories, minio-image).
  • QA worktrees for a PR append -qa (ayc-1050-qa); use pr-<number>-qa when the PR has no ticket.

Examples: ayc-1050-provider-factories, ayc-000-minio-image, ayc-703-qa.

Location: <repo parent>/.worktrees/<repo name>/<name>, e.g. ~/dev/ayunis/.worktrees/ayunis-core/ayc-1050-provider-factories.

Never use a Graphite-generated branch name (08-21-feat_workspaces_…) or a free-form slug without a ticket ID as the directory name. When the work is on an existing branch, the directory still gets the convention name; if your tool derives the directory from the branch name, create the worktree under the convention name and check out the existing branch inside it.

Creating a Worktree

The user gives you a task ID and optionally an existing branch to work on.

  1. Create the worktree at the conventional location. For new work, create its base branch with the same <ticket-id>-<slug> name from main.
  2. Ensure it is set up. Your tool may already do some of this through hooks — check the result and do only what is missing:
  • The gitignored files listed in .worktreeinclude (secret .env files) must exist. Worktrunk, Claude Code, and Codex copy them on creation; if your tool did not, copy them from the main checkout.
cd "$WORKTREE_DIR"

# Track the base branch in Graphite — REQUIRED before any `gt create`, which
# otherwise fails with "Cannot perform this operation on untracked branch".
gt track --parent main

# ayunis-core is a pnpm workspace. Never `npm install` inside a sub-project —
# that creates a stray package-lock.json and resolves the wrong tree.
pnpm install

# Build the workspace packages so @ayunis/* types resolve (see below).
pnpm run build:deps

Build @ayunis/* deps before trusting a full typecheck

A fresh worktree has node_modules (after pnpm install) but not the built dist/index.d.ts for the @ayunis/* workspace packages — those only exist after the tsup build. Until you run pnpm run build:deps, a full pnpm exec tsc --noEmit emits ~60 TS2307 "Cannot find module '@ayunis/…'" errors on your branch AND on clean HEAD.

Never wave those TS2307 errors off as "pre-existing on clean HEAD." They are a missing-build artifact, not a real baseline — and treating them that way hides genuine type errors in your own new code behind the noise. In one session this masked a real bug (a raw 'mistral' string passed where an EmbeddingsProvider enum was required).

The pre-commit hook (tsc-files, staged-only) and ts-jest (transpile-only) both have blind spots that only a full post-build typecheck covers. So, in any worktree, before running or trusting tsc --noEmit:

cd "$WORKTREE_DIR" && pnpm run build:deps   # builds @ayunis/* dist/*.d.ts
pnpm exec tsc --noEmit                       # now TS2307 noise is gone; real errors surface

Empty Base Branch Gotcha

The worktree's <ticket-id>-<slug> branch is the base — Graphite stacks are built on top of it (see the git-workflow skill). Following git-workflow, the first commit goes on a gt create child branch, leaving the worktree base intentionally empty.

That's fine until you push. gt submit --stack refuses to submit an empty base branch:

WARNING: This branch does not introduce any changes: ▸ <ticket-id>-<slug>
Nothing to submit!

Fix: re-parent the child directly onto main so the empty base drops out of the stack:

gt track --parent main --force   # run on the CHILD branch, not the base
gt submit --stack --force --no-interactive

Alternative (single-PR tasks): skip the gt create and commit on the worktree base branch directly with gt modify --commit so the base isn't empty in the first place. Prefer this when the task is a single self-contained change, not a stack.

Scenario C — Use an existing worktree

The user points you to a worktree that already exists. Just cd into it and start working.

WORKTREE_DIR="/path/to/existing/worktree"  # from user
cd "$WORKTREE_DIR"

Cleanup

Only tear down when the user asks you to, or when they explicitly say the task is complete. Worktrees persist across agent sessions.

  1. Stop the worktree's dev stack if running: cd "$WORKTREE_DIR" && ./dev down (see dev-environment).
  2. Confirm no uncommitted or unpushed work would be lost.
  3. Remove the worktree with the same tool that manages it, from the main checkout. Never force-remove unless the user authorized discarding its contents.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Query Ayunis deployed-environment telemetry in AppSignal — incidents, occurrence counts and error traces via the `appsignal-cli` binary; structured log attributes (user.id, org.id, nestjs.context, custom metadata) via the v2 logs API. Use when investigating a production/staging incident or log data — NOT for local dev logs (see backend-debugging).

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

Ayunis Core backend specifics — module boundaries, key files, and project conventions. Complements the nestjs-hexagonal-backend skill.

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

Frontend development in ayunis-core. Use when creating, modifying, or debugging frontend code (React, Feature-Sliced Design, API client).

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

Debug backend runtime errors (500s, crashes, unexpected behavior). Use when something is broken at runtime — not for writing new code.

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

Shared test fixtures for backend specs — port mock factories, domain builders, and shared IDs in a per-module testing/ folder. Use when a module's *.use-case.spec.ts files repeat the same mock-repository literal, inline entity construction, or hardcoded UUIDs across files.

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

Analyze Cursor Bugbot PR comments through a root-cause lens: is the finding valid, and is the suggested fix the real fix or a bandaid over a deeper problem? Use when the user asks to check, assess, or triage bugbot comments.

日本語の概要は準備中です。原文の説明を表示しています。

ayunis-core/ayunis-core342026年10月26日 更新

ayunis-core のスキルをすべて見る

このスキルの問題を報告する