Create well-formatted git commit messages following conventional commits standard. This skill should be used after completing coding tasks to create clear, descriptive commit messages that accurately reflect changes.
Create clear, conventional commit messages that accurately describe changes and follow best practices.
Good commit messages are essential for project history and collaboration. This skill ensures commits follow the Conventional Commits standard and accurately describe the "why" behind changes.
Use this skill when:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixrefactor: Code restructuring without changing functionalityperf: Performance improvementdocs: Documentation changestest: Adding or updating testschore: Maintenance tasks (dependencies, build, etc.)style: Code formatting (no logic changes)ci: CI/CD configuration changes# Feature
git commit -m "feat(models): add ProgressiveDecoder with automatic cropping"
# Refactoring
git commit -m "refactor(optics): extract Telescope class to core/telescope.py"
# Performance
git commit -m "perf(transforms): vectorize FFT operations for 20% speedup"
# Documentation
git commit -m "docs(api): add comprehensive docstrings to telescope module"
# Bug fix
git commit -m "fix(telescope): correct mask centering calculation"
# Tests
git commit -m "test: add unit tests for telescope module"
# Chore
git commit -m "chore: remove dead code and commented blocks"
# Bad - vague
git commit -m "fix: update code"
# Good - specific
git commit -m "fix(telescope): correct aperture radius calculation for non-circular masks"
# Okay - describes what
git commit -m "refactor: split models.py into three files"
# Better - explains why
git commit -m "refactor(models): split into networks/losses/layers for better organization"
# Bad - past tense
git commit -m "Added type hints"
git commit -m "Fixed the bug"
# Good - imperative mood (command form)
git commit -m "Add type hints to telescope module"
git commit -m "Fix mask centering bug"
For complex changes, add a body:
git commit -m "$(cat <<'EOF'
refactor(optics): extract Grid class to core/grid.py
Extract Grid class from monolithic optics.py to improve module organization.
This is part of Phase 2 restructuring to create proper package hierarchy.
Changes:
- Create prism/core/grid.py with Grid class
- Update imports in optics.py
- Add Grid export to core/__init__.py
- Update tests to import from new location
Related to REFACTORING_PLAN.md Phase 2, Step 2.2
EOF
)"
Common scopes during refactoring:
core: Core modules (telescope, grid, propagators)models: Neural network modelsutils: Utility functionsconfig: Configuration systemviz: Visualizationtests: Test codeci: CI/CD configurationdeps: Dependencies# See what changed
git status
git diff
# Review staged changes
git diff --staged
# Stage specific files
git add prism/core/telescope.py
git add prism/core/__init__.py
# Stage all changes (use cautiously)
git add .
# Interactive staging
git add -p
Analyze the changes and determine:
# Simple commit
git commit -m "refactor(optics): extract Telescope class to core/telescope.py"
# With body (use heredoc for proper formatting)
git commit -m "$(cat <<'EOF'
refactor(models): split into networks, losses, and layers modules
Split monolithic models.py into focused modules:
- prism/models/networks.py: ProgressiveDecoder
- prism/models/losses.py: LossAgg
- prism/models/layers.py: CBatchNorm, ComplexAct, CropPad
Improves code organization and maintainability.
EOF
)"
Use ! and BREAKING CHANGE: footer:
git commit -m "$(cat <<'EOF'
refactor(config)!: replace argparse with dataclass configuration
BREAKING CHANGE: Command-line arguments have changed.
Use YAML config files instead of CLI args.
See configs/default.yaml for examples.
Migration guide in docs/MIGRATION.md
EOF
)"
git commit -m "fix(telescope): correct SNR calculation
Fixes #42
For pair programming or AI-assisted code:
git commit -m "$(cat <<'EOF'
feat(visualization): add publication-quality plotting
Add matplotlib publication style with LaTeX support.
Co-Authored-By: Claude <[email protected]>
EOF
)"
If commit message needs correction:
# Amend last commit message
git commit --amend -m "refactor(optics): extract Telescope class to core/telescope.py"
# Amend and add more changes
git add forgotten_file.py
git commit --amend --no-edit
Warning: Only amend commits that haven't been pushed!
Good commit checklist:
# Phase 1: Cleanup