agentleFS
MorningStar0709MorningStar0709/trae-agent-enhancements/skills/git-commit/SKILL.md

git-commit

Skill17 starsChanged 7 months agoMITView on GitHub

Execute git commits in Trae with conventional commit message analysis, intelligent staging, and message generation. Use when the user asks to commit changes, create a git commit, mentions /commit, or says Chinese requests such as 帮我提交, 生成提交信息, 提交当前修改, or 按规范提交. Supports type/scope detection, conventional commit messages, and logical file staging.

  • Reads credentials

194 other projects use a version of this, 35 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-pr, git-branch and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • klauswgSkill

    git-pr

    Prepare, review, publish, or update a complete GitHub pull request for the current repository, including local commit readiness, safe push strategy, semantic title validation, repository-native PR templates, issue linking, and checks verification. Use when the user asks to draft, create, submit, publish, open, or update a pull request. Always require the user to review and explicitly approve the exact final PR before any push or GitHub write.

    Also in 13 projects that use this

  • MicrosoftSkill

    git-branch

    Branch management for implementation. Use when you need to create a branch, switch branches, checkout, or verify branching strategy before implementing code. Do not use for commits (use git-commit), pull requests (use pull-request), or advanced git operations (rebase, merge).

    Also in 6 projects that use this

  • mjun0812Skill

    github-pr-create

    Pull Requestを作成するSkill。現在のbranchからpull requestを作成する。言語指定可能。 ユーザーが「PR作って」「pull request作成して」のように依頼したら使うこと。

    Also in 3 projects that use this

  • klauswgSkill

    git-issue

    Prepare, review, create, or update evidence-based GitHub issues for the current repository with duplicate detection, repository-native templates, valid labels, and post-publication verification. Use when the user asks to draft, file, submit, publish, edit, or refine a GitHub issue, bug report, feature request, performance issue, or technical proposal. Always require the user to review and explicitly approve the exact final issue before any GitHub write.

    Also in 3 projects that use this

  • mgiovaniSkill

    docs-adr

    Create a numbered Architecture Decision Record (ADR) documenting a technical

    Also in 3 projects that use this

  • gologo13Skill

    git-push

    Push current branch to origin and sync with remote updates; keywords: git, rebase. Use only on explicit request; before execution, review diffs and list impact scope.

    Also in 8 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. 0 are common, 17 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 153 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Create standardized, semantic git commits using the Conventional Commits specification.

    line 10
  2. Distinctive:

    Do not use this skill when:

    line 18
  3. Distinctive:

    When adapting for Chinese teams:

    line 37
  4. Distinctive:

    If nothing is staged or you want to group changes differently:

    line 90
  5. Very specific:

    If the repository uses hooks, let them run.

    line 131
  6. Distinctive:

    Keep description under 72 characters

    line 139
  7. Distinctive:

    Keep each bullet under 100 characters

    line 155
  8. Distinctive:

    Use present tense, imperative mood, lowercase after the dash

    line 156
  9. Distinctive:

    NEVER update git config

    line 177
  10. Distinctive:

    NEVER run destructive commands (--force, hard reset) without explicit request

    line 178
  11. Distinctive:

    NEVER skip hooks (--no-verify) unless user asks

    line 179
  12. Distinctive:

    NEVER force push to main/master

    line 180
  13. Distinctive:

    If commit fails due to hooks, fix and create NEW commit (don't amend)

    line 181
  14. Distinctive:

    If git status --porcelain is empty, do not create an empty commit unless the user explicitly asks.

    line 182
  15. Distinctive:

    If staged and unstaged changes are mixed, preserve the user's staging intent.

    line 183
  16. Distinctive:

    If secrets or credential-looking files are present, stop and ask before staging or committing them.

    line 184
  17. Very specific:

    If this is the last commit on a branch, the next step should be finishing-a-development-branch for branch wrap-up (merge, PR, keep, or …

    line 185
  18. Distinctive:

    Git not installed: Stop and report Git is not available on this system.

    line 195
  19. Distinctive:

    Not a git repository: Stop and tell the user the current directory is not a repository.

    line 196

“Common” is measured: kept by at least 6 in 10 of the 153 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Commit with Conventional Commits

Overview

Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.

When the user writes in Chinese, default to a hybrid Conventional Commit format: keep the type in English (for tooling compatibility), but write the scope, description, and body in Simplified Chinese. Only use a pure English commit message if the user explicitly asks for it or the repository strictly enforces English.

On Windows, use PowerShell-compatible commands and avoid Unix-only shell constructs.

Do Not Use

Do not use this skill when:

  • The user asks for a code review, diff explanation, release notes, or changelog but does not want an actual commit.
  • The repository has no changes and the user did not explicitly ask for an empty commit.
  • The user asks to push, open a pull request, rewrite history, force-push, or manage branches beyond creating the local commit.
  • The working tree is in an unresolved merge, rebase, or cherry-pick state and the user has not chosen how to proceed.
  • The task involves committing secrets, credentials, private keys, or generated artifacts that should not be versioned.

Conventional Commit Format

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Hybrid Chinese/English Format

When adapting for Chinese teams:

feat(用户模块): 添加手机号一键登录功能

- 接入运营商一键登录 SDK
- 支持移动、联通、电信三网

Commit Types

TypePurpose
featNew feature
fixBug fix
docsDocumentation only
styleFormatting/style (no logic)
refactorCode refactor (no feature/fix)
perfPerformance improvement
testAdd/update tests
buildBuild system/dependencies
ciCI/config changes
choreMaintenance/misc
revertRevert commit

Breaking Changes

# Exclamation mark after type/scope
feat!: remove deprecated endpoint

# BREAKING CHANGE footer
feat: allow config to extend other configs

BREAKING CHANGE: `extends` key behavior changed

Workflow

1. Analyze Diff

# If files are staged, use staged diff
git diff --staged

# If nothing staged, use working tree diff
git diff

# Also check status
git status --porcelain

2. Stage Files (if needed)

If nothing is staged or you want to group changes differently:

# Stage specific files
git add path/to/file1 path/to/file2

# Stage by pattern
git add *.test.*
git add src/components/*

# Interactive staging
git add -p

Never commit secrets (.env, credentials.json, private keys).

3. Generate Commit Message

Analyze the diff to determine:

  • Type: What kind of change is this?
  • Scope: What area/module is affected?
  • Description: One-line summary of what changed (present tense, imperative mood, <72 chars)

4. Execute Commit

# Single line
git commit -m "<type>[scope]: <description>"

# Multi-line with body/footer in PowerShell
$msg = @"
<type>[scope]: <description>

<optional body>

<optional footer>
"@
git commit -m $msg

If the repository uses hooks, let them run. Do not add --no-verify unless the user explicitly requests it.

Best Practices

  • One logical change per commit
  • Present tense: "add" not "added"
  • Imperative mood: "fix bug" not "fixes bug"
  • Reference issues: Closes #123, Refs #456
  • Keep description under 72 characters

Commit Message Granularity

The granularity of the commit body depends on how many logical changes the diff contains:

Diff scopeDescriptionBodyExample
Single atomic change (1 file, 1 concern)One line, no body neededOmitfeat: add email validation helper
Single concern across multiple files (e.g., refactor a function + update all call sites + add tests)One line summarizing the net effectOmit or minimalrefactor(auth): extract token validation to middleware
Loosely related changes in one commit (multiple fixes or features grouped by the user)One line as a category labelRequired: bullet-point list of what changed, one item per file or per concernSee below
Chore / maintenance (config, lint, deps, docs)One lineOmitchore: update eslint rules

Body writing rules:

  • One bullet per logical change, not per line of code
  • Focus on WHAT changed, not WHY (why goes in the footer or PR description)
  • Keep each bullet under 100 characters
  • Use present tense, imperative mood, lowercase after the dash

Example of a multi-change commit body:

fix: 修复路由规则触发条件 4 项修复

- alwaysApply: false → true,消除护栏加载空窗期
- 新增 Exception to Escalation,纯机械变更保持 S 级
- M 级下游加入 TDD 选择条件
- 护栏扩充:auth/CI-CD/破坏性操作

Example of a single-change commit:

feat(api): add rate limiting middleware

Closes #456

Git Safety Protocol

  • NEVER update git config
  • NEVER run destructive commands (--force, hard reset) without explicit request
  • NEVER skip hooks (--no-verify) unless user asks
  • NEVER force push to main/master
  • If commit fails due to hooks, fix and create NEW commit (don't amend)
  • If git status --porcelain is empty, do not create an empty commit unless the user explicitly asks.
  • If staged and unstaged changes are mixed, preserve the user's staging intent. Ask before adding unrelated files.
  • If secrets or credential-looking files are present, stop and ask before staging or committing them.
  • If this is the last commit on a branch, the next step should be finishing-a-development-branch for branch wrap-up (merge, PR, keep, or discard).

Integration

  • verification-before-completion: Upstream — validation must pass before committing.
  • finishing-a-development-branch: Downstream — after committing, wrap up the branch.
  • chinese-git-workflow: Adjacent — use when the remote is Gitee, GitLab, Coding, or CNB.

Failure Handling

  • Git not installed: Stop and report Git is not available on this system. Suggest installing Git from https://git-scm.com or using Trae's built-in source control features. Do not attempt git commands.
  • Not a git repository: Stop and tell the user the current directory is not a repository. Offer to initialize one with git init if the user wants version control, or suggest file-level alternatives.
  • No changes -> do not commit: report that the working tree has no staged or unstaged changes.
  • Merge/rebase/cherry-pick in progress -> stop and ask whether to continue, abort, or inspect the state.
  • Commit hook failure -> summarize the hook error and fix the underlying issue when it is in scope; do not bypass hooks by default.
  • Ambiguous staging scope -> ask before staging broad patterns or unrelated files.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.