You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/git-commit/SKILL.md
+72-21Lines changed: 72 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@ user-invocable: true
5
5
allowed-tools: Bash
6
6
---
7
7
8
-
Review current changes and autonomously commit following Conventional Commits.
8
+
Review current changes and autonomously create fine-grained, independently
9
+
revertable commits following Conventional Commits.
9
10
10
11
**Working tree status (source repo):**
11
12
```
@@ -19,32 +20,53 @@ Review current changes and autonomously commit following Conventional Commits.
19
20
20
21
## Arguments
21
22
22
-
If a `--path <dir>` argument is provided (e.g. invoked as `git-commit --path /tmp/feat-foo`), all git commands must be run inside that directory by prepending `cd <dir> &&` to every Bash command. This overrides the current working directory.
23
-
24
-
1. Run `git status`, `git diff`, and `git log --oneline -5` to understand the changes and context
25
-
2. Decide the commit message autonomously
26
-
3. Stage and commit using `git apply` (see below)
27
-
28
-
## Principle
29
-
- Write **Why** in the subject line itself — keep it concise but meaningful.
30
-
- Body is optional. If you feel a body is necessary, the commit is likely too large — consider splitting it.
31
-
- Footer (Co-Authored-By) is always required.
32
-
- Each commit must be **independently revertable** without breaking other functionality.
23
+
-`--path <dir>`: run every git command inside `<dir>` by prepending `cd <dir> &&`
24
+
to each Bash command. This overrides the current working directory (e.g. invoked
25
+
as `git-commit --path /tmp/feat-foo`).
26
+
-`--push`: push to remote after all commits are complete (default: off). See the
27
+
**Push** section below.
28
+
29
+
1. Run `git status`, `git diff HEAD`, and `git log --oneline -10` to understand the
30
+
changes and context
31
+
2. Decide commit boundaries and messages autonomously
32
+
3. Stage and commit each unit using `git apply --cached` (see below)
33
+
34
+
## Core Philosophy — Revertability First
35
+
36
+
Each commit must be **revertable independently** without breaking other
37
+
functionality. Prefer smaller, granular commits over large groupings — split by
38
+
hunks within files, not just whole files.
39
+
40
+
-**Tiny commits are expected.** A single review comment, one wording correction,
41
+
one reference-file extraction, one symlink sync, or one formatting pass can each
42
+
be its own commit when independently revertable. PR branches are squash-merged
43
+
later, so don't worry about granularity being too fine.
44
+
-**Tiny does not mean incomplete.** For moves, renames, or extractions, one commit
45
+
must include *both* sides: remove/update the old location, add the new location,
46
+
update references, and sync generated links. Never commit only the destination of
47
+
a move while leaving the source/reference cleanup for later.
48
+
-**Don't `--amend` away review history.** PR branches are squash-merged, so keep
49
+
review fixes as small follow-up commits that can be reverted independently. Amend
50
+
only for unpublished local mistakes or when the user explicitly asks.
51
+
52
+
For concrete good and bad examples, read `references/revertable-commits.md`.
33
53
34
54
## Commit Granularity
35
55
- 1 commit = 1 logical change
36
56
- Examine individual hunks, not entire files — split if needed
37
57
- Separate refactoring and feature additions
38
58
- Tests can be in the same commit as the main code
39
-
- Formatting-only changes should be separate
59
+
- Formatting-only changes should be separate (`chore(xxx): format` or `chore: format`)
40
60
41
61
## Staging with git apply
42
62
43
-
Never use interactive commands like `git add -p`. Instead:
63
+
Never use interactive commands like `git add -p` or `git add --interactive` —
64
+
Claude Code cannot handle them. Instead:
44
65
45
66
```bash
46
-
# 1. Generate patch for the target changes
47
-
git diff > patch.diff
67
+
# 1. Generate patch for the target changes (HEAD-relative so already-staged
68
+
# hunks and new files from a prior iteration are not lost)
69
+
git diff HEAD > patch.diff
48
70
49
71
# 2. Verify before applying (no file changes on failure)
0 commit comments