SuperAPI AI Directory

git workflow with conventional commits

Coding & development

View repository

Updated 10-16 04:38

About this skill

📝 Git Workflow with Conventional Commits

Version: 2.0.0 Last Updated: 2025-11-22 Priority: ⭐⭐⭐⭐⭐ (P0 Level) Purpose: Git workflow automation compliant with Conventional Commits


📋 Overview

Provides complete Git workflow automation following the Conventional Commits specification and Miyabi's PR guidelines.


🎯 P0: Invocation Triggers

Trigger Example
Commit "commit these changes"
PR creation "create a PR"
Merge "merge this branch"
After feature completion "after completing feature"
After review response "after review feedback"

🔧 P1: Conventional Commits Format

Commit message structure

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

<body>

<footer>

Type list (in order of priority)

Type Purpose Frequency Example
feat New feature High feat(auth): add OAuth2 login
fix Bug fix High fix(api): resolve null pointer
docs Documentation Medium docs(readme): update install guide
refactor Refactoring Medium refactor(parser): simplify logic
test Tests Medium test(unit): add auth tests
chore Maintenance Low chore(deps): update tokio
style Formatting Low style(lint): fix clippy warnings
perf Performance Low perf(db): add index
ci CI/CD Low ci(workflow): add clippy check
build Build Low build(cargo): update Cargo.lock
revert Revert Rare revert: feat(auth)

Scope list

Scope Target
auth Authentication/Authorization
api API endpoint
db Database
ui User interface
cli Command line
agent Agent system
worktree Worktree management
deps Dependencies

🚀 P2: Patterns by Workflow

Pattern 1: Standard commit

# 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 creation

# 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: Merge strategy

Strategy Command Purpose
Squash (recommended) gh pr merge --squash --delete-branch Most PRs
Merge gh pr merge --merge --delete-branch Large-scale features
Rebase gh pr merge --rebase --delete-branch Single-commit PRs

⚡ P3: Branch Naming Convention

Format

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

Example

Type Example
feature feature/270-codegen-agent
fix fix/271-worktree-race-condition
docs docs/272-update-skills
refactor refactor/273-cleanup-types
test test/274-add-integration-tests
chore chore/275-update-deps

📊 Worktree-Specific Workflow

From Worktree creation to merge

# 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

🛡️ Error Handling

Pre-commit Hook Handling

# Hook変更確認
git status

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

Merge conflicts

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

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

Committing to the wrong branch

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

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

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

Accidentally committing secrets

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

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

✅ Checklist

Before committing

  • Tests pass (cargo test)
  • No Clippy warnings (cargo clippy)
  • Formatted (cargo fmt)
  • No secrets
  • Conventional Commits compliant
  • Changes match Issue requirements
  • Documentation updated (when necessary)

Before creating a PR

  • Title complies with the convention
  • Description is complete
  • CI passes
  • No conflicts
  • Reviewers assigned
  • Labels applied
  • Issue Linking (Closes #XXX)

🔗 Related Documents

Documents Purpose
agents/specs/coding/pr-agent.md PRAgent Specification
docs/WORKTREE_PROTOCOL.md Worktree Protocol
docs/LABEL_SYSTEM_GUIDE.md Label System
.gitignore Excluded Files

📝 Related Skills

  • Agent Execution: Branch creation via Worktree
  • Rust Development: Pre-commit tests
  • Issue Analysis: Commit type/scope determination