askill
git-commit-push

git-commit-pushSafety 95Repository

Guidelines for creating AI-generated Git commits with proper format and attribution

3 stars
1.2k downloads
Updated 2/4/2026

Package Files

Loading files...
SKILL.md

Git Commit and Push Guidelines for AI Assistants

This skill defines the standards for creating Git commits when code changes are generated by AI assistants.

Commit Message Format

AI-generated commits MUST follow the Conventional Commits specification with detailed explanations and proper attribution.

Structure

<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>

Components

1. Header Line: <type>(<scope>): <summary>

Format: <type>(<scope>): <summary>

  • type: The kind of change (see Types section below)
  • scope: The module/component affected (e.g., meter, watcher, reporter)
  • summary: Brief description in imperative mood (50 chars max)

Example:

feat(meter): implement idempotent termination behavior

2. Detailed Body

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:

  • Use bullet points with - for main items
  • Indent sub-bullets with 2 spaces
  • Group related changes together
  • Include quantitative information (e.g., "86 test cases", "4 tests updated")
  • Mention specific class/method names for traceability

3. Test Coverage Information

After changes, include test validation results:

All 1710 Meter tests pass, confirming backward compatibility.

Guidelines:

  • State total number of tests executed
  • Confirm backward compatibility if applicable
  • Mention any new test coverage added

4. AI Attribution

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.

Commit Types

Use standard Conventional Commits types:

TypeDescriptionWhen to Use
featNew featureAdding new functionality, capabilities, or APIs
fixBug fixFixing a defect or incorrect behavior
refactorCode refactoringRestructuring code without changing behavior
perfPerformance improvementOptimizing performance or resource usage
testTest changesAdding/updating tests (no production code changes)
docsDocumentationAdding/updating documentation, comments, or README
styleCode styleFormatting, whitespace, code style (no logic changes)
choreMaintenanceBuild scripts, dependencies, tooling configuration
ciCI/CD changesGitHub Actions, build pipelines, automation
revertRevert previous commitUndoing a previous change

Scope Guidelines

Common scopes in slf4j-toys project:

  • meter - Meter class and related utilities
  • watcher - Watcher functionality
  • reporter - Reporter and diagnostic features
  • logger - LoggerFactory utilities
  • test - Test infrastructure and utilities
  • build - Build configuration and Maven
  • ci - CI/CD workflows

Complete Example

git 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"

Git Commands Workflow

1. Stage Files

# Stage specific files
git add path/to/file1.java path/to/file2.java

# Or stage all modified files
git add -u

2. Create Commit

# Use multi-line commit message
git commit -m "type(scope): summary

Detailed body...

Co-authored-by: GitHub Copilot using <model>"

3. Push Changes

# Push to current branch
git push

# Push to specific remote and branch
git push origin branch-name

Best Practices

DO:

  • ✅ Always include Co-authored-by attribution for AI-generated code
  • ✅ Provide comprehensive change descriptions
  • ✅ Include test coverage information
  • ✅ Use imperative mood in summary ("implement", not "implemented")
  • ✅ Keep summary line under 50 characters
  • ✅ Wrap body text at 72 characters
  • ✅ Separate concerns into multiple commits when appropriate
  • ✅ Reference issue numbers if applicable (e.g., "Fixes #123")

DON'T:

  • ❌ Mix unrelated changes in a single commit
  • ❌ Create commits without proper attribution
  • ❌ Use vague descriptions like "fix stuff" or "update code"
  • ❌ Skip test validation information
  • ❌ Forget to run tests before committing
  • ❌ Force push to protected branches (main)

PowerShell-Specific Considerations

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

Verification

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

Related Documentation

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

96/100Analyzed 2/10/2026

An exceptionally well-structured and actionable skill for AI-driven Git workflows. It provides clear templates, project-specific scopes, and platform-specific (PowerShell) commands, ensuring high-quality and consistent commit history.

95
100
85
100
100

Metadata

Licenseunknown
Version-
Updated2/4/2026
Publisheruseful-toys

Tags

ci-cdgithubgithub-actionsllmtesting