agentleFS
handsongicehandsongice/vibe-rules/skills/pre-commit-check/SKILL.md

pre-commit-check

Skill1 starsChanged 3 months agoMITView on GitHub

在 git commit 之前运行的检查清单,确保不把半成品提交进去

  • Reads credentials
  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Pre-commit 检查

触发条件

任何时候要执行 git commit 之前,必须按本清单走一遍。

步骤

  1. 看一眼将要提交什么:git status 和 git diff --stat。如果有意外文件(构建产物、.env、日志、IDE 配置),先处理。
  2. 跑测试:
    • Java:./mvnw test 或 ./gradlew test
    • Python:pytest -x -q
    • Node:pnpm test(或 npm test,看项目 lock)
    • 没测试套件:跑 lint / typecheck(tsc --noEmit / ruff check .)
  3. grep 一遍敏感信息:
    git diff --cached | grep -iE "(api[_-]?key|secret|password|token|AKIA|sk-)"
    命中要确认是不是硬编码。
  4. 写 commit message:按 global/git-workflow.md 的 Conventional Commits 规范。
  5. commit,但不要 push。push 等用户明确说。

验收标准

  • 测试全绿(或用户明确豁免)
  • diff 里没有敏感信息
  • commit message 符合规范
  • git status 干净,没有误提交的文件

常见坑

  • 改了代码但忘了重新生成 lock 文件(pnpm install / pip install 后没 commit lock)。
  • 把调试用的 console.log / print() / System.out.println 留在代码里。
  • 一次 commit 里混了多个不相关改动——拆。

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.