pre-commit-check
Skill0 starsChanged 4 months agoMITView on GitHub
Check staged changes before creating a git commit. Reviews the diff for secrets, unrelated changes, debug code, oversized PRs, and matches the repo's commit message style. Use when the user says "commit", "create a commit", "git commit", "commit this", "commit my changes", "ready to commit", "safe to commit", "check my changes", "stage and commit", "push my work", or "I'm done with this task".
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- rikvanriel/code-hygienetheir own version, first seen Sep 17, 2026
- handsongice/vibe-rulestheir own version, first seen Sep 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- handsongice/vibe-rules★ 1same name
- rikvanriel/code-hygiene★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- templates/AGENTS.mdAGENTS.md
- ci-cd-pipelineSkill
- requirements-synthesisSkill
- security-hardeningSkill
- spec-driven-developmentSkill
- workflow-from-chatsSkill
- architecture-decision-recordsSkill
- commit-history-auditSkill
- commit-messageSkill
- deslopSkill
- document-thisSkill
- env-drift-checkSkill
- handoffSkill
- minimal-diff-reviewSkill
- onboardingSkill
- pr-review-canvasSkill
- pr-summarySkill
- release-readinessSkill
- requirements-qaSkill
- sync-docs-after-editSkill
- write-changelogSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
No emoji unless the project convention uses them
- Distinctive: line 88
Run git status to confirm success before reporting done.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
🔍 Pre-Commit Check
Run these in parallel
git status— list staged and unstaged files.git diff --cached— full staged diff.git log --oneline -5— recent commit messages to infer style.git diff --cached --shortstat— line and file counts for size check.
Check the staged diff for
| Issue | Action |
.env, *.key, credentials.*, *secret* staged | Stop. Warn user. Do not commit. |
| Secrets or tokens in changed lines | Stop. Warn user. |
| Changes to files unrelated to the stated task | Flag — do not auto-unstage |
Debug code (console.log, print(, debugger, breakpoint()) | Flag |
| Nothing staged | Do not create an empty commit. Tell the user. |
| >400 lines changed or >10 files touched | Flag as oversized — suggest splitting by concern |
| Multiple unrelated concerns in one diff | Flag — name each concern and suggest separate commits |
Commit message
Format
<type>: <subject> ← max 72 chars, imperative present tense
[optional body] ← wrap at 72 chars, explains WHY not WHAT
[optional footer] ← e.g. Closes #123, Co-authored-by: ...Type prefixes (use the project's convention if one exists)
| Type | When to use |
feat | New user-visible feature |
fix | Bug fix |
refactor | Code restructure, no behaviour change |
test | Adding or updating tests |
docs | Documentation only |
chore | Tooling, config, dependencies |
perf | Performance improvement |
Subject line rules
- Imperative present tense: "add user auth" not "added" or "adding"
- No trailing period
- No emoji unless the project convention uses them
- ≤72 characters — hard limit
Body (include when the change is non-obvious)
- Explain why the change was made, not what the diff shows
- Mention alternatives considered if the choice is non-obvious
- Reference issue numbers:
Closes #42,Refs #17
What to avoid
- "WIP", "fix stuff", "changes" — not searchable or reviewable
- Giant commits mixing unrelated changes — split them
- Committing without staged content
Always pass the message via HEREDOC (per git-safety rule)
git commit -m "$(cat <<'EOF'
feat: add user authentication
Replaces the previous session-token approach with JWT.
Closes #42
EOF
)"# PowerShell (no heredoc support — use a here-string instead):
$msg = @'
feat: add user authentication
Replaces the previous session-token approach with JWT.
Closes #42
'@
git commit -m $msgAfter commit
Run git status to confirm success before reporting done.
Gotchas
- Secret detection here is pattern/filename based — it will miss a secret pasted directly into application code that doesn't match
*.env/*key*/*secret*. Read the actual diff content, not just filenames. git diff --cached --shortstatreports nothing if nothing is staged — checkgit statusfirst, or an empty diff silently passes every check.- Binary files show no line-level diff, so debug-code and secret greps produce false negatives on them — flag binaries added to the diff separately.
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
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.

