{
  "schemaVersion": "1.0",
  "item": {
    "slug": "using-git-worktrees",
    "name": "Using Git Worktrees",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/zlc000190/using-git-worktrees",
    "canonicalUrl": "https://clawhub.ai/zlc000190/using-git-worktrees",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/using-git-worktrees",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=using-git-worktrees",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/using-git-worktrees"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/using-git-worktrees",
    "agentPageUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent",
    "manifestUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Overview",
        "body": "Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.\n\nCore principle: Systematic directory selection + safety verification = reliable isolation.\n\nAnnounce at start: \"I'm using the using-git-worktrees skill to set up an isolated workspace.\""
      },
      {
        "title": "Directory Selection Process",
        "body": "Follow this priority order:"
      },
      {
        "title": "1. Check Existing Directories",
        "body": "# Check in priority order\nls -d .worktrees 2>/dev/null     # Preferred (hidden)\nls -d worktrees 2>/dev/null      # Alternative\n\nIf found: Use that directory. If both exist, .worktrees wins."
      },
      {
        "title": "2. Check CLAUDE.md",
        "body": "grep -i \"worktree.*director\" CLAUDE.md 2>/dev/null\n\nIf preference specified: Use it without asking."
      },
      {
        "title": "3. Ask User",
        "body": "If no directory exists and no CLAUDE.md preference:\n\nNo worktree directory found. Where should I create worktrees?\n\n1. .worktrees/ (project-local, hidden)\n2. ~/.config/superpowers/worktrees/<project-name>/ (global location)\n\nWhich would you prefer?"
      },
      {
        "title": "For Project-Local Directories (.worktrees or worktrees)",
        "body": "MUST verify directory is ignored before creating worktree:\n\n# Check if directory is ignored (respects local, global, and system gitignore)\ngit check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null\n\nIf NOT ignored:\n\nPer Jesse's rule \"Fix broken things immediately\":\n\nAdd appropriate line to .gitignore\nCommit the change\nProceed with worktree creation\n\nWhy critical: Prevents accidentally committing worktree contents to repository."
      },
      {
        "title": "For Global Directory (~/.config/superpowers/worktrees)",
        "body": "No .gitignore verification needed - outside project entirely."
      },
      {
        "title": "1. Detect Project Name",
        "body": "project=$(basename \"$(git rev-parse --show-toplevel)\")"
      },
      {
        "title": "2. Create Worktree",
        "body": "# Determine full path\ncase $LOCATION in\n  .worktrees|worktrees)\n    path=\"$LOCATION/$BRANCH_NAME\"\n    ;;\n  ~/.config/superpowers/worktrees/*)\n    path=\"~/.config/superpowers/worktrees/$project/$BRANCH_NAME\"\n    ;;\nesac\n\n# Create worktree with new branch\ngit worktree add \"$path\" -b \"$BRANCH_NAME\"\ncd \"$path\""
      },
      {
        "title": "3. Run Project Setup",
        "body": "Auto-detect and run appropriate setup:\n\n# Node.js\nif [ -f package.json ]; then npm install; fi\n\n# Rust\nif [ -f Cargo.toml ]; then cargo build; fi\n\n# Python\nif [ -f requirements.txt ]; then pip install -r requirements.txt; fi\nif [ -f pyproject.toml ]; then poetry install; fi\n\n# Go\nif [ -f go.mod ]; then go mod download; fi"
      },
      {
        "title": "4. Verify Clean Baseline",
        "body": "Run tests to ensure worktree starts clean:\n\n# Examples - use project-appropriate command\nnpm test\ncargo test\npytest\ngo test ./...\n\nIf tests fail: Report failures, ask whether to proceed or investigate.\n\nIf tests pass: Report ready."
      },
      {
        "title": "5. Report Location",
        "body": "Worktree ready at <full-path>\nTests passing (<N> tests, 0 failures)\nReady to implement <feature-name>"
      },
      {
        "title": "Quick Reference",
        "body": "SituationAction.worktrees/ existsUse it (verify ignored)worktrees/ existsUse it (verify ignored)Both existUse .worktrees/Neither existsCheck CLAUDE.md → Ask userDirectory not ignoredAdd to .gitignore + commitTests fail during baselineReport failures + askNo package.json/Cargo.tomlSkip dependency install"
      },
      {
        "title": "Skipping ignore verification",
        "body": "Problem: Worktree contents get tracked, pollute git status\nFix: Always use git check-ignore before creating project-local worktree"
      },
      {
        "title": "Assuming directory location",
        "body": "Problem: Creates inconsistency, violates project conventions\nFix: Follow priority: existing > CLAUDE.md > ask"
      },
      {
        "title": "Proceeding with failing tests",
        "body": "Problem: Can't distinguish new bugs from pre-existing issues\nFix: Report failures, get explicit permission to proceed"
      },
      {
        "title": "Hardcoding setup commands",
        "body": "Problem: Breaks on projects using different tools\nFix: Auto-detect from project files (package.json, etc.)"
      },
      {
        "title": "Example Workflow",
        "body": "You: I'm using the using-git-worktrees skill to set up an isolated workspace.\n\n[Check .worktrees/ - exists]\n[Verify ignored - git check-ignore confirms .worktrees/ is ignored]\n[Create worktree: git worktree add .worktrees/auth -b feature/auth]\n[Run npm install]\n[Run npm test - 47 passing]\n\nWorktree ready at /Users/jesse/myproject/.worktrees/auth\nTests passing (47 tests, 0 failures)\nReady to implement auth feature"
      },
      {
        "title": "Red Flags",
        "body": "Never:\n\nCreate worktree without verifying it's ignored (project-local)\nSkip baseline test verification\nProceed with failing tests without asking\nAssume directory location when ambiguous\nSkip CLAUDE.md check\n\nAlways:\n\nFollow directory priority: existing > CLAUDE.md > ask\nVerify directory is ignored for project-local\nAuto-detect and run project setup\nVerify clean test baseline"
      },
      {
        "title": "Integration",
        "body": "Called by:\n\nbrainstorming (Phase 4) - REQUIRED when design is approved and implementation follows\nsubagent-driven-development - REQUIRED before executing any tasks\nexecuting-plans - REQUIRED before executing any tasks\nAny skill needing isolated workspace\n\nPairs with:\n\nfinishing-a-development-branch - REQUIRED for cleanup after work complete"
      }
    ],
    "body": "Using Git Worktrees\nOverview\n\nGit worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.\n\nCore principle: Systematic directory selection + safety verification = reliable isolation.\n\nAnnounce at start: \"I'm using the using-git-worktrees skill to set up an isolated workspace.\"\n\nDirectory Selection Process\n\nFollow this priority order:\n\n1. Check Existing Directories\n# Check in priority order\nls -d .worktrees 2>/dev/null     # Preferred (hidden)\nls -d worktrees 2>/dev/null      # Alternative\n\n\nIf found: Use that directory. If both exist, .worktrees wins.\n\n2. Check CLAUDE.md\ngrep -i \"worktree.*director\" CLAUDE.md 2>/dev/null\n\n\nIf preference specified: Use it without asking.\n\n3. Ask User\n\nIf no directory exists and no CLAUDE.md preference:\n\nNo worktree directory found. Where should I create worktrees?\n\n1. .worktrees/ (project-local, hidden)\n2. ~/.config/superpowers/worktrees/<project-name>/ (global location)\n\nWhich would you prefer?\n\nSafety Verification\nFor Project-Local Directories (.worktrees or worktrees)\n\nMUST verify directory is ignored before creating worktree:\n\n# Check if directory is ignored (respects local, global, and system gitignore)\ngit check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null\n\n\nIf NOT ignored:\n\nPer Jesse's rule \"Fix broken things immediately\":\n\nAdd appropriate line to .gitignore\nCommit the change\nProceed with worktree creation\n\nWhy critical: Prevents accidentally committing worktree contents to repository.\n\nFor Global Directory (~/.config/superpowers/worktrees)\n\nNo .gitignore verification needed - outside project entirely.\n\nCreation Steps\n1. Detect Project Name\nproject=$(basename \"$(git rev-parse --show-toplevel)\")\n\n2. Create Worktree\n# Determine full path\ncase $LOCATION in\n  .worktrees|worktrees)\n    path=\"$LOCATION/$BRANCH_NAME\"\n    ;;\n  ~/.config/superpowers/worktrees/*)\n    path=\"~/.config/superpowers/worktrees/$project/$BRANCH_NAME\"\n    ;;\nesac\n\n# Create worktree with new branch\ngit worktree add \"$path\" -b \"$BRANCH_NAME\"\ncd \"$path\"\n\n3. Run Project Setup\n\nAuto-detect and run appropriate setup:\n\n# Node.js\nif [ -f package.json ]; then npm install; fi\n\n# Rust\nif [ -f Cargo.toml ]; then cargo build; fi\n\n# Python\nif [ -f requirements.txt ]; then pip install -r requirements.txt; fi\nif [ -f pyproject.toml ]; then poetry install; fi\n\n# Go\nif [ -f go.mod ]; then go mod download; fi\n\n4. Verify Clean Baseline\n\nRun tests to ensure worktree starts clean:\n\n# Examples - use project-appropriate command\nnpm test\ncargo test\npytest\ngo test ./...\n\n\nIf tests fail: Report failures, ask whether to proceed or investigate.\n\nIf tests pass: Report ready.\n\n5. Report Location\nWorktree ready at <full-path>\nTests passing (<N> tests, 0 failures)\nReady to implement <feature-name>\n\nQuick Reference\nSituation\tAction\n.worktrees/ exists\tUse it (verify ignored)\nworktrees/ exists\tUse it (verify ignored)\nBoth exist\tUse .worktrees/\nNeither exists\tCheck CLAUDE.md → Ask user\nDirectory not ignored\tAdd to .gitignore + commit\nTests fail during baseline\tReport failures + ask\nNo package.json/Cargo.toml\tSkip dependency install\nCommon Mistakes\nSkipping ignore verification\nProblem: Worktree contents get tracked, pollute git status\nFix: Always use git check-ignore before creating project-local worktree\nAssuming directory location\nProblem: Creates inconsistency, violates project conventions\nFix: Follow priority: existing > CLAUDE.md > ask\nProceeding with failing tests\nProblem: Can't distinguish new bugs from pre-existing issues\nFix: Report failures, get explicit permission to proceed\nHardcoding setup commands\nProblem: Breaks on projects using different tools\nFix: Auto-detect from project files (package.json, etc.)\nExample Workflow\nYou: I'm using the using-git-worktrees skill to set up an isolated workspace.\n\n[Check .worktrees/ - exists]\n[Verify ignored - git check-ignore confirms .worktrees/ is ignored]\n[Create worktree: git worktree add .worktrees/auth -b feature/auth]\n[Run npm install]\n[Run npm test - 47 passing]\n\nWorktree ready at /Users/jesse/myproject/.worktrees/auth\nTests passing (47 tests, 0 failures)\nReady to implement auth feature\n\nRed Flags\n\nNever:\n\nCreate worktree without verifying it's ignored (project-local)\nSkip baseline test verification\nProceed with failing tests without asking\nAssume directory location when ambiguous\nSkip CLAUDE.md check\n\nAlways:\n\nFollow directory priority: existing > CLAUDE.md > ask\nVerify directory is ignored for project-local\nAuto-detect and run project setup\nVerify clean test baseline\nIntegration\n\nCalled by:\n\nbrainstorming (Phase 4) - REQUIRED when design is approved and implementation follows\nsubagent-driven-development - REQUIRED before executing any tasks\nexecuting-plans - REQUIRED before executing any tasks\nAny skill needing isolated workspace\n\nPairs with:\n\nfinishing-a-development-branch - REQUIRED for cleanup after work complete"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/zlc000190/using-git-worktrees",
    "publisherUrl": "https://clawhub.ai/zlc000190/using-git-worktrees",
    "owner": "zlc000190",
    "version": "0.1.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/using-git-worktrees",
    "downloadUrl": "https://openagent3.xyz/downloads/using-git-worktrees",
    "agentUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent",
    "manifestUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/using-git-worktrees/agent.md"
  }
}