At the start, state: "I am using the git-commit skill to generate and submit a standardized commit."
Quick start
- Check
status/diff/log, to confirm the commit scope and language style. - Stage the target files and display the "list to be committed".
- Generate a commit message that conforms to the Angular specification.
- Only push when the user explicitly passes
push=true, by default do not push.
When NOT to use (Do NOT use)
- The working tree has no pending changes to commit.
- The user only requests code analysis/review, no commit is needed.
- The user explicitly requests only generating suggestions, without executing
git commit。
Triggering examples and non-examples
- Should trigger:
- "Help me commit these changes following the Angular specification."
- "Write a commit message and push."
- Should not trigger:
- "Review this PR to see if there are any problems."
- "Analyze the root cause of this error."
Usage examples
# 基本提交
git-commit 修复上传逻辑
# 提交并 push
git-commit push=true
Pre-check command
git status --short
git diff HEAD
git branch --show-current
git log --oneline -10
Message specification
Header:<type>(<scope>): <summary>
Type:
featNew featurefixBug fixdocsDocumentation changerefactorRefactorperfPerformance optimizationtestTest-relatedchoreMiscellaneous maintenancestyleCode formatting adjustment
Suggested Scope values (commonly used in this project):
storage/upload/download/bucket/rscdn/fopsandbox/sandbox-templateuser/accountali/awstools/share/m3u8cmd/common
Summary rules: imperative mood, present tense, lowercase first letter, no period.
Body rules:
docscan be omitted, other types are recommended to have it- At least explain "why the change" and "the scope of impact"
- Non-
docstypes, the body must be at least 20 characters - A single body paragraph must not exceed 3 lines, keep it concise
Footer (as needed):
BREAKING CHANGE: ...Fixes #123/Closes #456
Language rules
- Refer to the language of the last 10 commits.
- If recent ones are mostly Chinese, use Chinese; if recent ones are mostly English, use English.
Execution flow
- First confirm the list of files to commit.
- Execute
git add(add by file name, avoidgit add -A)。 - Display the commit message draft and confirm.
- Execute
git commit。 - Only when the user explicitly passes
push=truewhenonly then execute push:git push- or
git push -u origin <current-branch> - not passed
push=true, skip the push step
Pre-commit check reminder
Before committing the code, remind the user to confirm that the following have passed:
make test— Unit testsmake lint— Static checksgofmt -s -w .— Code formatting
Key constraints
- Do not use emoji in the commit message
- Do not include AI-assisted tool-related information in the commit message
- Do not add content such as "Generated with" or "Co-Authored-By: AI"
- Do not use
--forceor--deleteand other dangerous push options - Do not auto-push when the user has not explicitly passed
push=truewhen
Output template
已提交: <commit-hash>
标题: <type(scope): summary>
分支: <branch>
Push: 成功/失败/未执行
Failure fallback
- Workspace has no changes: output
git statusresult, indicating there is nothing to commit. git commitfailed (hook error): output the full error, recommend fixing and retrying, do not skip the hook.git pushfailed (remote conflict): output the error, recommend pulling/rebasing first and then retrying.
Acceptance criteria (unified)
- Input prerequisites: parameters and context are parseable; for omitted parameters, execute according to the skill defaults and note this in the output.
- Output requirements: provide results according to the output template agreed by the skill, and include key evidence (commands, paths, links, or log summaries).
- Pass determination: the main process steps are completed and there are no blockers; if there are unfinished items, the scope of impact and next steps must be clearly marked.
- Default strategy (non-interactive): when confirmation is needed but the user does not respond in time, continue with the "recommended default/minimum-risk option"; when interactive selection is needed, prioritize the recommended option.
- Blocker escalation: when encountering missing permissions, credentials, or external dependencies, stop that step immediately and output "blocker + what has been tried + information the user needs to provide".
System specification (AGENTS.md)
When executing this skill, also comply with AGENTS.md the system specification in ; if there is a conflict with this skill, this skill takes precedence.