Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

smart-commit智能提交

Agent Skill

smart-commit 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

432

周安装

18

GitHub Stars

公开资料未说明

下载量

144
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:smart-commit(智能提交)
来源仓库:https://github.com/fearovex/claude-config
仓库路径:skills/smart-commit
安装命令:
npx skills add https://github.com/fearovex/claude-config --skill smart-commit
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/fearovex/claude-config --skill smart-commit

简介

smart-commit 用于提交前扫描暂存区变更,检测潜在问题并生成规范化的 Git 提交消息。

  • 适合团队协作中确保代码安全与提交质量,自动识别敏感信息与调试残留。
  • 支持错误阻断与警告提示机制,强制清理 .env 文件与密钥泄露风险。
  • 输出结构化报告,包含建议提交标题与检测到的问题列表。
  • 需配合 Git diff 使用,无法替代人工复核关键业务逻辑变更。

SKILL.md

Triggers: When the user says "commit", "smart commit", or /commit.

When to Use

Triggers: When the user says "commit", "smart commit", or /commit.

  • Committing staged changes in any git repository
  • When you want a well-structured conventional commit message
  • When you want automatic detection of common commit issues before pushing

Process

Step 1 — Read working-tree state

Run these commands and collect their output:

git status --porcelain          # full working-tree state: staged, unstaged, untracked
git diff --cached               # full diff for content analysis (staged changes)

Also check:

git log --oneline -5            # recent commits to match message style

Parse the git status --porcelain output and assign a staging-status tag to each file:

  • Lines where XY = "??" → tag untracked
  • Lines where X is A, M, R, D, or C (index column non-space) → tag staged

- If X = R (rename), split the entry on " -> " and include both the old path and the new path; both receive tag staged

  • Lines where X = " " and Y is M, D, or T (worktree column non-space) → tag unstaged
  • When both X and Y are non-space (staged change also has worktree modifications), the index change takes precedence: tag staged

If git status --porcelain returns empty output, report:

Nothing to commit. Working tree is clean.

And stop — do not proceed.

Step 1b — Group detected files

Using the file paths collected in Step 1, apply the following grouping heuristic in priority order. Each detected file is assigned to exactly one group — the first rule that matches wins, and the file is not reconsidered by later rules. Each file's staging-status tag (assigned in Step 1) travels unchanged through the grouping step and is preserved in the group record.

Rule 1 — Test files (highest priority, applied before any directory check):

  • Paths matching *.test.*, *.spec.*, _test.*, or *_test.* → group test
  • This rule applies regardless of which directory the file lives in.

Rule 2 — Config/infra files:

  • Root-level files (no subdirectory) matching *.json, *.yaml, *.yml, *.toml, *.sh, or *.env* → group chore

Rule 3 — Docs files:

  • Paths under docs/ → group docs
  • Root-level files matching *.md or README* → group docs

Rule 4 — Directory prefix:

  • Remaining files are grouped by their first path segment (e.g., skills/smart-commit/SKILL.md → group skills; hooks/smart-commit-context.js → group hooks)

Fallback:

  • Files that match none of the rules above (e.g., a root-level foo.rb with no subdirectory and no recognized extension) → group misc

No detected file may appear in more than one group. Every detected file must appear in exactly one group.

Single-group fast-path: If grouping produces exactly one group → skip the multi-commit plan and fall through to Step 2 unchanged. Behavior is identical to the pre-grouping version of this skill. If the single group contains any files tagged unstaged or untracked, print Auto-staging N file(s): <list of those files> then issue git add <unstaged/untracked files> before proceeding to Step 2.

Multi-group branch: If grouping produces two or more groups → proceed to Step 1c (multi-commit plan) before executing any commit.

Step 1c — Present multi-commit plan

For each group identified in Step 1b, run Steps 2 and 3 independently using a scoped diff limited to that group's files:

git diff --cached -- <file-1> <file-2> ...   # scoped to this group's file list only

Use this scoped diff (not the full git diff --cached) as the input for both the commit message generation (Step 2) and the issue detection (Step 3) for that group.

ERROR collection before display: Collect all ERROR-severity findings across every group before printing anything to the user. If any group yields one or more ERRORs:

  • Print all ERRORs found across all groups.
  • Print: Commit plan blocked. Fix the errors above before committing.
  • Stop — do not display the plan, do not proceed to any git commit.

Display the full plan (only when no ERRORs are present):

This annotation MUST appear before any git add or git commit is issued, so the user can review the exact staging-status of every file before confirming.

## Smart Commit Plan (N commits)

────────────────────────────────────
Commit 1 of N — [label]
Files: file-a.md [staged], file-b.md [unstaged]
Proposed message:
  type(scope): short description
────────────────────────────────────
Commit 2 of N — [label]
Files: skills/smart-commit/SKILL.md [untracked]
Proposed message:
  type(scope): short description
────────────────────────────────────

Issues detected across all groups:
  ⚠️  WARNING in commit 1: <message>

Each file in the Files: line is annotated with its staging-status marker: [staged], [unstaged], or [untracked].

Display any WARNING-severity findings in the plan summary (non-blocking). If there are no issues, omit the "Issues detected" section.

Plan-level confirmation prompt:

Proceed with all commits? [commit all / step-by-step / abort]
  • commit all → proceed to Step 5, multi-group "commit all" path
  • step-by-step → proceed to Step 5, multi-group "step-by-step" path
  • abort → print Commit plan aborted. No files were staged. Working tree is unchanged. and stop; no git add or git commit is executed

Step 2 — Analyze changes

From the diff output, determine:

SignalDerivation
typefeat new files/features; fix bug fixes; refactor restructure; chore config/deps; docs docs only; test tests only; style formatting only
scopeThe primary directory or domain that changed (e.g. auth, payment, player). Omit if changes span many unrelated domains.
summaryOne-line description of WHAT changed and WHY (present tense, lowercase, no period)
bodyBullet list of key changes if more than one file is affected

Step 3 — Detect issues

Scan git diff --cached output for these patterns. Report as ERROR (blocking) or WARNING (non-blocking):

SeverityConditionMessage
ERRORAny file matching *.env, .env, .env.*, .env.local is staged.env file staged — unstage with: git restore --staged <file>
ERRORAdded lines (+ prefix) match password\s*=\s*\S+, api_key\s*=\s*\S+, secret\s*=\s*\S+, token\s*=\s*\S+ (case-insensitive, value present)Possible credential in <file>:<line> — verify before committing
WARNINGAdded lines contain console.log, debugger, print(, putsDebug statement in <file> (N occurrences)
WARNINGAdded lines contain TODO: or FIXME:Unresolved TODO/FIXME in <file>
WARNINGAny staged file is a known binary and exceeds 1 MBLarge file staged: <file> (<size>MB)
WARNINGAny staged path starts with node_modules/ or contains /dist/Build artifact staged: <file>

Step 4 — Present summary

Output a structured report before committing:

## Smart Commit Summary

**Staged:** N files  +X −Y lines

**Proposed commit message:**
──────────────────────────────
type(scope): short description

- bullet change 1
- bullet change 2
──────────────────────────────

**Issues detected:**
⛔ ERROR: .env.local is staged — unstage with: git restore --staged .env.local
⚠️  WARNING: console.log in pages/api/auth.js (2 occurrences)
⚠️  WARNING: TODO: left in domain/payment/PaymentService.js

Then, based on severity:

  • ERRORs present → Print: Commit blocked. Fix the errors above before committing. Do NOT proceed.
  • Warnings only → Ask: Proceed with commit? [y / edit message / abort]
  • No issues → Ask: Proceed with commit? [y / edit message / abort]

If the user chooses edit message: ask them to provide the new message, then use it verbatim. If the user chooses abort: stop, print Commit aborted.

Step 5 — Execute commit

After confirmation, execute:

git commit -m "$(cat <<'EOF'
type(scope): short description

- bullet change 1
- bullet change 2
EOF
)"

On success, report:

✅ Committed: <hash> — type(scope): short description

On failure, report the full git error and suggest remediation.

Multi-group "commit all" path (when user chose commit all at Step 1c):

Iterate through every group in the order shown in the plan. For each group: 0. For each file in this group tagged unstaged or untracked, issue git add <file>; skip files already tagged staged.

  1. Execute git commit with the group's proposed message.
  2. Print the resulting commit hash immediately after each commit fires.
  3. Do not present any intermediate prompt between groups.

After all groups have been committed, print the full-execution summary (see below).

Multi-group "step-by-step" path (when user chose step-by-step at Step 1c):

Before each group's commit, print the per-commit confirmation block:

## Commit N of M — [label]

**Files:** file-a.md, file-b.md
**Proposed message:**
──────────────────────────────
type(scope): short description
- bullet 1
──────────────────────────────

Proceed? [y / edit message / skip / abort remaining]

Apply the user's choice before moving to the next group:

  • y → for each file in this group tagged unstaged or untracked, issue git add <file>; skip files already tagged staged; then execute git commit with the proposed message; print the resulting hash; continue to the next group.
  • edit message → prompt: Enter replacement message: — use the provided text verbatim for this commit only; for each file in this group tagged unstaged or untracked, issue git add <file>; skip files already tagged staged; then execute and print the hash; continue to the next group.
  • skip → no git add is issued for this group; leave this group's files in their original state without committing; move to the next group.
  • abort remaining → no git add is issued for remaining groups; stop processing after the current group (do not commit any subsequent groups); print the partial-execution summary.

Partial-execution summary (triggered when all groups complete or when abort remaining is chosen mid-sequence):

When all groups succeeded (or were skipped without aborting):

N of N commits executed.
  ✅ <hash-1> — type(scope): description (commit 1)
  ✅ <hash-2> — type(scope): description (commit 2)
  ...

When execution was aborted mid-sequence (M commits executed, remaining groups not committed):

M of N commits executed.
  ✅ <hash-1> — type(scope): description (commit 1)
  ✅ <hash-2> — type(scope): description (commit 2)

Not committed — files remain in original state:
  Commit <next> of N — [label]
    Files: file-x.md [staged], file-y.md [unstaged]
    Proposed message: type(scope): description
  Commit <next+1> of N — [label]
    Files: file-z.md [untracked]
    Proposed message: type(scope): description

Do NOT attempt to undo or roll back any commits that have already been executed.


Anti-Patterns

Don't generate vague messages

# Bad
git commit -m "update"
git commit -m "fix stuff"
git commit -m "changes"

# Good
git commit -m "fix(auth): prevent session expiry on page reload"
git commit -m "feat(player): add shuffle mode to playlist"

Don't bypass ERRORs

If a .env file or credential pattern is detected, stop unconditionally. Do not commit even if the user asks to skip.

Don't stage files that were not confirmed

Issue git add only for groups the user explicitly confirmed; never batch-stage all detected files upfront before the plan confirmation.


Quick Reference

SituationCommit format
Single file changedtype(scope): description (no body)
Multiple files, same domaintype(scope): description + bullet body
Multiple unrelated domainstype: description (no scope) + bullet body
Only documentationdocs(scope): update...
Only dependency changeschore(deps): update X to Y.Z
Only formatting/whitespacestyle(scope): format...
Only test additionstest(scope): add tests for...

Rules

  • Never commit without first presenting the generated message summary and waiting for explicit user confirmation
  • Detect and block commits that contain secrets (API keys, tokens, passwords) found by pattern matching in the diff
  • Detect and warn on console.log, debugger, TODO, and large binary files in the staged diff before committing
  • Commit messages must follow conventional commits format (type(scope): description); generated messages that cannot be classified must default to chore: with a descriptive subject
  • Detect files from the full working tree via git status --porcelain; assign each file a staging-status tag (staged, unstaged, untracked) during Step 1
  • Auto-stage only the files of a confirmed group — issue git add <files> for files tagged unstaged or untracked immediately before that group's git commit; never re-add already-staged files
  • For skipped or aborted groups, issue no git add — their files must remain in the exact state they were in when the skill was invoked
  • When detected files span two or more functional groups, present the full multi-commit plan before executing any commit
  • ERROR conditions in any group block the entire multi-commit plan — no partial execution allowed when ERRORs are present
  • Every commit in a multi-commit sequence uses the proposed message without additional trailers
  • The grouping heuristic is applied in priority order: test → config/infra → docs → directory prefix → misc fallback; no file may appear in more than one group
  • The single-group fast-path preserves exact backward compatibility — no behavior change when all staged files resolve to one group

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.06%
按下载量换算50

Claude

28.77%
按下载量换算41

Cursor

17.24%
按下载量换算25

Gemini CLI

9.85%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills