Générateur de messages de commit

Analyse les modifications indexées et génère des messages de commit conventionnels. Supporte Conventional Commits, style GitHub et formats personnalisés.

Spar Skills Guide Bot
DeveloppementIntermédiaire
1022/07/2026
Claude CodeCursorWindsurfCopilotCodex
#commit-message#conventional-commits#git#code-quality#version-control

Recommandé pour

Commit Message Generator

Description

Analyze staged changes and generate conventional commit messages. Supports Conventional Commits, GitHub-style, and custom formats. Can also review existing commit history for consistency.

Triggers

  • "Generate commit message", "Write commit message", "Commit this"
  • "What should I commit?", "Review my changes"
  • "Commit message for this PR", "Squash and rewrite commits"

Instructions

Step 1: Analyze Changes

  1. Run git diff --cached to see staged changes
  2. If nothing staged, run git diff and git status to show unstaged changes
  3. For PR reviews, use git log --oneline origin/main..HEAD to see all commits

Step 2: Categorize Changes

Map changes to conventional commit types:

  • feat: New feature, new API endpoint, new component
  • fix: Bug fix, error handling, edge case
  • refactor: Code restructure without behavior change
  • perf: Performance improvement
  • docs: Documentation only
  • style: Formatting, whitespace, semicolons
  • test: Adding/updating tests
  • chore: Build, CI, dependencies, tooling
  • ci: CI/CD configuration changes
  • revert: Reverting a previous commit

Step 3: Generate Message

Format (Conventional Commits):

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

<body>

<footer>

Rules:

  • Subject: imperative mood, lowercase, no period, max 72 chars
  • Body: explain what and why, not how, wrap at 72 chars
  • Footer: breaking changes (BREAKING CHANGE:), issue refs (Closes #123)
  • If multiple unrelated changes, suggest splitting into separate commits

Step 4: Multi-commit Suggestion

If staged changes span multiple concerns:

Suggested split:
1. feat(auth): add OAuth2 login flow
2. fix(api): handle null response in user endpoint
3. chore(deps): update axios to 1.7.0

Run these commands:
  git reset HEAD
  git add src/auth/oauth.py
  git commit -m "feat(auth): add OAuth2 login flow"
  git add src/api/users.py
  git commit -m "fix(api): handle null response in user endpoint"
  git add package.json package-lock.json
  git commit -m "chore(deps): update axios to 1.7.0"

PR Description Mode

When asked to write a PR description:

  1. Read all commits in the branch
  2. Categorize by type
  3. Generate:
    • Summary (2-3 sentences)
    • Changes (grouped by category)
    • Testing notes
    • Breaking changes (if any)
    • Checklist

Output Format

Provide 3 options: concise (subject only), standard (subject + body), detailed (subject + body + footer). Default to standard unless user specifies otherwise.

Constraints

  • Never auto-commit without user confirmation
  • For sensitive changes (secrets, auth), add a warning in the footer
  • If changes are too large (>20 files), suggest a descriptive PR instead
Skills similaires