Install
$ agentstack add skill-yuaicode-ai-skills-commit-guard-zh ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
commit-guard-zh — 提交/推送前护栏 + 中文 commit
提交前在本地把关,别让密钥、迁移炸弹、误推主分支溜进仓库;干净了再帮你写一条规范的中文 commit。
何时触发
用户说"准备提交 / 帮我 commit / 提交一下 / 要 push 了"等。
工作流
1. 跑检查(确定性脚本,在仓库根目录执行)
bash /bin/secret-scan.sh # 扫 staged diff 的密钥/凭据
# 若该 repo 是 Go+GORM(.commit-guard.sh 里 ENABLE_GORM_CHECK=1):
bash /bin/gorm-mysql-check.sh # 扫 staged .go 的 TEXT/JSON 带 DEFAULT
# 若启用了 md lint(ENABLE_MD_LINT=1,需装 markdownlint-cli):
bash /bin/markdownlint-check.sh # 扫 staged .md(未装 linter 则自动跳过)
- 任一脚本
exit 2→ 停下。把 stderr 里的问题用中文讲清楚 + 给修法,等用户处理,不要擅自跳过或--no-verify。 - 全
exit 0→ 进入下一步。
2. 生成中文 commit
读 git diff --cached,生成一条 conventional 前缀 + 中文描述的 message:
- 前缀按改动性质:
feat:/fix:/refactor:/docs:/test:/chore: - 描述用中文;代码标识符、API、库名保持英文
- 多个改动点用 body 分条
- 展示给用户确认后再
git commit
3. 若要推送
bash /bin/push-guard.sh
- 推到受保护分支(默认 main/master)时:先确认本回合用户是否已明确授权推送主分支(这是会自动部署/影响线上的高风险操作)。授权了再
COMMIT_GUARD_CONFIRM=1 git push。 - 脚本若报 env/密钥文件混进待推提交 → 停下,协助移除。
也可装成 git hook(不依赖 Claude)
确定性检查能装进目标 repo 的 pre-commit / pre-push,这样手动 git 操作也有护栏:
bash /install.sh /path/to/your-repo
详见 [README](./README.md)。
配置
目标 repo 根目录放 .commit-guard.sh(从 config.example.sh 复制):
BRANCH_PROTECT="main master"— 受保护分支ENABLE_GORM_CHECK=0— 是否启用 GORM 检查(仅 Go+GORM 项目;默认关)ENABLE_MD_LINT=0— 是否启用 markdownlint 检查 .md(需 markdownlint-cli;默认关,未装自动跳过)SECRET_WHITELIST=""— secret 误报白名单(extended regex)
边界
- 只看本次 staged / 本次待推的提交,不扫历史、不联网。
- secret 命中宁可误报也拦,误报走白名单豁免。
- 不替代 CI,是本地前移的快速护栏。
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: YuAICode
- Source: YuAICode/ai-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.