agentleFS
MicrosoftKnown publishermicrosoft/FluidFramework/.agency/plugins/nori/skills/using-git-worktrees/SKILL.md

using-git-worktrees

Skill4.9k starsChanged 4 months agoMITView on GitHub

Use this whenever you need to create an isolated workspace.

  • Installs packages

139 other projects use a version of this, 108 of them edited.

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 2 mentionsMar 2026: 1 mentionApr 2026: 1 mentionMay 2026: 3 mentionsJun 2026: 21 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/FluidFramework repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about microsoft/FluidFramework

The biggest 5 of 46 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 46

Talked about on GitHub and Hacker News (46 times).

On GitHub · 42

37 more on GitHub

Used with

Projects with it also use diagnosing-superpowers, chinese-git-workflow and 6 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.
  • obraSkill

    diagnosing-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

  • MorningStar0709Skill

    chinese-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-netSkill

    chinese-code-review

    中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • shibit-netSkill

    chinese-commit-conventions

    中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。

    Also in 3 projects that use this

  • MorningStar0709Skill

    workflow-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

  • guaderramaSkill

    lead-research-assistant

    Identifies and qualifies potential leads by analyzing products/services, understanding ideal customer profiles, conducting intelligent web research using Bright Data MCP tools, and providing actionable outreach strategies. Use when researching leads, prospecting, qualifying contacts, analyzing companies, enriching lead data, or creating outreach campaigns.

    Also in 6 projects that use this

  • +1 more from shibit-net

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 2 are common, 16 are distinctive, and 3 are very specific to this project.

  • 2

    Common

    Most of the 132 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check existing directories using the Bash tool: ls -d .worktrees 2>/dev/null

    line 11
  2. Distinctive:

    If not found, ask me for permission to create a .worktrees directory

    line 12
  3. Very specific:

    If given permission, create .worktrees.

    line 13
  4. Distinctive:

    Verify .gitignore before creating a worktree using the Bash tool:

    line 15
  5. Distinctive:

    If not found, add the appropriate line to the .gitignore immediately.

    line 22
  6. Very specific:

    Create the worktree with the Bash tool: `git worktree add ".worktrees/$BRANCH_NAME" -b "$BRANCH_NAME"

    line 27
  7. Distinctive:

    If there is no obvious project setup, you _MUST_ ask me.

    line 47
  8. Distinctive:

    Run tests to ensure the worktree is clean.

    line 49
  9. Distinctive:

    Never use cd .. from within a worktree - It will eventually take you outside the worktree boundary

    line 82
  10. Distinctive:

    Always use absolute paths for commands - Use npm run lint from within the worktree, not cd ..

    line 84
  11. Distinctive:

    If you need to run root-level commands, use the full worktree path: <bad-example> cd ..

    line 86
  12. Distinctive:

    Verify your location frequently:

    line 98
  13. Distinctive:

    If you accidentally exit the worktree:

    line 105
  14. Distinctive:

    Verify: git branch should show your branch, not main

    line 109
  15. Common:

    Fix: Always grep .gitignore before creating project-local worktree

    line 132
  16. Distinctive:

    Fix: Follow priority: existing > CLAUDE.md > ask

    line 137
  17. Distinctive:

    Fix: Always install the project when creating a new worktree

    line 142
  18. Distinctive:

    Create worktree without .gitignore verification (project-local)

    line 174
  19. Distinctive:

    Follow directory priority: existing > CLAUDE.md > ask

    line 182
  20. Distinctive:

    Verify .gitignore for project-local

    line 183
  21. Common:

    Verify clean test baseline

    line 185

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<required> *CRITICAL* Add the following steps to your Todo list using TodoWrite:
  1. Find the worktrees directory.
  • Check existing directories using the Bash tool: ls -d .worktrees 2>/dev/null
  • If not found, ask me for permission to create a .worktrees directory
  • If given permission, create .worktrees.
  1. Verify .gitignore before creating a worktree using the Bash tool:
# Check if directory pattern in .gitignore
grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore
  • If not found, add the appropriate line to the .gitignore immediately.
  1. Create the worktree
  • Come up with a good branch name based on the request.
  • Create the worktree with the Bash tool: `git worktree add ".worktrees/$BRANCH_NAME" -b "$BRANCH_NAME"
  • cd into the newly created path with the Bash tool: cd $path
  1. Auto-detect and run project setup.
# Node.js
if [ -f package.json ]; then npm install; fi

# Rust
if [ -f Cargo.toml ]; then cargo build; fi

# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi

# Go
if [ -f go.mod ]; then go mod download; fi
  • If there is no obvious project setup, you MUST ask me.
  1. Run tests to ensure the worktree is clean.
# Examples - use project-appropriate command
npm test
cargo test
pytest
go test ./...

If tests fail: Report failures, ask whether to proceed or investigate.

If tests pass: Report ready.

  1. Report Location
New working directory: <full-path>
Tests passing (<N> tests, 0 failures)
All commands and tools will now refer to: <full-path>
  1. Understand that you are now in a new working directory. Your Bash tool instructions from here on out should refer to the worktree directory, NOT your original directory. This is ABSOLUTELY CRITICAL.
</required>

Maintaining Working Directory in Worktree

CRITICAL: Once you create and enter a worktree, you must stay within it for the entire session.

Rules:

  1. Never use cd .. from within a worktree - It will eventually take you outside the worktree boundary
  2. Always use absolute paths for commands - Use npm run lint from within the worktree, not cd .. && npm run lint
  3. If you need to run root-level commands, use the full worktree path: <bad-example> cd .. && npm run lint </bad-example> <good-example> npm run lint # (from worktree root) </good-example>
<good-example> cd /home/$USER/code/project/.worktrees/branch-name && npm run lint </good-example>
  1. Verify your location frequently:
pwd  # Should show .worktrees/branch-name in path
git branch  # Should show * on your feature branch, not main
  1. If you accidentally exit the worktree:
  • Immediately recognize it (check if you're on main branch)
  • Navigate back: cd /full/path/to/.worktrees/your-branch
  • Verify: git branch should show your branch, not main

Red Flags:

  • Running git status and seeing "On branch main" when you should be on a feature branch
  • Running pwd and NOT seeing .worktrees/ in the path
  • Any cd .. command while in a worktree

Quick Reference

SituationAction
.worktrees/ existsUse it (verify .gitignore)
`.worktree/s does not existCheck CLAUDE.md → Ask user
Directory not in .gitignoreAdd it immediately
Tests fail during baselineReport failures + ask
No package.json/Cargo.tomlSkip dependency install

Common Mistakes

Skipping .gitignore verification

  • Problem: Worktree contents get tracked, pollute git status
  • Fix: Always grep .gitignore before creating project-local worktree

Assuming directory location

  • Problem: Creates inconsistency, violates project conventions
  • Fix: Follow priority: existing > CLAUDE.md > ask

Missing project installation

  • Problem: Tests and lint will fail, breaking the project
  • Fix: Always install the project when creating a new worktree

Proceeding with failing tests

  • Problem: Can't distinguish new bugs from pre-existing issues
  • Fix: Report failures, get explicit permission to proceed

Hardcoding setup commands

  • Problem: Breaks on projects using different tools
  • Fix: Auto-detect from project files (package.json, etc.)

Example Workflow

You: I'm using the Using Git Worktrees skill to set up an isolated workspace.

[Check .worktrees/ - exists]
[Verify .gitignore - contains .worktrees/]
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
[Run npm install]
[Run npm test - 47 passing]

Worktree ready at myproject/.worktrees/auth
Tests passing (47 tests, 0 failures)
Ready to implement auth feature

Red Flags

Never:

  • Create worktree without .gitignore verification (project-local)
  • Skip baseline test verification
  • Proceed with failing tests without asking
  • Assume directory location when ambiguous
  • Skip CLAUDE.md check

Always:

  • Follow directory priority: existing > CLAUDE.md > ask
  • Verify .gitignore for project-local
  • Auto-detect and run project setup
  • Verify clean test baseline

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.