git-coworker-check
БесплатноЗапускает вложенные скриптыНе проверенDetect coworker Claude agents in a shared checkout. Use when starting a session in a shared clone, before destructive git ops (stash, reset, checkout), or…
от laurigates★ 61 звезда на GitHubОб этом скилле
/git:coworker-check
Detect another agent working in the same repo clone and warn before destructive operations that could destroy its uncommitted changes.
When to Use This Skill
| Use this skill when... | Use a worktree instead when... |
|---|---|
| Session starts in a clone that may already be in use | You control the session and can enter a worktree (EnterWorktree, or git worktree add .claude/worktrees/<task>) |
About to run git stash, git reset --hard, git checkout -- . |
You already know the working tree is yours alone |
git status shows files you don't remember touching |
Baseline + markers are already confirming you are alone |
| Bulk-edit / commit-loop fan-out about to start (per-plugin, per-package commits across many subdirectories) | Each iteration is already isolated in its own worktree |
| A collision already happened and you need to recover | See REFERENCE.md — Recovery section |
Signal design — what each signal survives and where it goes blind — is in
REFERENCE.md § Signal design. The always-loaded response rules
are .claude/rules/agent-coworker-detection.md.
Bulk-edit / commit-loop precondition
Bulk-edit and commit-loop workflows (git-commit-workflow "Bulk-edit / per-plugin commit loops", per-package release-please loops, mass refactors) MUST run this check up front, before staging any files — not opportunistically partway through.
Why front-loaded, not opportunistic: a mid-loop check lets whichever session looks first win. Field scenario: references/field-evidence.md § Why the check is front-loaded.
The rule: the orchestrator stops before fan-out if the playing field is contended. Mid-loop checks let "the agent who happens to look first wins" — which is non-deterministic and produces misleading commit histories.
| Verdict from up-front check | What to do |
|---|---|
clear |
Proceed with the bulk-edit / commit loop |
drift_detected |
Inspect the new files. If they are yours from earlier in the session, proceed with explicit paths. If unknown, stop and ask. |
worktree_leak_suspected |
A child worktree-isolated agent is leaking an untracked file into the parent (issue #1319). Do not stage or stash the matching path. Wait for the child's commit, then re-run the check before continuing. |
bare_flip_suspected |
The shared checkout was flipped to core.bare=true, or a leaked GIT_DIR / GIT_WORK_TREE env points away from the repo (issue #1692). Stop and recover before any further git ops — see the Recovery section. Do not start the loop. |
coworker_detected |
Stop. Recommend a fresh isolated worktree under <repo>/.claude/worktrees/<task> (EnterWorktree for the session's own repo), or wait for the other session to finish. Do not start the loop. |
For a worked example of the "stop and inspect" branch (#1277), see references/field-evidence.md.
Context
- Repo root: !
git rev-parse --show-toplevel - Git dir: !
git rev-parse --git-dir - Current status: !
git status --porcelain=v2 --branch - Stash count: !
git stash list - Existing markers: !
find . -path './.git/.claude-session-*' -maxdepth 3
Parameters
Parse $ARGUMENTS for the mode flag. Default is --check.
| Flag | Action |
|---|---|
--check (default) |
Run detection. Report verdict without writing anything. |
--claim |
Write a session marker and baseline snapshot for this session. Run at session start. |
--release |
Remove this session's marker and baseline files. Run on session exit. |
Execution
Execute this detection workflow:
Step 1: Resolve mode
Inspect $ARGUMENTS. If it contains --claim, go to Step 2a. If it contains --release, go to Step 2b. Otherwise (including empty), go to Step 3.
Step 2a: Claim (write marker + baseline)
Run:
bash ${CLAUDE_SKILL_DIR}/scripts/claim-session.sh
Report the three file paths printed. These are the marker and baseline files — do not commit or delete them. They live inside .git/ and are not tracked.
Stop here.
Step 2b: Release (remove marker + baseline)
Run:
bash ${CLAUDE_SKILL_DIR}/scripts/release-session.sh
No output is expected. Stop here.
Step 3: Detect coworkers
Look up the current session's baseline files (if --claim was run earlier this session). Then run detection. Pass --self-agent claude-${CLAUDE_SESSION_ID:0:8} so taskwarrior claims by this same session are reported as OWN_CLAIM_* rather than counted as coworkers:
bash ${CLAUDE_SKILL_DIR}/scripts/detect-coworkers.sh \
--self-agent claude-${CLAUDE_SESSION_ID:0:8} \
--baseline-status .git/.claude-baseline-$$.status \
--baseline-stash .git/.claude-baseline-$$.stash
If no --claim was run, omit the --baseline-* flags — drift detection will
Установить git-coworker-check в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(bash *)Bash(git status *)Bash(git stash *)Bash(git rev-parse *)ReadTodoWriteВложенные файлы
FAQ
Что делает скилл git-coworker-check?
Detect coworker Claude agents in a shared checkout. Use when starting a session in a shared clone, before destructive git ops (stash, reset, checkout), or before bulk-edit / commit-loop workflows.
Как установить скилл git-coworker-check?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл git-coworker-check запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic