jpskill.com
🛠️ 開発・MCP コミュニティ

git-workflow-enforcer

Ensures commits follow conventional commits, branch naming conventions, and PR templates. Use when creating commits, branches, or PRs, or when user mentions git workflow.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o git-workflow-enforcer.zip https://jpskill.com/download/18108.zip && unzip -o git-workflow-enforcer.zip && rm git-workflow-enforcer.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18108.zip -OutFile "$d\git-workflow-enforcer.zip"; Expand-Archive "$d\git-workflow-enforcer.zip" -DestinationPath $d -Force; ri "$d\git-workflow-enforcer.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して git-workflow-enforcer.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → git-workflow-enforcer フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Git Workflow Enforcer

一貫性のある Git ワークフロー(コミットメッセージ、ブランチ命名、PR プロセスなど)を強制します。

どのような時に使うか

  • コミットまたはブランチの作成時
  • コードレビューまたは PR 作成時
  • ユーザーが "git workflow"、"commit message"、"branch naming"、または "pull request" に言及した場合

手順

1. 既存の慣習の検出

以下を確認します。

  • .github/ または .gitlab/ テンプレート
  • CONTRIBUTING.md
  • 既存のコミットメッセージのパターン
  • ブランチ命名のパターン

2. Conventional Commits

フォーマット: type(scope): description

種類:

  • feat: 新機能
  • fix: バグ修正
  • docs: ドキュメント
  • style: フォーマット、セミコロンの欠落
  • refactor: コードの再構成
  • perf: パフォーマンスの改善
  • test: テストの追加
  • chore: メンテナンス、依存関係

例:

feat(auth): add OAuth2 login support
fix(api): handle null response in user endpoint
docs(readme): update installation instructions
refactor(utils): simplify date formatting logic

3. ブランチ命名

一般的なパターン:

feature/user-authentication
bugfix/login-error-handling
hotfix/critical-security-patch
release/v1.2.0
chore/update-dependencies

検証:

  • 小文字でハイフン区切り
  • 種類で始まる
  • 説明的な名前
  • 該当する場合は issue 番号: feature/123-add-dark-mode

4. コミットメッセージの検証

良いコミット:

feat(payments): integrate Stripe payment gateway

- Add Stripe SDK configuration
- Implement payment intent creation
- Add webhook handler for payment events
- Update tests for payment flow

Closes #456

以下を確認:

  • Subject 行が 50 文字以下
  • Body が 72 文字で折り返し
  • Subject と Body の間に空行
  • 命令形 ("add" ではなく "added")
  • issue/チケットへの参照

5. PR テンプレート

.github/PULL_REQUEST_TEMPLATE.md を作成します。

## Description
<!-- What does this PR do? -->

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing
<!-- How was this tested? -->

## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex code
- [ ] Documentation updated
- [ ] Tests added/updated
- [ ] All tests passing
- [ ] No new warnings

## Related Issues
Closes #

6. コミットフック

Pre-commit:

#!/bin/sh
# .git/hooks/pre-commit

# Run linter
npm run lint

# Run tests
npm test

# Check for sensitive data
if git diff --cached | grep -i "password\|api_key\|secret"; then
  echo "Error: Possible sensitive data detected"
  exit 1
fi

Commit-msg:

#!/bin/sh
# .git/hooks/commit-msg

commit_msg=$(cat "$1")

# Check conventional commit format
if ! echo "$commit_msg" | grep -qE "^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .+"; then
  echo "Error: Commit message must follow Conventional Commits format"
  echo "Example: feat(auth): add login feature"
  exit 1
fi

7. 既存のコミットの検証

最近のコミットがパターンに従っているか確認します。

git log --oneline -20 | grep -v "^[a-f0-9]\{7\} (feat|fix|docs|style|refactor|perf|test|chore)"

8. 変更履歴の生成

Conventional Commits から生成します。

# Using standard-version
npx standard-version

# Or manually group by type
git log --pretty=format:"%s" | grep "^feat" > features.txt
git log --pretty=format:"%s" | grep "^fix" > fixes.txt

9. 保護されたブランチ

GitHub の設定:

  • PR レビューを必須にする
  • ステータスチェックを必須にする
  • 署名付きコミットを必須にする
  • プッシュできるユーザーを制限する
  • リニアな履歴を必須にする

10. ベストプラクティス

  • Atomic commits: コミットごとに 1 つの論理的な変更
  • Descriptive messages: 何をしたかではなく、なぜしたかを説明する
  • Frequent commits: 大きく稀なコミットよりも、小さく頻繁なコミット
  • Clean history: マージ前に squash/rebase を行う
  • Sign commits: セキュリティのために GPG 署名を行う
  • Reference issues: 追跡システムへのリンク

Git コミットテンプレート

.gitmessage を作成します。

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

<body>

<footer>

# Type: feat, fix, docs, style, refactor, perf, test, chore
# Scope: component or file affected
# Subject: imperative, lowercase, no period, ≤50 chars
# Body: explain what and why, not how, wrapped at 72 chars
# Footer: breaking changes, issue references

テンプレートとして設定します。

git config --global commit.template ~/.gitmessage

サポートファイル

  • templates/PULL_REQUEST_TEMPLATE.md
  • templates/commit-msg-hook.sh
  • templates/.gitmessage
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Git Workflow Enforcer

Enforces consistent Git workflows including commit messages, branch naming, and PR processes.

When to Use

  • Creating commits or branches
  • Code review or PR creation
  • User mentions "git workflow", "commit message", "branch naming", or "pull request"

Instructions

1. Detect Existing Conventions

Check for:

  • .github/ or .gitlab/ templates
  • CONTRIBUTING.md
  • Existing commit message patterns
  • Branch naming patterns

2. Conventional Commits

Format: type(scope): description

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation
  • style: Formatting, missing semicolons
  • refactor: Code restructuring
  • perf: Performance improvement
  • test: Adding tests
  • chore: Maintenance, dependencies

Examples:

feat(auth): add OAuth2 login support
fix(api): handle null response in user endpoint
docs(readme): update installation instructions
refactor(utils): simplify date formatting logic

3. Branch Naming

Common patterns:

feature/user-authentication
bugfix/login-error-handling
hotfix/critical-security-patch
release/v1.2.0
chore/update-dependencies

Validate:

  • Lowercase with hyphens
  • Prefixed with type
  • Descriptive name
  • Issue number if applicable: feature/123-add-dark-mode

4. Commit Message Validation

Good commit:

feat(payments): integrate Stripe payment gateway

- Add Stripe SDK configuration
- Implement payment intent creation
- Add webhook handler for payment events
- Update tests for payment flow

Closes #456

Check for:

  • Subject line ≤50 characters
  • Body wrapped at 72 characters
  • Blank line between subject and body
  • Imperative mood ("add" not "added")
  • Reference to issue/ticket

5. PR Template

Create .github/PULL_REQUEST_TEMPLATE.md:

## Description
<!-- What does this PR do? -->

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing
<!-- How was this tested? -->

## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex code
- [ ] Documentation updated
- [ ] Tests added/updated
- [ ] All tests passing
- [ ] No new warnings

## Related Issues
Closes #

6. Commit Hooks

Pre-commit:

#!/bin/sh
# .git/hooks/pre-commit

# Run linter
npm run lint

# Run tests
npm test

# Check for sensitive data
if git diff --cached | grep -i "password\|api_key\|secret"; then
  echo "Error: Possible sensitive data detected"
  exit 1
fi

Commit-msg:

#!/bin/sh
# .git/hooks/commit-msg

commit_msg=$(cat "$1")

# Check conventional commit format
if ! echo "$commit_msg" | grep -qE "^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .+"; then
  echo "Error: Commit message must follow Conventional Commits format"
  echo "Example: feat(auth): add login feature"
  exit 1
fi

7. Validate Existing Commits

Check recent commits for pattern adherence:

git log --oneline -20 | grep -v "^[a-f0-9]\{7\} (feat|fix|docs|style|refactor|perf|test|chore)"

8. Generate Changelog

From conventional commits:

# Using standard-version
npx standard-version

# Or manually group by type
git log --pretty=format:"%s" | grep "^feat" > features.txt
git log --pretty=format:"%s" | grep "^fix" > fixes.txt

9. Protected Branches

GitHub settings:

  • Require PR reviews
  • Require status checks
  • Require signed commits
  • Restrict who can push
  • Require linear history

10. Best Practices

  • Atomic commits: One logical change per commit
  • Descriptive messages: Explain why, not what
  • Frequent commits: Small, frequent over large, rare
  • Clean history: Squash/rebase before merge
  • Sign commits: GPG signature for security
  • Reference issues: Link to tracking system

Git Commit Template

Create .gitmessage:

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

<body>

<footer>

# Type: feat, fix, docs, style, refactor, perf, test, chore
# Scope: component or file affected
# Subject: imperative, lowercase, no period, ≤50 chars
# Body: explain what and why, not how, wrapped at 72 chars
# Footer: breaking changes, issue references

Set as template:

git config --global commit.template ~/.gitmessage

Supporting Files

  • templates/PULL_REQUEST_TEMPLATE.md
  • templates/commit-msg-hook.sh
  • templates/.gitmessage