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

finishing-a-development-branch · ganyuanran — скилл для Claude Code: установка

Безопасно закрывает жизненный цикл рабочей ветки или worktree после тестов: сверяет статус Git, запрашивает подтверждение и удаляет только проверенные ресурсы.

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

Что делает finishing-a-development-branch

Скилл структурирует завершение задачи в Git. Сначала агент проверяет снимок TaskStartSnapshot и вывод git worktree list --porcelain. Если проверочные тесты завершились ошибкой или найдены несохранённые изменения, работа немедленно останавливается. Агент никогда не сделает автоматический stash, rebase или force-push без явного указания.

Среди доступных действий — локальный мерж без неявного pull, отправка ветки в PR, сохранение ветки либо её удаление. Для удаления требуется точное подтверждение с указанием имени ветки и пути к worktree. Без этого удаление блокируется.

Очистка ресурсов строго упорядочена. Сначала агент закрывает и удаляет worktree командой git worktree remove <exact-path>, проверяет отсутствие файловых блокировок и только потом удаляет саму ветку. В конце формируется отчёт Final Git Receipt со статусами Task clean и Repository clean.

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

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

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

  • Проверь тесты и слей готовую ветку задачи в базовую ветку
  • Создай пулл-реквест для текущей ветки и очисти временный worktree
  • Удали рабочую ветку задачи, изменения больше не нужны

Как установить finishing-a-development-branch

1Через Skills CLI (Vercel)

npx skills add GanyuanRan/Aegis --skill finishing-a-development-branch -a claude-code

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

~/.claude/skills/finishing-a-development-branch/SKILL.md

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

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

Вопросы о finishing-a-development-branch

Как установить finishing-a-development-branch в Claude Code?

Выполните команду npx skills add GanyuanRan/Aegis --skill finishing-a-development-branch -a claude-code. Файл сохранится по пути ~/.claude/skills/finishing-a-development-branch/SKILL.md.

Что делает finishing-a-development-branch?

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

Удалит ли скилл ветку сразу после создания PR?

Нет, открытие PR не подтверждает слияние кода. Скилл по умолчанию удалит только временный чистый worktree, оставив саму ветку целой до фактического слияния или точной команды на удаление.

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

SKILL.md · MIT
---
name: finishing-a-development-branch
description: "Use when verified work needs integration or cleanup of an existing task-created branch/worktree, or the user explicitly requests merge, PR, or branch lifecycle handling."
---

# Finishing a Development Branch

## Overview

Integration choice and checkout lifetime are separate. Verify first, mutate only
task-owned resources, then prove what was removed or retained.

**Core principle:** fresh evidence -> authorized integration -> ownership-aware
cleanup -> Git/path readback.

**Announce at start:** explain which branch/worktree lifecycle is being closed.

## Step 1: Environment and Ownership Detection

Read the task's `TaskStartSnapshot` and current repository state. Record:

- root, `HEAD`, branch/detached state, upstream divergence, and active Git ops;
- staged/unstaged/untracked paths and the task-owned delta;
- `git worktree list --porcelain`;
- branch/worktree creator, task ownership, base branch, and cleanup trigger.

Stop on conflicts, unexplained detached state, failed verification, dirty/untracked state in
a cleanup target, or unknown ownership. Do not infer the base from the names
`main` or `master`; use task records, repository authority, or explicit user
direction. Never auto-stash, reset, clean, pull, rebase, amend, force-push, or
bypass hooks.

For a trusted host-managed detached checkout, follow the repository's approved
managed-workspace contract: verify host binding, default cwd, root, and HEAD;
then use its scoped local-commit and native handoff path. Report detached HEAD
in the receipt. This exception does not authorize automatic deletion of the
detached checkout or bypass unknown ownership/binding.

If no task-created branch/worktree exists and integration was not requested,
skip this workflow: report the local task commit plus `Task clean` and
`Repository clean`; do not invent merge/PR ceremony.

## Step 2: Fresh Verification

Run the smallest current-authority test set that proves the completed task. If
it fails, preserve all work and return to diagnosis. Do not present the branch
as ready.

## Step 3: Choose the Authorized Outcome

When a task branch actually needs disposition, present only applicable choices:

1. merge into the recorded base locally;
2. push and create/update a PR;
3. keep the branch for later integration;
4. discard the exact task-owned branch/worktree.

Push, PR, remote deletion, release, and force operations require explicit user
authorization. Discard requires a fresh, exact typed confirmation naming branch,
worktree path, and commits/delta to lose. Generic agreement is insufficient.

## Step 4: Execute Without Hidden Mutation

### Local merge

Verify the target checkout is safe, switch to the recorded base, merge without an implicit pull,
and rerun verification on the merged result. If integration
or verification fails, preserve both histories and stop.

### Push or PR

Push only the authorized task branch and create/update the PR with summary and
fresh test evidence. PR creation does not itself prove merge and does not
require the temporary worktree to remain.

### Keep branch

Retain the branch. Remove a clean task-created temporary worktree by default;
retain it only for an explicit ongoing-checkout need and report why.

### Discard

After exact confirmation, remove only the named clean task-owned worktree, then
the named branch. If either differs from the confirmation, stop and ask again.

## Step 5: Prove Integration Before Branch Deletion

Use evidence matching the merge strategy:

- merge/fast-forward: prove the task tip is an ancestor of the recorded base;
- squash/rebase: use fresh PR merge metadata plus strategy-appropriate patch
  equivalence (`git cherry` for rebased commits; stable patch-id or bounded
  changed-path/tree comparison for squashes), not an ancestor-only test;
- unmerged/open PR: keep the branch unless discard was exactly confirmed.

Never delete a branch merely because a PR was opened or a similarly named
commit exists.

## Step 6: Cleanup in Dependency Order

For a clean task-owned resource:

1. move to another safe registered checkout; never remove the current working directory;
2. remove/unregister the worktree first with `git worktree remove <exact-path>`;
3. read back `git worktree list --porcelain`;
4. verify the exact path no longer exists;
5. only then delete an integrated or exactly confirmed branch;
6. read back branch refs, `HEAD`, and repository status.

Do not use routine `--force`, global `git worktree prune`, wildcard deletion, or
cleanup of resources absent from the task ownership record. On Windows, Git may
unregister a worktree while its directory remains locked: re-check registration
and the exact resolved path, remove only a proven task-owned clean residual when
safe, otherwise retain it and report the lock/path. Never widen deletion scope.

## Final Git Receipt

Report:

- current branch and commit SHA/message, or the reason no commit exists;
- `Task clean: yes|no` and `Repository clean: yes|no` independently;
- branch/worktree created, removed, or retained, with evidence/reason;
- integration evidence and any remaining user action.

`Task clean` means no uncommitted task-owned delta remains. `Repository clean`
means no staged, unstaged, or untracked repository state remains.

This is a local Git receipt, not authoritative completion or merge truth beyond
the evidence read back.

## Integration

Called only when branch/worktree integration or explicit lifecycle handling is
in scope. Pairs with `using-git-worktrees` and
`verification-before-completion`.

© GanyuanRan · MIT · GanyuanRan/Aegis

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

Все скиллы по теме «Git и GitHub» →

Сначала — finishing-a-development-branch от других авторов.

finishing-a-development-branch Jesse Vincent Скилл проверяет тесты и помогает выбрать, как завершить работу в ветке: слить её, открыть Pull Request или оставить как есть. CX Codex 214 439установок 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установок

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

recording-architecture-decisions Скилл помогает решать, нужен ли ADR, выбрать действие и синхронизировать описание текущей архитектуры после значимых изменений. CX Codex +1 ★ 1 388звёзд репо long-task-continuation Сохраняет контрольные точки и подтверждения в длительных задачах при сбросе контекста или передаче между агентами. Пригодится для сложных многоэтапных рефакторингов. CX Codex +1 ★ 1 388звёзд репо goal-framing Скилл помогает зафиксировать цель, признаки успеха и границы задачи до начала работы. Он пригодится, когда важно согласовать, что считать результатом и когда остановиться. CX Codex +1 ★ 1 388звёзд репо first-principles-review Лёгкая проверка решения по первому принципу и бритве Оккама перед тем, как агент зафиксирует направление. Обычные багфиксы она не трогает. CX Codex +1 ★ 1 388звёзд репо executing-plans Скилл помогает агенту выполнять письменный план разработки по шагам, проверять результат на контрольных точках и сохранять контекст между сессиями. CX Codex +1 ★ 1 388звёзд репо establishing-project-context Ведёт словарь доменных терминов в CONTEXT.md, чтобы человек и агент называли одни и те же вещи одинаково. Нужен, когда термин переименовали, устарели или он оброс смыслами. CX Codex +1 ★ 1 388звёзд репо dispatching-parallel-agents Задаёт правила для параллельного запуска субагентов в несвязанных задачах без общего плана. Помогает избежать гонок за файлы и лишних накладных расходов. CX Codex +1 ★ 1 388звёзд репо communicating-concisely Скилл сокращает ответы агента по просьбе пользователя и сохраняет точность технических деталей. Режим действует до команды на отключение. CX Codex +1 ★ 1 388звёзд репо

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

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