Skip to content

Commit 465fe56

Browse files
authored
feat(git-commit): add git-commit skill documentation and configuration (#188)
### Linked issue <!-- No linked issue --> ### Context Adds the \`git-commit\` agent skill sourced from \`github/awesome-copilot\`, enabling Copilot to generate conventional commit messages intelligently from diffs within this project. ### Description - Introduced \`.agents/skills/git-commit/SKILL.md\` — full skill definition for executing git commits using the Conventional Commits specification. Covers type/scope detection, intelligent file staging, interactive overrides, and footer generation (breaking changes, issue refs). - Added \`skills-lock.json\` — registers the skill with its source, path, and integrity hash so the skill runtime can resolve and verify it reproducibly. The skill is invoked when the user asks to commit changes or uses \`/commit\`. It auto-detects the conventional type and scope from the diff, generates a message, and supports interactive overrides before committing.
2 parents a926386 + bf08911 commit 465fe56

2 files changed

Lines changed: 135 additions & 0 deletions

File tree

.agents/skills/git-commit/SKILL.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: git-commit
3+
description: 'Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping'
4+
license: MIT
5+
allowed-tools: Bash
6+
---
7+
8+
# Git Commit with Conventional Commits
9+
10+
## Overview
11+
12+
Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.
13+
14+
## Conventional Commit Format
15+
16+
```
17+
<type>[optional scope]: <description>
18+
19+
[optional body]
20+
21+
[optional footer(s)]
22+
```
23+
24+
## Commit Types
25+
26+
| Type | Purpose |
27+
| ---------- | ------------------------------ |
28+
| `feat` | New feature |
29+
| `fix` | Bug fix |
30+
| `docs` | Documentation only |
31+
| `style` | Formatting/style (no logic) |
32+
| `refactor` | Code refactor (no feature/fix) |
33+
| `perf` | Performance improvement |
34+
| `test` | Add/update tests |
35+
| `build` | Build system/dependencies |
36+
| `ci` | CI/config changes |
37+
| `chore` | Maintenance/misc |
38+
| `revert` | Revert commit |
39+
40+
## Breaking Changes
41+
42+
```
43+
# Exclamation mark after type/scope
44+
feat!: remove deprecated endpoint
45+
46+
# BREAKING CHANGE footer
47+
feat: allow config to extend other configs
48+
49+
BREAKING CHANGE: `extends` key behavior changed
50+
```
51+
52+
## Workflow
53+
54+
### 1. Analyze Diff
55+
56+
```bash
57+
# If files are staged, use staged diff
58+
git diff --staged
59+
60+
# If nothing staged, use working tree diff
61+
git diff
62+
63+
# Also check status
64+
git status --porcelain
65+
```
66+
67+
### 2. Stage Files (if needed)
68+
69+
If nothing is staged or you want to group changes differently:
70+
71+
```bash
72+
# Stage specific files
73+
git add path/to/file1 path/to/file2
74+
75+
# Stage by pattern
76+
git add *.test.*
77+
git add src/components/*
78+
79+
# Interactive staging
80+
git add -p
81+
```
82+
83+
**Never commit secrets** (.env, credentials.json, private keys).
84+
85+
### 3. Generate Commit Message
86+
87+
Analyze the diff to determine:
88+
89+
- **Type**: What kind of change is this?
90+
- **Scope**: What area/module is affected?
91+
- **Description**: One-line summary of what changed (present tense, imperative mood, <72 chars)
92+
93+
### 4. Execute Commit
94+
95+
```bash
96+
# Single line
97+
git commit -m "<type>[scope]: <description>"
98+
99+
# Multi-line with body/footer
100+
git commit -m "$(cat <<'EOF'
101+
<type>[scope]: <description>
102+
103+
<optional body>
104+
105+
<optional footer>
106+
EOF
107+
)"
108+
```
109+
110+
## Best Practices
111+
112+
- One logical change per commit
113+
- Present tense: "add" not "added"
114+
- Imperative mood: "fix bug" not "fixes bug"
115+
- Reference issues: `Closes #123`, `Refs #456`
116+
- Keep description under 72 characters
117+
118+
## Git Safety Protocol
119+
120+
- NEVER update git config
121+
- NEVER run destructive commands (--force, hard reset) without explicit request
122+
- NEVER skip hooks (--no-verify) unless user asks
123+
- NEVER force push to main/master
124+
- If commit fails due to hooks, fix and create NEW commit (don't amend)

skills-lock.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"skills": {
4+
"git-commit": {
5+
"source": "github/awesome-copilot",
6+
"sourceType": "github",
7+
"skillPath": "skills/git-commit/SKILL.md",
8+
"computedHash": "2607fc60629b82b257136dd2a7a373f0a4466c0b49df7746d845d59313c99b21"
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)