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

git-commit

Skill18 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

109 other projects use a version of this, 25 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-pr, github-pr-create 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.
  • CarpeWuSkill

    git-pr

    Prepares Pull Request content by analyzing branch differences. Use when creating PRs, when the user needs help writing PR descriptions, or mentions pull request.

    Also in 7 projects that use this

  • mpagotSkill

    github-pr-create

    Creates a GitHub pull request from staged git changes, handling commit, push, and PR creation in one workflow. Activate when the user asks to "create PR", "open pull request", "push and create PR", "submit PR", or wants to send their changes upstream to os-autoinst-distri-opensuse.

    Also in 3 projects that use this

  • CarpeWuSkill

    git-branch

    Creates Git branches following naming conventions. Use when creating feature, bugfix, hotfix, or release branches, or when the user asks to create a new branch.

    Also in 3 projects that use this

  • denghuinowSkill

    git-release

    Git 项目版本发布自动化工具。执行完整的发布流程:提交所有修改、更新版本号(若有)、 生成 CHANGELOG、创建 git tag 并推送到远程仓库。基于语义化版本 (major/minor/patch)。 支持有 package.json 的项目,也支持无 package.json 的项目(版本从最新 git tag 或 VERSION 等文件获取)。

    Also in 4 projects that use this

  • GoogleSkill

    github-pr-review

    Review a GitHub pull request and leave inline comments in a natural human reviewing voice, indistinguishable from comments typed by hand on the GitHub web UI. Deliberately bounded to defects a reader can settle by looking at the anchored line, rather than a deep audit, so every comment is cheap for the author to check. Scales to 2-20 comments by PR size, parallelises analysis across sub-agents, drafts for approval, then posts individually with human pacing. Use when the user says "review this PR", "review PR 123", pastes a github.com/.../pull/N link, or asks for comments on a pull request. Don't use for reviewing local uncommitted changes or a diff against a branch (use the `review` skill for that).

    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 3 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 85 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 85 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.