Semantic Git
Manage Git commits using conventional commit format with atomic commits and concise messages.
This skill is zagi-aware and is designed to work well with AI IDEs (Cursor, etc.)
Tooling
- Preferred:
zagi (a better git interface for agents).
- Assume zagi is installed if:
git is aliased to zagi in the shell or
- a
zagi binary is available.
- When in doubt, treat
git as if it may be zagi-compatible and avoid using exotic flags.
- Even when zagi is available, generate plain
git commands and let any git → zagi integration handle them.
- Fallback: plain
git when zagi is not available.
When to Use
- Committing changes to git
- Staging files for commit
- Creating commit messages
- Managing atomic commits
- Before pushing changes
Core Principles
- Atomic commits: Stage and commit related changes together. Tests go with implementation code.
- User confirmation: Always confirm with user before committing and before moving to the next commit.
- Conventional format: Use conventional commit message format (feat, fix, etc.) unless directed otherwise.
- Concise messages: Keep messages brief and to the point. Omit description unless change is complicated.
- Command transparency: Always show the exact
git commands that will be run (which may be handled by zagi via alias/wrapper), and ask whether the user wants:
- to run them manually, or
- to have the agent run them.
Commit Message Format
<type>[optional scope]: <subject>
[optional body]
[optional footer(s)]
Types
feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing tests or correcting existing tests
build: Changes that affect the build system or external dependencies
ci: Changes to CI configuration files and scripts
chore: Maintenance tasks (updating build tasks, dependencies, etc.; no production code change)
revert: Revert a previous commit
Breaking Changes
Use ! after the type/scope to indicate breaking changes:
feat!: add new API
fix(api)!: change response format
Subject Line
- Use imperative mood: "add feature" not "added feature" or "adds feature"
- First letter lowercase (unless starting with proper noun)
- No period at the end
- Keep under 72 characters when possible
Body and Footer
- Omit body unless change is complicated or requires explanation
- When needed, be concise and reference issues, PRs, or documentation
- Use footer for breaking changes:
BREAKING CHANGE: <description>
Workflow
- Implement atomic change: Code + tests together.
- Use
test: for test-only changes.
- Run CI checks: Verify types, tests, and linting pass before staging.
- Prefer a single CI command if it exists (e.g.,
pnpm ci, npm run ci, just ci).
- If no CI command, run checks individually (typecheck, test, lint).
- If any check fails, stop and report – do not proceed.
- Stage atomic changes: Group related files together (implementation + tests).
- Suggest commit message: Generate a conventional commit message based on changes.
- Generate commands:
Construct explicit shell commands using git (which may be an alias or wrapper such as zagi), for example:
git add path/to/file1 path/to/file2
GIT_AUTHOR_DATE="YYYY-MM-DD HH:MM:SS" \
GIT_COMMITTER_DATE="YYYY-MM-DD HH:MM:SS" \
git commit -m "feat: add feature"
Always print these commands to the user in order.
- Ask for execution preference:
- Ask the user whether they want:
- to copy-paste and run the commands themselves, or
- to have the agent run them.
- Only execute commands after explicit user approval.
- Commit:
- When executing, run exactly the printed commands.
- Respect any user instructions about backdating timestamps or additional flags.
- Next commit:
- Before staging the next set of changes, confirm with the user that the previous commit is complete and understood.
Automation Mode
If user requests "continue to X" or "automate until X":
- Proceed with atomic commits automatically, but still print commands.
- For each commit:
- Show the staging and commit commands.
- Optionally execute them automatically, as per the user’s automation request.
- Resume asking for confirmation when X is reached.
- X can be: specific file, feature completion, test passing, etc.
Stop and Ask Protocols
Stop and ask user before:
- Adding type ignores (
@ts-ignore, # type: ignore, etc.).
- Adding suppressions (ESLint disable, pylint disable, etc.).
- Using
any type or similar type escapes.
- When uncertain how to proceed with implementation.
- When requirements are unclear.
- When a destructive git operation is proposed (
reset --hard, checkout ., clean -f, push --force); prefer safer alternatives and explain the risks.
Examples
Simple feature or behaviour change:
feat: add user authentication
Feature with scope:
feat(api): add user endpoint
Bug fix:
fix: resolve memory leak in cache
Breaking change:
feat!: migrate to new API version
Test-only change:
test: improve unit tests for auth service
Refactor (no behavior change):
refactor: extract validation logic into separate function
Complex change (with body):
feat(api): add pagination support
Implements cursor-based pagination for large datasets.
See docs/api/pagination.md for details.
References
For detailed guidance, see:
references/conventional-commits.md – Commit format and examples
references/ci-verification.md – CI check patterns and verification
references/co-authors.md – Handling Co-Authored-By trailers and zagi co-author stripping
1---2name: semantic-git3description: Manage Git commits using conventional commit format with atomic staging. Always generate plain git commands before running them and offer to let the user run them manually.4---5
6# Semantic Git
7
8Manage Git commits using conventional commit format with atomic commits and concise messages.
9
10This skill is **zagi-aware** and is designed to work well with AI IDEs (Cursor, etc.)
11
12## Tooling
13
14- **Preferred**: [`zagi`](https://github.com/mattzcarey/zagi) (a better git interface for agents).
15 - Assume zagi is installed if:
16 - `git` is aliased to zagi in the shell **or**
17 - a `zagi` binary is available.
18 - When in doubt, treat `git` as if it may be zagi-compatible and avoid using exotic flags.
19 - Even when zagi is available, **generate plain `git` commands** and let any `git` → `zagi` integration handle them.
20- **Fallback**: plain `git` when zagi is not available.
21
22## When to Use
23
24- Committing changes to git
25- Staging files for commit
26- Creating commit messages
27- Managing atomic commits
28- Before pushing changes
29
30## Core Principles
31
32- **Atomic commits**: Stage and commit related changes together. Tests go with implementation code.
33- **User confirmation**: Always confirm with user before committing and before moving to the next commit.
34- **Conventional format**: Use conventional commit message format (feat, fix, etc.) unless directed otherwise.
35- **Concise messages**: Keep messages brief and to the point. Omit description unless change is complicated.
36- **Command transparency**: Always show the exact `git` commands that will be run (which may be handled by zagi via alias/wrapper), and ask whether the user wants:
37 - to run them manually, or
38 - to have the agent run them.
39
40## Commit Message Format
41
42```
43<type>[optional scope]: <subject>
44
45[optional body]
46
47[optional footer(s)]
48```
49
50### Types
51
52- `feat`: A new feature
53- `fix`: A bug fix
54- `docs`: Documentation only changes
55- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
56- `refactor`: A code change that neither fixes a bug nor adds a feature
57- `perf`: A code change that improves performance
58- `test`: Adding missing tests or correcting existing tests
59- `build`: Changes that affect the build system or external dependencies
60- `ci`: Changes to CI configuration files and scripts
61- `chore`: Maintenance tasks (updating build tasks, dependencies, etc.; no production code change)
62- `revert`: Revert a previous commit
63
64### Breaking Changes
65
66Use `!` after the type/scope to indicate breaking changes:
67- `feat!: add new API`
68- `fix(api)!: change response format`
69
70### Subject Line
71
72- Use imperative mood: "add feature" not "added feature" or "adds feature"
73- First letter lowercase (unless starting with proper noun)
74- No period at the end
75- Keep under 72 characters when possible
76
77### Body and Footer
78
79- Omit body unless change is complicated or requires explanation
80- When needed, be concise and reference issues, PRs, or documentation
81- Use footer for breaking changes: `BREAKING CHANGE: <description>`
82
83## Workflow
84
851. **Implement atomic change**: Code + tests together.
86 - Use `test:` for test-only changes.
872. **Run CI checks**: Verify types, tests, and linting pass before staging.
88 - Prefer a single CI command if it exists (e.g., `pnpm ci`, `npm run ci`, `just ci`).
89 - If no CI command, run checks individually (typecheck, test, lint).
90 - If any check fails, stop and report – do not proceed.
913. **Stage atomic changes**: Group related files together (implementation + tests).
924. **Suggest commit message**: Generate a conventional commit message based on changes.
935. **Generate commands**:
94 - Construct explicit shell commands using `git` (which may be an alias or wrapper such as zagi), for example:
95
96 ```bash
97 git add path/to/file1 path/to/file2
98 GIT_AUTHOR_DATE="YYYY-MM-DD HH:MM:SS" \
99 GIT_COMMITTER_DATE="YYYY-MM-DD HH:MM:SS" \
100 git commit -m "feat: add feature"
101 ```
102
103 - Always **print these commands** to the user in order.
1046. **Ask for execution preference**:
105 - Ask the user whether they want:
106 - to copy-paste and run the commands themselves, or
107 - to have the agent run them.
108 - Only execute commands after explicit user approval.
1097. **Commit**:
110 - When executing, run **exactly** the printed commands.
111 - Respect any user instructions about backdating timestamps or additional flags.
1128. **Next commit**:
113 - Before staging the next set of changes, confirm with the user that the previous commit is complete and understood.
114
115## Automation Mode
116
117If user requests "continue to X" or "automate until X":
118
119- Proceed with atomic commits automatically, **but still print commands**.
120- For each commit:
121 - Show the staging and commit commands.
122 - Optionally execute them automatically, as per the user’s automation request.
123- Resume asking for confirmation when X is reached.
124- X can be: specific file, feature completion, test passing, etc.
125
126## Stop and Ask Protocols
127
128Stop and ask user before:
129
130- Adding type ignores (`@ts-ignore`, `# type: ignore`, etc.).
131- Adding suppressions (ESLint disable, pylint disable, etc.).
132- Using `any` type or similar type escapes.
133- When uncertain how to proceed with implementation.
134- When requirements are unclear.
135- When a destructive git operation is proposed (`reset --hard`, `checkout .`, `clean -f`, `push --force`); prefer safer alternatives and explain the risks.
136
137## Examples
138
139**Simple feature or behaviour change:**
140```
141feat: add user authentication
142```
143
144**Feature with scope:**
145```
146feat(api): add user endpoint
147```
148
149**Bug fix:**
150```
151fix: resolve memory leak in cache
152```
153
154**Breaking change:**
155```
156feat!: migrate to new API version
157```
158
159**Test-only change:**
160```
161test: improve unit tests for auth service
162```
163
164**Refactor (no behavior change):**
165```
166refactor: extract validation logic into separate function
167```
168
169**Complex change (with body):**
170```
171feat(api): add pagination support
172
173Implements cursor-based pagination for large datasets.
174See docs/api/pagination.md for details.
175```
176
177## References
178
179For detailed guidance, see:
180
181- `references/conventional-commits.md` – Commit format and examples
182- `references/ci-verification.md` – CI check patterns and verification
183- `references/co-authors.md` – Handling Co-Authored-By trailers and zagi co-author stripping