Agent Skillsnovuhq/novu › nv-worktree-create

nv-worktree-create

GitHub

创建Git并行工作区,自动新建分支、同步环境变量及企业子模块配置,便于独立开发。

.cursor/skills/nv-worktree-create/SKILL.md novuhq/novu

Trigger Scenarios

用户请求创建工作区(worktree) 使用/worktree命令指定分支名 需要并行分支检出

Install

npx skills add novuhq/novu --skill nv-worktree-create -g -y
More Options

Use without installing

npx skills use novuhq/novu@nv-worktree-create

指定 Agent (Claude Code)

npx skills add novuhq/novu --skill nv-worktree-create -a claude-code -g -y

安装 repo 全部 skill

npx skills add novuhq/novu --all -g -y

预览 repo 内 skill

npx skills add novuhq/novu --list

SKILL.md

Frontmatter
{
    "name": "nv-worktree-create",
    "description": "Create a sibling git worktree and a new branch with the same name, copy local `.env*` files, initialize the enterprise submodule, wire enterprise symlinks, and move the agent into the worktree. Use when the user asks for a worktree, parallel branch checkout, or `\/worktree` with a branch name.",
    "disable-model-invocation": true
}

Create a sibling git worktree

Goal: one name → new branch + sibling worktree at ../<name>, ready to work in.

For git command details and path naming, read nv-worktree-commands. For cleanup, read nv-worktree-cleanup.

Inputs

Input Required Default
Branch / worktree name yes — ask if missing
Base ref no current HEAD

Use the name as-is for the git branch. Use the sanitized name for the directory (see nv-worktree-commands).

Steps

  1. Preflight — from the main repo root:

    • git rev-parse --show-toplevel
    • git worktree list — abort if the target path already exists
    • git status --porcelain — if non-empty, warn that the working tree is dirty and ask the user whether to proceed before creating the worktree
  2. Create — always a new branch and worktree:

    git worktree add -b <branch> <worktree-path> [<base-ref>]
    

    Omit <base-ref> to branch from current HEAD.

  3. Copy local env files — from the main checkout into the worktree (gitignored secrets only; not .env.example). Use the rsync recipe in nv-worktree-commands. Report what was copied. Do not run setup-env-files.js — it regenerates encryption keys.

  4. Enterprise submodule — from the worktree root (best-effort; do not block handoff):

    • Skip if .source already exists or is linked.
    • Prefer linking an existing packages-enterprise clone before submodule init — same candidates as .cursor/scripts/install.sh (sibling ../packages-enterprise, parent checkout .source, /agent/repos/packages-enterprise, etc.).
    • Else configure HTTPS git fallback when SSH is unavailable, then shallow-init .source (matches install.sh):
      git config --global url."https://github.com/".insteadOf "git@github.com:"
      gh auth setup-git
      git submodule update --init --depth 1 .source
      
    • If .source is available, refresh symlinks (warn-only on failure):
      pnpm symlink:submodules || echo "WARN: symlink:submodules failed; continuing in OSS mode"
      
    • If enterprise setup fails, warn and continue in OSS mode — do not block the worktree. For troubleshooting, read enterprise-submodule.
  5. Hand offmove_agent_to_root with the absolute worktree path. Not move_agent_to_cloned_root.

  6. Confirm — branch name, worktree path, base ref, copied env files, enterprise submodule status.

Example

User: /worktree branch=more-dcr-oauths

Branch:     more-dcr-oauths
Path:       ../more-dcr-oauths
Command:    git worktree add -b more-dcr-oauths ../more-dcr-oauths

Then copy .env*, wire .source (link or submodule init) + pnpm symlink:submodules, move_agent_to_root.

Do not

  • Check out an existing branch — this skill always creates a new branch.
  • Copy the whole repo — only .env*.
  • Run pnpm install, pnpm build, or pnpm setup:agent — do those only if the user asks or a task fails.
  • Symlink node_modules from the parent checkout.
  • Pick the branch name without the user providing it (or confirming a suggested name).

Version History

  • 56a8a16 Current 2026-08-29 05:10

Same Skill Collection

.agents/skills/email-best-practices/SKILL.md
.agents/skills/frontend-design/SKILL.md
.agents/skills/linear-release-setup/SKILL.md
.agents/skills/react-email/SKILL.md
.agents/skills/testerarmy-cli/SKILL.md
.claude/skills/better-auth-best-practices/SKILL.md
.cursor/skills/add-channel-connect-button/SKILL.md
.cursor/skills/add-channel-setup-guide/SKILL.md
.cursor/skills/address-pr-review/SKILL.md
.cursor/skills/better-auth-best-practices/SKILL.md
.cursor/skills/ink-tui/SKILL.md
.cursor/skills/novu-prepare-pr/SKILL.md
.cursor/skills/nv-implement/SKILL.md
.cursor/skills/nv-park-and-review/SKILL.md
.cursor/skills/nv-worktree-cleanup/SKILL.md
.cursor/skills/nv-worktree-commands/SKILL.md
.cursor/skills/run-api-e2e-tests/SKILL.md
.cursor/skills/sanity-changelog/SKILL.md
.cursor/skills/triage-agent-eval-failures/SKILL.md
docs/.mintlify/skills/dashboard-workflows/SKILL.md
docs/.mintlify/skills/manage-preferences/SKILL.md
docs/.mintlify/skills/manage-subscribers/SKILL.md
docs/.mintlify/skills/trigger-notification/SKILL.md
.agents/skills/figma-use/SKILL.md
.cursor/skills/add-channel-whats-next-onboarding/SKILL.md
.cursor/skills/nv-endpoint-routed-tool-provider/SKILL.md
docs/.mintlify/skills/design-workflow/SKILL.md
docs/.mintlify/skills/framework-integration/SKILL.md
docs/.mintlify/skills/inbox-integration/SKILL.md

Metadata

Files
0
Version
56a8a16
Hash
62f6fedf
Indexed
2026-08-29 05:10

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 00:41
浙ICP备14020137号-1 $Carte des visiteurs$