Generate a Conventional Commits message from staged changes and create the commit.
Core Principle
Human owns the commit. Never add Co-Authored-By footer for AI assistance, unless the project explicitly allows it. The human takes full responsibility for all commits in their repository.
Load Context
First, load the conventional-commits skill to understand commit format and best practices:
Use Skill tool with skill="agd-conventional-commits"
This provides:
- Conventional Commits types and usage
- Style rules (imperative mood, no capitalization, etc.)
- Examples of good and bad commit messages
- Co-Authored-By guidance (never for AI, unless the project explicitly allows it)
Process
Check git status:
git status --short
Identify unstaged files (lines where first column is space, ?, or has changes not yet staged).
Handle staging decision:
If the unstaged files clearly belong to the same change being committed
(e.g. they're part of the task just finished, or the user's request
plainly covers "these changes"), run git add -A without asking and
continue to step 3.
Otherwise — the unstaged files look unrelated to the change being
committed, or it's unclear whether they belong — call the AskUserQuestion
tool with these parameters:
{
"questions": [{
"question": "There are unstaged changes. Would you like me to stage them?",
"header": "Stage changes",
"options": [
{"label": "Stage all", "description": "Run 'git add -A' to stage all changes"},
{"label": "Skip staging", "description": "Commit only currently staged changes"}
]
}]
}
Wait for the tool response, then:
- "Stage all" → Run
git add -A, then continue to step 3
- "Skip staging" → Continue to step 3 with current staged changes
If no unstaged changes exist, skip this step and continue directly to step 3.
Analyze the diff to determine:
- Type: Use types from the loaded skill (feat, fix, docs, etc.)
- Scope: If provided via argument, use it. Otherwise infer from changed files.
- Description: Follow style rules from the skill
- Body: Check change size/complexity per skill's "When to Add Body" section
Generate commit message:
- For small/simple changes:
<type>[scope]: <description>
- For large/complex changes: Include body with what/why/impact
Important: Do NOT add Co-Authored-By footer unless the project explicitly allows it. The commit belongs to the human user.
Decide whether to confirm:
Use judgment about whether to ask before committing rather than always
prompting.
Confirm first when any of these apply:
- The user did not explicitly ask for a commit — the skill triggered
itself after finishing an unrelated task. Always confirm in this case.
- Type or scope required a judgment call rather than a clear read of the diff.
- The diff mixes unrelated concerns instead of one clear change.
- A breaking change is involved.
- Anything in the diff looks risky — deletions of tracked files, possible
secrets, or destructive/hard-to-reverse changes.
- Anything about the request or session suggests the user wants to review
the message first.
To confirm, call the AskUserQuestion tool with the commit message in
preview so it renders in the side-by-side monospace pane (preserving
alignment, blank lines, and any trailers). Keep the question short — the
preview carries the content.
{
"questions": [{
"question": "Ready to commit with this message?",
"header": "Confirm commit",
"multiSelect": false,
"options": [
{
"label": "Yes, commit",
"description": "Create the commit with this message",
"preview": "<full commit message — subject + blank line + body>"
},
{
"label": "Edit message",
"description": "Provide a custom commit message instead"
}
]
}]
}
Notes on the preview field:
- Required only on the "Yes, commit" option — its presence triggers the
split layout. Leaving "Edit message" without a preview is intentional;
the focus pane is empty for that option.
- Pass the complete commit message including any trailers. Newlines
inside the JSON string become real line breaks in the rendered box.
- Previews require
multiSelect: false — they are not supported in
multi-select questions.
Decision handling:
- If "Yes, commit" → Proceed to step 6
- If "Edit message" → Ask user for custom message, then proceed to step 6
- If the user attached free-text via the Notes input (returned in the
annotations field keyed by question text), treat it as an amendment
request: incorporate the note into the message and re-confirm.
Otherwise, commit directly: none of the above apply, so surface the
generated commit message as normal output text immediately before
committing — the user still sees what was written even though they
weren't asked — then proceed straight to step 6.
Create the commit:
- For single-line:
git commit -m "<type>[scope]: <description>"
- For multi-line:
git commit -m "<type>[scope]: <description>" -m "<body line 1>" -m "<body line 2>"
Error Handling
- When unstaged changes exist, stage them directly if they clearly belong to
the change being committed; otherwise ask via AskUserQuestion before
proceeding to step 3
- If no changes at all (staged or unstaged), inform user and exit
- Follow breaking change format from the skill when applicable
- Confirm before executing
git commit whenever any condition in step 5
applies — especially when the skill self-triggered without an explicit
user request — and when in doubt, ask
1---2name: agd-commit3description: This skill should be used when the user asks to "commit these changes", "create a commit", "commit this", "make a commit", or when the agent has completed a task and has uncommitted changes ready to commit. Generates a Conventional Commits message from staged changes and creates the commit, confirming with the user first unless the change is small and unambiguous.4---56Generate a Conventional Commits message from staged changes and create the commit.78## Core Principle910**Human owns the commit.** Never add `Co-Authored-By` footer for AI assistance, unless the project explicitly allows it. The human takes full responsibility for all commits in their repository.1112## Load Context1314First, load the `conventional-commits` skill to understand commit format and best practices:15```16Use Skill tool with skill="agd-conventional-commits"17```1819This provides:20- Conventional Commits types and usage21- Style rules (imperative mood, no capitalization, etc.)22- Examples of good and bad commit messages23- Co-Authored-By guidance (never for AI, unless the project explicitly allows it)2425## Process26271. **Check git status**:28 ```bash29 git status --short30 ```31 Identify unstaged files (lines where first column is space, `?`, or has changes not yet staged).32332. **Handle staging decision**:3435 If the unstaged files clearly belong to the same change being committed36 (e.g. they're part of the task just finished, or the user's request37 plainly covers "these changes"), run `git add -A` without asking and38 continue to step 3.3940 Otherwise — the unstaged files look unrelated to the change being41 committed, or it's unclear whether they belong — call the AskUserQuestion42 tool with these parameters:43 ```json44 {45 "questions": [{46 "question": "There are unstaged changes. Would you like me to stage them?",47 "header": "Stage changes",48 "options": [49 {"label": "Stage all", "description": "Run 'git add -A' to stage all changes"},50 {"label": "Skip staging", "description": "Commit only currently staged changes"}51 ]52 }]53 }54 ```5556 Wait for the tool response, then:57 - "Stage all" → Run `git add -A`, then continue to step 358 - "Skip staging" → Continue to step 3 with current staged changes5960 If no unstaged changes exist, skip this step and continue directly to step 3.61623. **Analyze the diff** to determine:63 - **Type**: Use types from the loaded skill (feat, fix, docs, etc.)64 - **Scope**: If provided via argument, use it. Otherwise infer from changed files.65 - **Description**: Follow style rules from the skill66 - **Body**: Check change size/complexity per skill's "When to Add Body" section67684. **Generate commit message**:69 - For small/simple changes: `<type>[scope]: <description>`70 - For large/complex changes: Include body with what/why/impact7172 **Important**: Do NOT add `Co-Authored-By` footer unless the project explicitly allows it. The commit belongs to the human user.73745. **Decide whether to confirm**:7576 Use judgment about whether to ask before committing rather than always77 prompting.7879 **Confirm first** when any of these apply:80 - The user did not explicitly ask for a commit — the skill triggered81 itself after finishing an unrelated task. Always confirm in this case.82 - Type or scope required a judgment call rather than a clear read of the diff.83 - The diff mixes unrelated concerns instead of one clear change.84 - A breaking change is involved.85 - Anything in the diff looks risky — deletions of tracked files, possible86 secrets, or destructive/hard-to-reverse changes.87 - Anything about the request or session suggests the user wants to review88 the message first.8990 To confirm, call the AskUserQuestion tool with the commit message in91 `preview` so it renders in the side-by-side monospace pane (preserving92 alignment, blank lines, and any trailers). Keep the question short — the93 preview carries the content.9495 ```json96 {97 "questions": [{98 "question": "Ready to commit with this message?",99 "header": "Confirm commit",100 "multiSelect": false,101 "options": [102 {103 "label": "Yes, commit",104 "description": "Create the commit with this message",105 "preview": "<full commit message — subject + blank line + body>"106 },107 {108 "label": "Edit message",109 "description": "Provide a custom commit message instead"110 }111 ]112 }]113 }114 ```115116 Notes on the `preview` field:117 - Required only on the "Yes, commit" option — its presence triggers the118 split layout. Leaving "Edit message" without a preview is intentional;119 the focus pane is empty for that option.120 - Pass the **complete** commit message including any trailers. Newlines121 inside the JSON string become real line breaks in the rendered box.122 - Previews require `multiSelect: false` — they are not supported in123 multi-select questions.124125 Decision handling:126 - If "Yes, commit" → Proceed to step 6127 - If "Edit message" → Ask user for custom message, then proceed to step 6128 - If the user attached free-text via the Notes input (returned in the129 `annotations` field keyed by question text), treat it as an amendment130 request: incorporate the note into the message and re-confirm.131132 **Otherwise, commit directly**: none of the above apply, so surface the133 generated commit message as normal output text immediately before134 committing — the user still sees what was written even though they135 weren't asked — then proceed straight to step 6.1361376. **Create the commit**:138 - For single-line: `git commit -m "<type>[scope]: <description>"`139 - For multi-line: `git commit -m "<type>[scope]: <description>" -m "<body line 1>" -m "<body line 2>"`140141## Error Handling142143- When unstaged changes exist, stage them directly if they clearly belong to144 the change being committed; otherwise ask via AskUserQuestion before145 proceeding to step 3146- If no changes at all (staged or unstaged), inform user and exit147- Follow breaking change format from the skill when applicable148- Confirm before executing `git commit` whenever any condition in step 5149 applies — especially when the skill self-triggered without an explicit150 user request — and when in doubt, ask