Workflow Git Commit

VérifiéSûr

Automatise la création de commits Git bien formatés : sélectionne les fichiers à staguer (hors .env, .pyc, etc.), exécute les hooks pre-commit (ruff, gitleaks) et génère un message conventionnel. Idéal pour garantir une historique de commits propre et sécurisé dans tout projet utilisant les Conventional Commits.

Spar Skills Guide Bot
DeveloppementIntermédiaire
7002/06/2026
Claude Code
#git#commit#conventional-commits#pre-commit

Recommandé pour

Notre avis

Crée un commit git propre et bien formaté avec un staging sélectif, des hooks de pré-commit et des messages de commit conventionnels.

Points forts

  • Applique les commits conventionnels
  • Gère les échecs de hooks avec élégance
  • Empêche les commits accidentels de fichiers sensibles
  • Fournit un workflow clair étape par étape

Limites

  • Nécessite que les hooks de pré-commit soient configurés
  • Peut ne pas gérer les conflits de fusion
  • Ne pousse pas automatiquement
Quand l'utiliser

Utilisez cette compétence lorsque vous devez créer un commit bien documenté suivant les conventions du projet.

Quand l'éviter

Évitez si vous avez besoin d'un commit rapide et informel sans formatage conventionnel.

Analyse de sécurité

Sûr
Score qualité92/100

The skill only runs standard git commands and pre-commit hooks (ruff, ruff-format, gitleaks) already present in the project. It explicitly excludes sensitive files from being staged and does not instruct destructive or exfiltrating actions. No external scripts are executed, and no secrets are exposed.

Aucun point d'attention détecté

Exemples

Commit staged changes with conventional message
I've made some changes to the RAG module. Can you commit them? The changes are: added author filtering to Qdrant search.
Commit all changes (todo)
Commit all changes with a message about fixing the inference endpoint.
Commit with specific files
Commit these files: application/rag/search.py, tests/test_rag.py with a chore message.

name: commit description: Stage changes, run pre-commit hooks, and create a well-formatted git commit allowed-tools: Bash, Read, Grep, Glob

Git Commit Workflow

Create a clean, well-documented git commit following this project's conventions.

Step 1: Review changes

git status
git diff --stat

Show the user a summary of what will be committed.

Step 2: Stage files

Stage files selectively (never git add . or git add -A blindly):

# Stage specific files
git add <file1> <file2> ...

Files to NEVER commit

| Pattern | Reason | |---------|--------| | .env | Contains HUGGINGFACE_ACCESS_TOKEN | | *.pyc, __pycache__/ | Compiled Python | | .DS_Store | macOS junk | | model_output/ | Downloaded models | | data/eval_results/ | Generated evaluation data | | output/ | Pipeline outputs | | .claude/settings.local.json | Personal Claude settings | | .claude/CLAUDE.local.md | Personal Claude memory |

If $ARGUMENTS says "all" or "todo", stage all modified/untracked files except those above.

Step 3: Pre-commit hooks

This project has pre-commit hooks configured in .pre-commit-config.yaml:

  • ruff (linter) - auto-fixes code style
  • ruff-format (formatter) - auto-formats code
  • gitleaks - scans for leaked secrets

If a hook fails:

  1. The commit is aborted (it did NOT happen)
  2. Fix the issues (ruff usually auto-fixes, just re-stage)
  3. Create a NEW commit (never --amend after a hook failure - that would modify the wrong commit)

Step 4: Commit message format

Use Conventional Commits:

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

[optional body]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Types

| Type | When to use | |------|-------------| | feat | New feature or functionality | | fix | Bug fix | | docs | Documentation changes (README, CLAUDE.md, comments) | | refactor | Code restructuring without behavior change | | chore | Maintenance (deps, configs, cleanup) | | style | Formatting, linting (no logic change) | | test | Adding or modifying tests | | perf | Performance improvements | | ci | CI/CD changes |

Scopes (optional, use the most relevant)

| Scope | Files | |-------|-------| | inference | model/inference/, infrastructure/inference_pipeline_api.py | | rag | application/rag/ | | eval | model/evaluation/ | | training | model/finetuning/ | | etl | application/crawlers/, configs/digital_data_etl_* | | dataset | application/dataset/ | | settings | settings.py, .env, configs/ | | deps | pyproject.toml, poetry.lock | | infra | docker-compose.yml, ZenML configs |

Examples

feat(rag): Add author filtering to Qdrant search
fix(inference): Add task parameter to HuggingFaceEndpoint
docs: Rewrite README for local-only setup
chore(deps): Upgrade langchain-huggingface to 1.2.0
refactor(eval): Replace OpenAI judge with HuggingFace

Step 5: Create the commit

Use HEREDOC for proper message formatting:

git commit -m "$(cat <<'EOF'
<type>(<scope>): <description>

<body if needed>

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

Step 6: Verify

git log --oneline -3

Show the user the new commit hash and message.

After the commit

Do NOT push automatically. Tell the user they can push with /push or git push.

If pre-commit hook fails

  1. Check what failed: usually ruff auto-fixed files
  2. Re-stage the auto-fixed files: git add <fixed-files>
  3. Create a NEW commit (do NOT use --amend)
  4. If gitleaks fails: a secret was detected. Remove it from the staged files before retrying.
Skills similaires