Back to list
ShunsukeHayashi

git-workflow-with-conventional-commits

by ShunsukeHayashi

🤖 First open-source, economically-governed, beginner-friendly autonomous development framework built on Issue-Driven Development | 超初心者でも使える自律型開発フレームワーク

13🍴 8📅 Jan 24, 2026

SKILL.md


name: Git Workflow with Conventional Commits description: Automated Git workflow including staging, committing with Conventional Commits format, PR creation, and merging. Use when committing changes, creating PRs, or managing Git branches. allowed-tools: Bash, Read, Grep, Glob

📝 Git Workflow with Conventional Commits

Version: 2.0.0 Last Updated: 2025-11-22 Priority: ⭐⭐⭐⭐⭐ (P0 Level) Purpose: Conventional Commits準拠のGitワークフロー自動化


📋 概要

Conventional Commits仕様とMiyabiのPRガイドラインに従った 完全なGitワークフロー自動化を提供します。


🎯 P0: 呼び出しトリガー

トリガー
コミット"commit these changes"
PR作成"create a PR"
マージ"merge this branch"
機能完了後"after completing feature"
レビュー対応後"after review feedback"

🔧 P1: Conventional Commits形式

コミットメッセージ構造

<type>(<scope>): <subject>

<body>

<footer>

Type一覧(優先順位順)

Type用途頻度
feat新機能feat(auth): add OAuth2 login
fixバグ修正fix(api): resolve null pointer
docsドキュメントdocs(readme): update install guide
refactorリファクタリングrefactor(parser): simplify logic
testテストtest(unit): add auth tests
choreメンテナンスchore(deps): update tokio
styleフォーマットstyle(lint): fix clippy warnings
perfパフォーマンスperf(db): add index
ciCI/CDci(workflow): add clippy check
buildビルドbuild(cargo): update Cargo.lock
revertリバートrevert: feat(auth)

Scope一覧

Scope対象
auth認証・認可
apiAPIエンドポイント
dbデータベース
uiユーザーインターフェース
cliコマンドライン
agentAgentシステム
worktreeWorktree管理
deps依存関係

🚀 P2: ワークフロー別パターン

Pattern 1: 標準コミット

# Step 1: 状態確認
git status && git diff --name-status

# Step 2: ステージング
git add <files>

# Step 3: コミット(HEREDOC必須)
git commit -m "$(cat <<'EOF'
feat(agent): add CodeGenAgent implementation

Implement CodeGenAgent for AI-driven code generation:
- Add BaseAgent trait implementation
- Support for Rust, TypeScript, Python
- Automatic test generation

Closes #270

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"

# Step 4: プッシュ
git push -u origin feature/270-codegen-agent

Pattern 2: PR作成

# GitHub CLI使用
gh pr create \
  --title "feat(agent): Issue #270 - Add CodeGenAgent" \
  --body "$(cat <<'EOF'
## Summary
Implements CodeGenAgent for AI-driven code generation.

## Changes
- ✅ Add `crates/miyabi-agents/src/codegen.rs`
- ✅ Implement BaseAgent trait
- ✅ Add unit tests (85% coverage)

## Test Plan
- [x] Unit tests pass
- [x] Clippy warnings resolved
- [x] Format check passed

## Related Issues
Closes #270

## Quality Report
- **Score**: 85/100 ✅
- **Coverage**: 85%

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)" \
  --draft

Pattern 3: マージ戦略

戦略コマンド用途
Squash(推奨)gh pr merge --squash --delete-branch大半のPR
Mergegh pr merge --merge --delete-branch大規模機能
Rebasegh pr merge --rebase --delete-branch単一コミットPR

⚡ P3: ブランチ命名規則

形式

<type>/<issue-number>-<brief-description>

Type
featurefeature/270-codegen-agent
fixfix/271-worktree-race-condition
docsdocs/272-update-skills
refactorrefactor/273-cleanup-types
testtest/274-add-integration-tests
chorechore/275-update-deps

📊 Worktree固有ワークフロー

Worktree作成からマージまで

# Step 1: Worktree作成
git worktree add .worktrees/issue-270 -b feature/270-codegen-agent

# Step 2: Worktree内で作業
cd .worktrees/issue-270
# ... 変更 ...
git add .
git commit -m "feat(agent): add CodeGenAgent"

# Step 3: プッシュ
git push -u origin feature/270-codegen-agent

# Step 4: PR作成
gh pr create --title "feat(agent): Issue #270" --draft

# Step 5: クリーンアップ(マージ後)
cd ../..
git worktree remove .worktrees/issue-270
git push origin --delete feature/270-codegen-agent
git branch -d feature/270-codegen-agent

🛡️ エラーハンドリング

Pre-commit Hook対応

# Hook変更確認
git status

# Hook変更をamend
git add .
git commit --amend --no-edit
git push --force-with-lease

マージコンフリクト

# コンフリクト確認
git status
git diff

# 解決後
git add <resolved-files>
git merge --continue
# または
git rebase --continue

誤ったブランチへのコミット

# 最後のコミット取り消し(変更は保持)
git reset --soft HEAD~1

# 正しいブランチへ移動
git checkout correct-branch

# 再コミット
git add .
git commit -m "Your message"

シークレットの誤コミット

# ファイルをコミットから削除
git rm --cached path/to/secret-file
git commit --amend --no-edit
git push --force-with-lease

# 古いコミットの場合: git-filter-repo使用

✅ チェックリスト

コミット前

  • テスト合格 (cargo test)
  • Clippy警告なし (cargo clippy)
  • フォーマット済み (cargo fmt)
  • シークレットなし
  • Conventional Commits準拠
  • 変更がIssue要件に一致
  • ドキュメント更新(必要時)

PR作成前

  • タイトルが規約に準拠
  • 説明が完全
  • CI合格
  • コンフリクトなし
  • レビュアー割り当て
  • ラベル付与
  • Issue紐付け (Closes #XXX)

🔗 関連ドキュメント

ドキュメント用途
agents/specs/coding/pr-agent.mdPRAgent仕様
docs/WORKTREE_PROTOCOL.mdWorktreeプロトコル
docs/LABEL_SYSTEM_GUIDE.mdラベルシステム
.gitignore除外ファイル

📝 関連Skills

  • Agent Execution: Worktree経由のブランチ作成
  • Rust Development: コミット前テスト
  • Issue Analysis: コミットtype/scope決定

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon