Communityライティング&編集github.com

gener8v/gener8v.claude-skills.engineering

最初の編集の前に作業を正しいブランチに配置します。ベースブランチを見つけ、リモートの最新状態から適切な名前のブランチを作成し、エージェントごとに1つのワークツリーを設定して並行作業を行います。Issue 42の開始、タイプミスの修正、3つのチケットのブランチ設定など、追跡ファイルの変更開始時やサブエージェント開始前に使用します。PRの作成やマージ(github-pr-merge)、履歴書き換えなどの危険なGitコマンド(git-safety)には使用しません。

gener8v.claude-skills.engineering とは?

このスキルは、開発作業を常に正しいブランチ上で開始・管理するためのGitブランチ管理プロセスを提供します。AIエージェント(Claude Code、Cursor、Codexなど)がコード編集を始める前に、まずベースブランチを特定し、リモートの最新状態からブランチを作成し、適切な命名規則に従ったブランチ名を設定します。これにより、複数のエージェントが並行して作業する場合でも、各エージェントに独立したワークツリーを割り当て、ブランチの競合や作業の混乱を防止します。スキルは5つの明確なステップ(ベースブランチの発見、現在位置の確認、リモート先端からのブランチ作成、ブランチ命名、作業中の注意点)で構成され、さらに並行作業のためのリソースを参照します。CIやテストパイプラインとの連携も考慮しており、プッシュ前後のテスト実行や安全なプッシュチェーンを定義しています。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/gener8v/gener8v.claude-skills.engineering/tree/HEAD/skills/git-branching

Installed? Explore more ライティング&編集 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Git ブランチ管理

すべての変更は独自のブランチで行います。これは1行の修正や、Issueがない変更も含みます。ベースブランチにコミットしてはいけません。

1. ベースブランチを見つける

最初に回答が得られる情報源を使用します:

  1. リポジトリの指示. CLAUDE.md、CONTRIBUTING.md、.github/ 内の文書を読みます。ベースブランチまたは統合ブランチが指定されていれば、それを使用します。
  2. リモートのデフォルトブランチ.
    git symbolic-ref --short refs/remotes/origin/HEAD   # origin/<name> を表示
    gh repo view --json defaultBranchRef -q .defaultBranchRef.name
    
  3. 曖昧な場合. リモートに develop や development があり、どのブランチがベースか文書に記載がない場合は、ユーザーに尋ねます。推測してはいけません。

統合ブランチ(例: develop)がベースの場合、リリース版に対するホットフィックスはデフォルトブランチから開始します。これはユーザーがその作業をホットフィックスと呼んだ場合のみ使用します。

2. 現在位置を確認する

git status --porcelain
git rev-parse --abbrev-ref HEAD
  • ワーキングツリーに自分が行っていない変更がある場合は、停止し、ユーザーにどうするか尋ねます。
  • すでにこの作業のブランチにいる場合は、そのままそこに留まります。
  • ベースブランチ上に自分が行った未コミットの編集がある場合は、それらを移動します: git switch -c <name> でワーキングツリーに保持されます。

3. リモートの先端からブランチを開始する

git fetch origin --prune
git switch -c <name> origin/<base>
git log -1 --oneline

origin/<base> から開始することで、古いローカルベースブランチがあっても問題になりません。ベースブランチで git pull を実行して「追いつく」必要はありません。必須ではありません。

4. ブランチに名前を付ける

リポジトリの規則があればそれに従います。ない場合は、<type>/<ref>-<slug> を使用します:

部分値
typefeat、fix、docs、chore、refactor、test、release、hotfix
refIssue番号 (42)、パイプラインチケット (ticket-007)、またはなし
slug2〜5語の小文字単語をハイフンで結合

例: fix/42-null-session-crash、feat/ticket-007-search-filters、docs/readme-install-steps。

5. 作業中の注意点

  • それぞれが単独で意味をなす小さな単位でコミットします。件名は命令形で72文字以内に書きます。本文では理由を説明します。
  • コミットメッセージに Co-Authored-By: Claude トレーラーを追加してはいけません。これは gener8v のルールです。
  • 最初のプッシュ前は、origin/<base> にリベースできます。ブランチがプッシュされた後は、代わりにベースをブランチにマージします。プッシュされたブランチのリベースは履歴を書き換えるため、engineering:git-safety がそれを制御します。
  • 最初の失敗で停止するチェーンでプッシュします:
    set -o pipefail
    git fetch origin && <テストコマンド> 2>&1 | tail -n 40 && git push -u origin HEAD
    
    set -o pipefail がないと、| tail がその前のコマンドの終了コードを隠してしまいます。Gitコマンドやテストコマンドを tail にパイプする際は、必ずこの設定を行ってください。

並行作業

同時にコードを編集する2つ以上のエージェントについては、エージェントを開始する前に resources/parallel-work.md を読んでください。簡単に言うと: ベースから1つのバッチブランチ、バッチブランチからエージェントごとに1つのワークツリーと1つのブランチ、そして同じファイルを扱うエージェントはありません。

完了条件

  • 明確な名前のブランチ上にあり、そのブランチが現在の origin/<base> から始まっていること。
  • git status が他人の変更を表示しないこと。

関連スキル

  • engineering:github-pr-merge: 作業完了時にPRを作成します。
  • engineering:git-safety: フォースプッシュ、ブランチ削除など類似コマンドの承認ルール。
  • engineering:github-issue-workflow: Issueまたはパイプラインチケットの全ライフサイクル。このスキルを最初に呼び出します。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

gener8v/gener8v.claude-skills.engineering

Find and run a project's test, lint, type-check, build and dev-server commands, read the results correctly, and seed a throwaway database when UI work needs realistic data. Never seeds the project's real or default database. Use before 'run the tests', 'lint this', 'does it build', 'start the app so I can see it', 'seed some demo data', and before you claim that a change works. Not for deployment or CI pipeline design; use the project's own deploy tooling for those.

gener8v/gener8v.claude-skills.engineering

Create or top up a project's documentation set: list what exists, let the user choose which document types to add, collect one shared fact sheet from the code, write the documents (in parallel when there are several), then check them against each other and against the code. Use when asked to 'bootstrap the docs', 'start the documentation', 'we have no README or ARCHITECTURE', or 'fill in the missing docs'. Not for the per-commit update of existing documents (documentation-sync), and not for gener8v pipeline documents (gener8v:brownfield and gener8v:planning make those).

gener8v/gener8v.claude-skills.engineering

Before a commit, find every document that describes what the change touched and update it in the same commit, or confirm in one line that no document needs a change. Catches stale text, missing documentation and facts kept in two places. Use before any commit or PR, and when asked 'are the docs up to date', 'update the docs for this change' or 'did I miss a README change'. Not for creating a documentation set or filling large gaps (documentation-bootstrap), and not for gener8v pipeline documents under .gener8v/, which the pipeline skills own.

gener8v/gener8v.claude-skills.engineering

Approval gate for git commands that destroy work or skip checks: force-push, --no-verify, signing bypass, reset --hard, clean -f, discarding uncommitted edits, branch or tag deletion, rewriting pushed commits and push --mirror. Each one needs the user's explicit approval at that moment; an earlier approval never carries over. Also covers a secrets check before a commit and what to do when a secret is already committed. Use before any of these commands, or when asked to 'force push', 'skip the hooks', 'throw away my changes' or 'delete that branch'. Not for normal branching (git-branching) or the PR flow (github-pr-merge).

関連スキル