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
@@ -29,7 +29,22 @@ You must execute the following sequential workflow whenever a commit task is ini
29
29
1. Construct the message draft strictly using the type classifications and syntax limits specified in `references/conventional_commits.md`.
30
30
2. Present the drafted structure to the user for validation, highlighting the assigned commit type and scope.
31
31
32
-
### Step 3: Terminal Command Delivery
33
-
1. Upon user confirmation, output the explicit, single-line terminal command using multiple `-m` flags as specified in the formatting policy.
32
+
### Step 3: Message Validation
33
+
1. After drafting the message in Step 2, validate it against **every rule** listed in `references/conventional_commits.md` before proceeding. Check the following:
34
+
***Type:** The commit type must be one of the allowed types (feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert).
35
+
***Language:** The entire message must be in English (unless the user explicitly requested another language).
36
+
***Case & Punctuation:** The description must be lowercase and must NOT end with a period.
37
+
***Imperative Mood:** The description must use imperative mood (e.g., "add", not "added" or "adds").
38
+
***Line Length:** The subject line must not exceed 72 characters. **Every line in the body must also be wrapped at 72 characters or less.** If any line exceeds this limit, insert line breaks to fix it.
39
+
***`-m` Flags:** The command must use at most three `-m` flags (one per structural part). Body lines must NOT be split across multiple `-m` flags.
40
+
***Literal Newlines:** Multi-line body/footer content must use **literal newlines** inside double-quoted strings, NOT `\n` escape sequences (which shells commit as literal backslash-n).
41
+
***Co-authored-by:** No `Co-authored-by:` trailers unless explicitly requested.
42
+
2. If **any** rule is violated, fix the draft and re-validate from step 1. Repeat this loop until all checks pass. Only proceed to Step 4 once the message passes every validation check.
43
+
44
+
### Step 4: Terminal Command Delivery
45
+
1. Upon user confirmation, output the explicit, single-line terminal command using at most three `-m` flags as specified in the formatting policy.
46
+
***CRITICAL:** Use at most one `-m` flag per structural part (Subject, Body, and Footer).
47
+
***NEVER** use multiple `-m` flags for individual lines or bullet points within the body. Doing so causes Git to insert unwanted blank lines.
48
+
***CRITICAL:** For multi-line body or footer content, you must use a single double-quoted string containing **literal newlines (actual line breaks)** within the command. Do NOT use escape sequences like `\n` (which shell command execution will commit literally) or additional `-m` flags.
34
49
35
50
Process each step in order and complete the current step before moving to the next.
Copy file name to clipboardExpand all lines: .agents/skills/git-commit/references/conventional_commits.md
+27-4Lines changed: 27 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,15 +35,21 @@ When drafting, validating, or executing Git commits, you must strictly adhere to
35
35
* The subject line (first line) must not exceed 72 characters, ideally 50 characters or less.
36
36
***Every single line within the commit message body must also be wrapped at 72 characters or less.** If an explanation runs longer, you must manually insert line breaks to keep each line under the 72-character threshold.
37
37
38
-
3.**Part Separation via Multiple `-m` Flags**:
39
-
* Use one `-m` flag per structural part: the subject line, the body, and the footer. Use at most three `-m` flags in total.
40
-
* All body content — including bullet lists and multi-sentence explanations — must be placed in a single `-m` value. Do not split body content across multiple `-m` flags; doing so inserts unwanted blank lines between items.
38
+
3.**Part Separation via Multiple `-m` Flags (At Most Three)**:
39
+
* Use at most one `-m` flag per structural part: the subject line, the body, and the footer. Use at most three `-m` flags in total.
40
+
***NEVER split body lines or bullet lists across multiple `-m` flags.** Doing so inserts unwanted blank lines because Git automatically treats each `-m` flag as a separate paragraph.
41
+
***DO NOT use escape sequences like `\n` in double quotes.** Shells like bash will treat `\n` as literal backslash-n characters and commit them as-is.
42
+
***Use literal newlines (actual line breaks)** inside double quotes to write multi-line bodies or footers.
41
43
**Example:*
42
44
43
45
```bash
44
-
git commit -m "feat(auth): add jwt authentication" -m $'Validate tokens on every incoming request.\nSecure endpoints by rejecting expired credentials.\n- Added middleware for token validation\n- Removed legacy session handling' -m "BREAKING CHANGE: The old session-based cookie auth is deprecated."
46
+
git commit -m "feat(auth): add jwt authentication" -m "Validate tokens on every incoming request.
47
+
Secure endpoints by rejecting expired credentials.
48
+
- Added middleware for token validation
49
+
- Removed legacy session handling" -m "BREAKING CHANGE: The old session-based cookie auth is deprecated."
45
50
```
46
51
52
+
47
53
4. **Co-authored-by Restriction**:
48
54
***Do not include any `Co-authored-by:` trailers**in the commit message or footer unless the user explicitly requests you to add credit for a co-author.
49
55
@@ -52,3 +58,20 @@ When drafting, validating, or executing Git commits, you must strictly adhere to
52
58
53
59
6. **Imperative Mood**:
54
60
* Always use the imperative mood in the description (e.g., use "add", "fix", "change" instead of "added", "fixes", "changed").
61
+
62
+
## Validation Checklist
63
+
64
+
When validating a draft commit message, check **every** item below. If any check fails, fix the issue and re-validate until all pass.
65
+
66
+
|# | Check | Rule |
67
+
|---|-------|------|
68
+
| 1 |**Type valid**| The type must be one of: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert. |
69
+
| 2 |**Language**| The message must be in English (unless the user explicitly requested another language). |
70
+
| 3 |**Lowercase**| The description must be lowercase. |
71
+
| 4 |**No period**| The description must NOT end with a period. |
72
+
| 5 |**Imperative mood**| Use imperative mood (e.g., "add" not "added", "adds"). |
73
+
| 6 |**Subject ≤ 72 chars**| The subject line must not exceed 72 characters. |
74
+
| 7 |**Body lines ≤ 72 chars**|**Every line in the body must be wrapped at 72 characters or less.**|
75
+
| 8 |**At most 3 `-m` flags**| Use at most one `-m` per structural part;do NOT split body lines across multiple `-m` flags. |
76
+
| 9 |**Literal newlines**| Multi-line body/footer must use literal newlines inside double quotes, NOT `\n` escape sequences. |
77
+
| 10 |**No Co-authored-by**| Do not include `Co-authored-by:` unless explicitly requested. |
0 commit comments