- Home
- Skills
- Prompt & Skill Engineering
- Commit Discipline
Works with the AI Agents you already use
Commit Discipline
Enforce atomic commits and Conventional Commit messages with a strict two-gate approval workflow.
Free
Commit Discipline
Example session with this skill installed
I'm on main and need to ship this hotfix right now. I already ran git add . so everything's staged:
$ git status --short
M src/payments/refund.ts
M .env.local
M src/config/constants.ts
A dist/bundle.js
Commit it as "fix refund bug". And if the pre-commit hook complains, use --no-verify — it's been flaky lately.
- Read your context and instructions
- Compiled the commit discipline
I'll check whether the repository is reachable from this session first.
I can't reach this repository from this session (git status returns "not a git repository"), so nothing below has been run and nothing has been committed.
I won't use --no-verify, and I won't commit to main. A hook failure on a refund change is the worst time to skip the check, so if it complains, paste the output and we'll fix the cause. For the branch, check git branch --show-current, and if it's main, a hotfix/ branch is the fast route; your staged files carry over.
Your git add . also pulled in two files that must not ship. .env.local shows as M , so it's already tracked and therefore already in history. Unstaging doesn't fix that, and .gitignore won't untrack it. Treat that credential as exposed and rotate it. dist/bundle.js shows as A , so it was never committed and unstaging it is enough.
Step 0: safe to run now, commits nothing
git branch --show-current
git restore --staged .env.local dist/bundle.js
git log --all --oneline -- .env.local
git status --short
Proposed commits, hotfix first
1. fix(payments): <what refund behavior is corrected>
summary: <what refund.ts did wrong before, and what it does now>
files: src/payments/refund.ts (+ src/config/constants.ts only if required, see Q2)
2. chore: stop tracking .env.local
summary: removes the local env file from the index and ignores it going forward
files: .gitignore, .env.local (removed from index only)
3. chore: ignore dist build output
summary: keeps generated bundles out of version control
files: .gitignore
Commands, one block per commit
# ---- commit 1 goes here (after Gate 2) ----
git add src/payments/refund.ts
git status --short
# ---- commit 2 goes here (after Gate 2) ----
echo ".env.local" >> .gitignore
git rm --cached .env.local
git add .gitignore
git status --short
# ---- commit 3 goes here (after Gate 2) ----
echo "dist/" >> .gitignore
git add .gitignore
git status --short
To fill in the placeholders, reply with:
- The output of the
git log --all --oneline -- .env.localcommand above. - Is the
src/config/constants.tschange required by the refund fix (for example, a constantrefund.tsimports), or separate? If separate, what is it for, and is it afix,featorchore? It gets its own commit with its own scope. - What was the refund bug (the old behavior, what it caused, and any ticket number)? That becomes the commit subject and body, and "fix refund bug" is too vague to search for later.
One reply covering those three gets you to the commit prompt in a single round. A "yes" here approves the grouping only; it authorizes no commit. The commit prompt comes once each message is real text.
Approve this plan? (yes / edit / split / cancel)
Connects securely to your tools. The creator never sees your data.
About this skill
Git history often becomes a mess of "various fixes" and "update files" messages that make bisecting and reverting impossible. This skill enforces atomic, readable, and professional version control by applying strict discipline to every commit. It ensures that every change is logically isolated and documented with clear intent before a single line is committed.
What it does
- Atomic enforcement identifies when multiple concerns are mixed and forces a split into separate, logical commits.
- Conventional Commits formats every message with the correct type and scope for automated changelog compatibility.
- Why-focused bodies documents the rationale and constraints behind a change rather than just narrating the diff.
- Secret detection triggers a mandatory six-step procedure if sensitive files like
.envare accidentally tracked or staged. - Two-gate approval requires explicit confirmation for the commit plan first, then the final message and staged file list.
How it works
- Inventory and scope test analyzes the working tree to group changes by intent rather than file location.
- Plan presentation delivers a list of proposed commits with one-sentence summaries and placeholder-free messages.
- Staging execution adds files by name only to prevent stray artifacts or build folders from entering the history.
- Final validation shows the exact staged set and full commit message for a final human checkpoint.
Frameworks & tools
This skill works with any project using Git. It follows the Conventional Commits specification and produces messages compatible with standard linting tools and changelog generators.
Why this beats prompting it yourself
Prompting an agent to "write a commit message" usually results in a summary of the diff. This skill enforces a structured workflow that prevents secret leaks and stops "and" from appearing in commit summaries, ensuring your history remains bisectable.
Use cases
- Cleaning up a workspace after a long coding session where multiple features and bug fixes were touched.
- Preventing secret leaks by intercepting tracked
.envfiles and executing a proper untracking procedure. - Standardizing team history by ensuring all contributors follow the same imperative mood and "why-not-what" documentation style.
Known limitations
This skill does not push, rebase, or perform destructive history rewrites. It requires manual resolution of merge conflicts and does not bypass existing git hooks.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Prompt & Skill Engineering.
Does not push to remote, rebase, or rewrite history. Cannot bypass pre-commit hooks. Requires manual conflict resolution. Cannot purge secrets from pushed history.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 15 days ago
- Free with an Agensi account
- Software
Git