L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Développement · SKILL.md

conventional-commit-gen

conventional-commit-gen

Analyzes git diff to generate commit messages following the Conventional Commits spec, with automatic scope detection and commit type inference. Trigger when users ask to write or generate a commit message, mention Conventional Commits, git commits, standardized commits, scope detection, or phrases like 'help me write a commit message'.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: conventional-commit-gen description: "Analyzes git diff to generate commit messages following the Conventional Commits spec, with automatic scope detection and commit type inference. Trigger when users ask to write or generate a commit message, mention Conventional Commits, git commits, standardized commits, scope detection, or phrases like 'help me write a commit message'." type: tool license: MIT tags:

  • git
  • conventional-commits
  • devops
  • productivity

Conventional Commit Gen

Analyzes the current git diff and automatically generates a commit message that follows the Conventional Commits specification, with smart scope detection.

Quick Start

# Analyze unstaged changes and generate a commit message
python3 scripts/analyze_diff.py

# Analyze staged changes only
python3 scripts/analyze_diff.py --staged

# Specify a repository path
python3 scripts/analyze_diff.py --repo /path/to/repo

# JSON output (useful for programmatic integration)
python3 scripts/analyze_diff.py --staged --format json

# Manually override type or scope
python3 scripts/analyze_diff.py --staged --type-override feat --scope-override auth

Usage Workflow (SOP)

1. Get the Diff Analysis

Run the script in the user's git repository to get the automated analysis:

python3 scripts/analyze_diff.py --staged --format json

2. Review and Adjust

The script outputs:

  • type: The auto-detected commit type (feat / fix / docs / style / refactor / test / chore / perf / ci / build)
  • scope: The scope detected from file paths (e.g., auth, api, ui)
  • description: A brief description generated from the change summary
  • commit_message: The fully assembled commit message

After reviewing the output, adjust as needed:

  • If the type is inaccurate (e.g., the script detected chore but it's actually a feat), use --type-override to override
  • If the scope doesn't fit, use --scope-override to override
  • The description should ideally be hand-written based on the actual changes; treat the script output as a starting point

Note: Type detection is based on file paths and change statistics. It works well for types like test/docs/ci/build, but for modifications to existing source code files (feat vs fix vs refactor), you should read the diff content and make the final call.

3. Conventional Commits Reference

<type>(<scope>): <description>

[optional body]

[optional footer(s)]
TypeMeaning
featA new feature
fixA bug fix
docsDocumentation changes
styleCode formatting (no logic changes)
refactorRefactoring (no new features or bug fixes)
testTest-related changes
choreBuild/tooling/dependency maintenance
perfPerformance improvements
ciCI/CD configuration changes
buildBuild system or external dependency changes

4. Breaking Changes

If the change includes a breaking change, add ! after the type:

feat(api)!: change authentication endpoint response format

Parameters

ParameterDescriptionDefault
--repoPath to the git repository.
--stagedAnalyze staged changes onlyNo
--formatOutput format: text or jsontext
--type-overrideManually specify the commit type, skipping auto-detectionNone
--scope-overrideManually specify the scope, skipping auto-detectionNone

Prerequisites

  • Python 3.6+
  • git installed and available in PATH
  • Current directory or --repo points to a valid git repository
Skills enregistrées