К основному содержанию
скилл CX Codex

worktree-pr — скилл для Claude Code: работа в git worktree

Скилл изолирует крупные или рискованные задачи в отдельном git worktree, сравнивает результат с исходным состоянием и готовит ветку к pull request.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add scarletkc/agents --skill worktree-pr -a claude-code
Открыть на GitHub

Что делает worktree-pr

Скилл помогает решить, нужна ли задаче отдельная рабочая копия. Если нужна, он предлагает создать ветку от актуальной интеграционной ветки, оставить основной каталог нетронутым и проверить результат сравнением с исходным состоянием. Это подходит для параллельных задач и изменений, которые стоит сначала оценить отдельно.

Перед запуском нужно обновить базовую ветку. Одновременные worktree должны менять разные файлы, иначе конфликт проявится при объединении. Скриншоты, сборки и экспорты из рабочей копии нужно сохранять в указанном постоянном месте или прикладывать к PR: при удалении worktree они исчезнут.

Перед завершением скилл предлагает проверить старое и новое поведение на одной базе, а также убрать или объяснить побочные изменения вроде обновлённых lock-файлов. Он готовит ветку к pull request, но не выполняет слияние без указания владельца репозитория. Если для push или открытия PR требуется разрешение, агент сначала передаёт команды для подтверждения.

Какие задачи решает

  • изолировать рискованное изменение от основной рабочей копии
  • вести несколько задач в одном репозитории параллельно
  • сравнить новое поведение с исходным
  • подготовить ветку к pull request без слияния
  • сохранить артефакты worktree в доступном месте

Примеры запросов агенту

  • Выполни эту крупную задачу в отдельном git worktree, не меняя основную рабочую копию.
  • Создай отдельную ветку для этой рискованной правки и сравни результат с исходным поведением.
  • Подготовь изменения в worktree к pull request и перечисли, что ещё не проверено.

Как установить worktree-pr

1Через Skills CLI (Vercel)

npx skills add scarletkc/agents --skill worktree-pr -a claude-code

2Вручную: положить файлы

~/.claude/skills/worktree-pr/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/worktree-pr/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о worktree-pr

Как установить worktree-pr в Claude Code?

Выполни npx skills add scarletkc/agents --skill worktree-pr -a claude-code. Файл скилла находится по пути ~/.claude/skills/worktree-pr/SKILL.md.

Что делает worktree-pr?

Он помогает вести задачу в отдельном git worktree, сравнить результат с нетронутой рабочей копией и подготовить ветку к pull request. Слияние остаётся за владельцем репозитория, если пользователь не попросил иначе.

Как worktree-pr обращается со сборками и скриншотами?

Их нужно сохранять в постоянном месте или прикладывать к PR, указав расположение. При удалении worktree артефакты внутри него исчезнут.

Исходный текст

SKILL.md · Apache-2.0
---
name: worktree-pr
description: "Decide whether a task deserves its own git worktree and, if chosen, run it end to end: branch from the integration branch rather than the current tree, keep the main working copy untouched while the task runs, compare the result against the untouched baseline before declaring it done, and prepare it for a pull request instead of merging. Use when a request says to do the work in a new worktree or branch, when a change is large or risky enough that the main tree should stay usable, when several tasks need to run in parallel on one repository, when a result has to be diffed against current behavior, and when deciding where screenshots, builds, and other artifacts produced in a worktree should end up."
license: Apache-2.0
metadata:
  author: scarletkc
  source: https://github.com/scarletkc/agents
  summary: "Optionally run a task in its own worktree: branch from the integration branch, compare against the baseline, and prepare it for a PR."
---

# Worktree & PR

A worktree buys two things: the main working copy stays usable while the task
runs, and the untouched copy remains available as a baseline to compare
against. Both are worth real setup cost, and neither applies to every change.

This covers the isolation mechanics. How large the change itself should be is
[`scoped-change`](https://github.com/scarletkc/agents/blob/main/skills/scoped-change/SKILL.md),
and it applies inside a worktree exactly as it does anywhere else.

## Deciding

Consider a worktree when at least one holds: the task is large enough that a
half-finished state would block other work, several tasks need to progress on
the same repository at once, the result has to be compared against current
behavior, or the change is risky enough that abandoning it should cost
nothing.

Skip it when the change is small, self-contained, and reviewable in one pass.
Setting up an isolated copy for a typo fix or a one-line config edit costs
more than it saves, and the extra branch, directory, and PR are all overhead
that someone pays later. When the requester says to work directly on the
current branch, that decision is already made.

## Running

- **Branch from the integration branch, not from whatever is checked out.**
  The point of the isolated copy is a clean starting state; inheriting
  unrelated in-progress edits forfeits it and makes the eventual diff
  unreadable. Fetch first so the base is current, not a stale local ref.
- **Leave the main working copy alone while the task runs.** Editing both
  defeats the isolation and destroys the baseline. If the task turns out to
  need a change in the main tree, stop and say so rather than reaching
  across.
- **Parallel worktrees stay independent only while they stay disjoint.** Two
  copies of one repository editing the same files converge into a conflict
  nobody scheduled, and the cost lands at merge time rather than now. Before
  opening a second one, check what the first is touching.
- **Name the artifacts' destination explicitly.** Screenshots, builds, and
  exports produced inside a worktree vanish with it. Anything the requester
  needs to see must be written somewhere durable, or attached to the PR, and
  the location has to be stated rather than assumed.

## Before declaring it done

- **Compare against the untouched baseline, not against expectation.** The
  reason to keep a clean copy is to run both and see the difference. For
  behavior changes this means exercising the old path and the new one; for
  visual changes it means the same view captured twice. "Should be
  equivalent" is a claim, and the baseline is right there to check it.
- **Account for what the tooling added.** Generated output, formatter churn,
  and dependency lock updates accumulate in an isolated copy without anyone
  choosing them, and they are indistinguishable from intent once merged.
  Either explain why each belongs in this branch, or drop it.

## Landing

Follow the user's established authorization preferences. If committing,
pushing, or opening a pull request requires explicit authorization, complete
and validate the local changes, then hand over the exact commands until
authorized. When authorized, push the branch and open a pull request describing
motivation, the commands exercised, and anything reviewers must check by hand;
leave merging to the repository owner unless told otherwise. Say plainly which
parts are done, which are unverified, and which were deliberately left out,
since a worktree's isolation makes it easy to report an untested result as
finished. Once the branch has landed, remove the worktree; a stale copy of a
merged branch is a trap for the next session that opens it.

© scarletkc · Apache-2.0 · scarletkc/agents

Похожие скиллы

Все скиллы по теме «Git и GitHub» →
triage Matt Pocock Скилл проводит issue и внешние PR через роли триажа, проверку и подготовку брифа для агента. Подойдёт мейнтейнеру, который разбирает очередь задач. 990 453установок code-review Matt Pocock Проверяет изменения от выбранной точки по стандартам репозитория и требованиям задачи. Нужен для ревью ветки, PR или незавершённой работы. 789 521установок implement Matt Pocock Выполняет задачу по спецификации или тикетам, ведёт работу через тесты и завершает её ревью с коммитом. Подходит для задач, где нужен дисциплинированный цикл разработки. 774 700установок git-guardrails-claude-code Matt Pocock Скилл ставит хук Claude Code, который останавливает опасные Git-команды до их запуска. Нужен, если агент не должен делать push или удалять изменения. 499 069установок setup-pre-commit Matt Pocock Скилл настраивает pre-commit для JavaScript-репозитория: Husky запускает форматирование, проверку типов и тесты перед коммитом. 489 289установок scaffold-exercises Matt Pocock Скилл создаёт структуру учебных упражнений с секциями, задачами, решениями и пояснениями. Пригодится при запуске нового раздела курса. 480 196установок

Из того же набора10

ux-writing Скилл задаёт правила для пользовательских строк и документации: вывод CLI, ошибки, справка, README, комментарии и заголовки. Пригодится, когда правишь копирайт или структуру доков. CX Codex +1 ★ 224звёзд репо scoped-change Удерживает правки агента строго в границах задачи. Защищает репозиторий от лишних рефакторингов и забытых мест вызова. CX Codex +1 ★ 224звёзд репо product-writing Скилл помогает писать и проверять интерфейсные тексты и техническую документацию. Пригодится для сообщений об ошибках, инструкций и описания поведения продукта. CX Codex +1 ★ 224звёзд репо marketing-copy Пишет посты о запуске, описания в сторах, заголовки лендингов и анонсы. Следит, чтобы в публичный текст не попали ключи, закрытые ссылки и невыпущенные фичи. CX Codex +1 ★ 224звёзд репо grok-cli Запускает Grok Build как отдельного агента для проверки, ревью или кодинга параллельно с ведущей моделью. Управляет фоновой сессией через ACP-клиент. CX Codex +1 ★ 224звёзд репо devin-cli Передаёт ограниченные задачи локальному Devin CLI через ACP и возвращает отчёт о ходе работы. Подходит для параллельной реализации, переноса и ревью. CX Codex +1 ★ 224звёзд репо codex-cli Скилл объясняет, когда передавать работу в Codex CLI и как подобрать модель, усилие и права песочницы. Для агента-супервизора, а не для самого Codex. CX Codex +1 ★ 224звёзд репо ask-to-plan Превращает смутную идею в чёткий план с помощью встроенных кнопок агента. Задаёт по одному вопросу за шаг, чтобы согласовать цели и стек до написания кода. CX Codex +1 ★ 224звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой