Guidelines for creating AI-generated Git commits with proper format and attribution
This skill defines the standards for creating Git commits when code changes are generated by AI assistants.
AI-generated commits MUST follow the Conventional Commits specification with detailed explanations and proper attribution.
<type>(<scope>): <summary>
<blank line>
<detailed body explaining the changes>
<blank line>
<test coverage information>
<blank line>
Co-authored-by: GitHub Copilot using <model name>
<type>(<scope>): <summary>Format: <type>(<scope>): <summary>
meter, watcher, reporter)Example:
feat(meter): implement idempotent termination behavior
After a blank line, provide a comprehensive explanation:
First Paragraph: High-level description of what changed and why
Meter termination methods (ok, reject, fail) now properly handle repeated
termination attempts by preserving the first termination state.
Changes Section: Bulleted list of technical changes
Changes:
- MeterValidator.validateStopPrecondition() now returns boolean instead of void
- Returns false when meter already stopped (blocks re-termination)
- Returns true otherwise (allows termination with warnings)
- Meter.commonOk(), reject(), fail() methods now check validation result
- Early return when meter already stopped, preserving first termination
- Updated 86 test cases to verify idempotent behavior
- MeterValidatorTest: 4 tests updated to capture boolean return
- MeterLogBugTest: 6 tests updated for exception handling
- MeterLifeCyclePreStartTerminatedPostStopInvalidTerminationTest: 28 tests
updated to verify first termination wins
Guidelines for Changes Section:
- for main itemsAfter changes, include test validation results:
All 1710 Meter tests pass, confirming backward compatibility.
Guidelines:
REQUIRED: Every AI-generated commit must include proper attribution:
Co-authored-by: GitHub Copilot using <model name>
Where <model name> is the specific AI model used (e.g., Claude Sonnet 4.5, GPT-4, Claude Haiku 4.5).
Why: This provides transparency about AI assistance and maintains proper attribution standards.
Use standard Conventional Commits types:
| Type | Description | When to Use |
|---|---|---|
feat |
New feature | Adding new functionality, capabilities, or APIs |
fix |
Bug fix | Fixing a defect or incorrect behavior |
refactor |
Code refactoring | Restructuring code without changing behavior |
perf |
Performance improvement | Optimizing performance or resource usage |
test |
Test changes | Adding/updating tests (no production code changes) |
docs |
Documentation | Adding/updating documentation, comments, or README |
style |
Code style | Formatting, whitespace, code style (no logic changes) |
chore |
Maintenance | Build scripts, dependencies, tooling configuration |
ci |
CI/CD changes | GitHub Actions, build pipelines, automation |
revert |
Revert previous commit | Undoing a previous change |
Common scopes in slf4j-toys project:
meter - Meter class and related utilitieswatcher - Watcher functionalityreporter - Reporter and diagnostic featureslogger - LoggerFactory utilitiestest - Test infrastructure and utilitiesbuild - Build configuration and Mavenci - CI/CD workflowsgit commit -m "feat(meter): implement idempotent termination behavior
Meter termination methods (ok, reject, fail) now properly handle repeated
termination attempts by preserving the first termination state.
Changes:
- MeterValidator.validateStopPrecondition() now returns boolean instead of void
- Returns false when meter already stopped (blocks re-termination)
- Returns true otherwise (allows termination with warnings)
- Meter.commonOk(), reject(), fail() methods now check validation result
- Early return when meter already stopped, preserving first termination
- Updated 86 test cases to verify idempotent behavior
- MeterValidatorTest: 4 tests updated to capture boolean return
- MeterLogBugTest: 6 tests updated for exception handling
- MeterLifeCyclePreStartTerminatedPostStopInvalidTerminationTest: 28 tests
updated to verify first termination wins
All 1710 Meter tests pass, confirming backward compatibility.
Co-authored-by: GitHub Copilot using Claude Sonnet 4.5"
# Stage specific files
git add path/to/file1.java path/to/file2.java
# Or stage all modified files
git add -u
# Use multi-line commit message
git commit -m "type(scope): summary
Detailed body...
Co-authored-by: GitHub Copilot using <model>"
# Push to current branch
git push
# Push to specific remote and branch
git push origin branch-name
When creating multi-line commit messages in PowerShell, you may need to handle line breaks carefully:
Option 1: Use backticks for line continuation:
git commit -m "feat(scope): summary`n`nBody text`n`nCo-authored-by: GitHub Copilot using Claude Sonnet 4.5"
Option 2: Use here-strings:
$commitMessage = @"
feat(scope): summary
Body text
Co-authored-by: GitHub Copilot using Claude Sonnet 4.5
"@
git commit -m $commitMessage
Option 3: Interactive commit editor:
# Opens default editor for commit message
git commit
After committing, verify the commit message format:
# View last commit message
git log -1 --pretty=format:"%B"
# View last commit with stats
git show --stat