safe-commit
Skill1 starsChanged 3 months agoMITView on GitHub
Run a security review on staged changes, generate a commit message tied to the original spec from /work, and commit only after explicit user confirmation. Never bypasses hooks.
- Reads credentials
3 other projects use a version of this.
Adopted by
Most recently taken up by
- IgorKonovalov/market-analyzertheir own version, first seen Sep 4, 2026
- munvard/docktermtheir own version, first seen Jun 12, 2026
- niyaznurbhasha/claude-skillstheir own version, first seen Apr 7, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- munvard/dockterm★ 48same name
- IgorKonovalov/market-analyzer★ 2same name
- niyaznurbhasha/claude-skills★ 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 repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- architectureSkill
- code-reviewSkill
- commandsSkill
- conventionsSkill
- debugSkill
- decisionSkill
- explainSkill
- isolateSkill
- issueSkill
- journeysSkill
- onboardSkill
- quick-workSkill
- safe-pushSkill
- scaffoldSkill
- todoSkill
- workSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 0 are common, 8 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
If nothing is staged, tell the user: "No staged changes.
- Distinctive: line 20
If there are staged changes, present:
- Very specific: line 38
If must-fix findings exist: stop and tell the user "There are must-fix findings.
- Distinctive: line 39
If should-fix only: ask "Want to address these now or note them for follow-up?"
- Distinctive: line 40
If nice-to-have or clean: proceed to Phase 3.
- Very specific: line 46
If /security-review isn't available or fails, fall back to manually scanning for:
- Distinctive: line 71
Check for a persisted spec:
- Very specific: line 77
If specs exist, read the newest one with Status: in-progress.
- Very specific: line 81
If the diff includes changes outside the spec's scope, suggest splitting the commit (git reset and re-stage) so each commit maps to one …
- Very specific: line 83
If no spec file exists but the user followed /work in this same session, fall back to asking: "Briefly — does this commit deliver the spec …
- Very specific: line 85
If they didn't use /work at all, skip this phase.
- Distinctive: line 110
If they revise, regenerate.
- Very specific: line 116
Never use
--no-verify: If a hook fails, surface the failure and ask the user how to handle it. - Very specific: line 133
Don't add Co-Authored-By: Claude unless the repo opts in via its own CLAUDE.md or the conventions file's GIT ETIQUETTE section records a …
- Very specific: line 134
Don't bypass git hooks with --no-verify for any reason.
- Distinctive: line 135
Don't commit if blockers exist.
- Distinctive: line 136
Don't generate a generic message ("update files", "minor changes").
- Distinctive: line 137
Don't auto-amend. If the user wants to amend, they ask explicitly.
“Common” is measured: kept by at least 6 in 10 of the 3 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.
Files
/safe-commit — Reviewed commit
You are Claude. The user is about to commit staged changes. Your job is to make this commit safe and intentional, not autopilot.
Phase 1 — Inspect what's staged
Run:
git status --short
git diff --cached --statIf nothing is staged, tell the user: "No staged changes. Run git add <files> first, then /safe-commit again." Stop.
If there are staged changes, present:
STAGED CHANGES
Files: <count>
Lines: +<added> / -<removed>
<list of files with their diff stat>Phase 2 — Code review (quality and correctness)
Invoke /code-review against the staged changes. This is the quality pass: naming, complexity, pattern adherence, test coverage, edge cases, error handling, performance traps.
Present the standard /code-review output (must-fix / should-fix / nice-to-have / strengths).
Decision tree:
- If must-fix findings exist: stop and tell the user "There are must-fix findings. Address them, re-stage, and run
/safe-commitagain. I'm not going to commit code that wouldn't pass PR review." - If should-fix only: ask "Want to address these now or note them for follow-up?"
- If nice-to-have or clean: proceed to Phase 3.
Phase 3 — Security review
Invoke /security-review against the staged diff (built-in Claude Code skill). This is a separate concern from quality — it looks specifically for threat patterns: hardcoded secrets, injection, auth/permission changes, unverified inputs, leaked PII, etc.
If /security-review isn't available or fails, fall back to manually scanning for:
- Hardcoded secrets (API keys, tokens, passwords) — match patterns like
sk-,Bearer,AKIA,xoxb-,ghp_,password = "..." - New env vars referenced without being added to
.env.example - Suspicious changes to authentication, authorization, or permissions code
- New external HTTP calls without timeouts or error handling
- SQL queries built with string concatenation (potential injection)
- Disabled tests or skipped assertions
.env,.pem,id_rsa, or any other obvious secret file accidentally added
Present findings in this format:
SECURITY REVIEW
✓ <N> checks passed
⚠ <N> warnings:
- <warning 1 with file:line>
✗ <N> blockers (if any):
- <blocker 1 with file:line>Same decision tree as Phase 2: blockers stop the commit, warnings prompt the user.
Phase 4 — Verify spec alignment (if /work was used)
Check for a persisted spec:
ls -t .claude/specs/*.md 2>/dev/null | head -3If specs exist, read the newest one with Status: in-progress. Compare the staged diff against its "Changes / does NOT change" and "Success criteria" sections, then tell the user:
"Spec check against
.claude/specs/<file>: <delivers the spec / partially — X is missing / includes out-of-scope changes: Y>"
If the diff includes changes outside the spec's scope, suggest splitting the commit (git reset and re-stage) so each commit maps to one spec. After a commit that completes the spec, update its Status: to done.
If no spec file exists but the user followed /work in this same session, fall back to asking: "Briefly — does this commit deliver the spec from /work Phase 1?"
If they didn't use /work at all, skip this phase. Don't lecture them.
Phase 5 — Commit message
Generate a commit message that follows this structure:
<type>: <subject in imperative mood, max 72 chars>
<2-4 sentence body explaining the WHY, not just the what>
<reference issue if applicable: "Refs #47" or "Closes #47">Types: feat, fix, refactor, chore, docs, test, perf, style.
The body should answer: why was this change necessary? Not "I changed X to Y" but "X was failing under condition Z because of constraint W; Y handles it correctly."
Trailer resolution (Co-Authored-By: Claude) — decide before showing the message, in this order:
- The repo's own CLAUDE.md states a rule (opt-in or prohibition) — it wins.
- The conventions file (
.claude/conventions.mdor its.localvariant) has aGIT ETIQUETTEsection — recorded by/onboard's first-run question — honor it. - Neither exists — no trailer (the default).
Show the user the message and ask: "Commit with this message?"
If they revise, regenerate. If they approve, run:
git commit -m "<subject>" -m "<body>"Never use --no-verify. If a hook fails, surface the failure and ask the user how to handle it. Don't bypass hooks.
If the commit is blocked by the framework's commit gate (message mentions COMMIT GATE / .claude/review-passed): the staged diff no longer matches the last review — something was staged after Phase 2. Do NOT use the SKIP_REVIEW_GATE override; re-run /code-review so the receipt covers exactly what is being committed, then retry.
Phase 6 — Confirmation
After commit succeeds:
git log --oneline -1
git statusConfirm the commit landed, working tree state is what the user expected. Don't push — that's /safe-push.
What NOT to do
- Don't add
Co-Authored-By: Claudeunless the repo opts in via its own CLAUDE.md or the conventions file'sGIT ETIQUETTEsection records a yes. - Don't bypass git hooks with
--no-verifyfor any reason. - Don't commit if blockers exist.
- Don't generate a generic message ("update files", "minor changes"). If you can't articulate the why, ask the user.
- Don't auto-amend. If the user wants to amend, they ask explicitly.
- Don't push.
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.

