sd0xdev/sd0x-dev-flow/smart-commit
Claude Code and agent skill by sd0xdev/sd0x-dev-flow
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Smart batch commit. Analyzes uncommitted changes, groups by cohesion, generates commit messages matching project style. Default: output git commands for manual execution. With --execute: directly run git add + git commit (requires user approval, except under a user-set goal — see Goal mode — or the adopted task-autonomy policy — see Auto commit). Use when: user says 'commit', 'batch commit', 'prepare commit', 'write commit message', or /smart-commit
Install
npx vskill@latest install sd0xdev/sd0x-dev-flow/smart-commitSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as sd0xdev/sd0x-dev-flow/smart-commit.
Smart Commit
Read first: @skills/push-ci/references/authorization-contract.md before --execute commits anything — § Proactive Offer for the menu and the four Goal mode conditions, § Task autonomy for the Auto commit conditions, § Efficacy Boundary for what the per-use approval authorizes. If that Read fails, stop and report it; commit nothing (manual mode, which only prints commands, is unaffected).
Analyze uncommitted changes → group by cohesion → generate commit messages → output git commands (or execute directly with --execute).
Workflow
Git Environment Policy (applies to every step below)
Every git command this skill runs itself — read or write, either mode — resolves the same question: which repository, tree, index, ancestry and configuration does it act on? The answer is pinned two ways, both defined in git-environment.md § 1: the inherited GIT_* variables are stripped, and every command carries -C "$REPO_ROOT".
Where the stripping happens depends on who runs git:
| Callee | How the policy is applied | |
|---|---|---|
A fence running git inline | The canonical env -u prefix, written out literally — never through a variable, because zsh does not word-split an expansion used as a command prefix | |
A helper that runs its own git commands and does not strip (git-profile.sh) | The prefix goes on the delegation, at the boundary | |
A helper that strips the same list itself (smart-commit-inspect.sh, smart-commit-execute.sh) | No prefix — the script's own unset block is the policy, and prefixing it as well would state the same rule twice in two places that could drift |
Every /bin/bash -p -- "$INSPECT" … call is the third row — all ten of them, across Steps 1b–1e, 3, 4, 5a and 6 — because smart-commit-inspect.sh unsets the list once for the whole process. $REPO_ROOT is still re-derived in every fenced block: each block is a separate shell, so nothing carries over.
What the skill prints is governed by § 2 of that file — the same list, the same spelling.
Step 1: Detect Permissions + Learn Style
1a. Permission Detection
Read CLAUDE.md and .claude/rules/git-workflow.md to determine mode:
| Mode | Condition | Behavior | |
|---|---|---|---|
| manual | No --execute flag (default) | Output commands only | |
| execute | --execute flag passed | Execute directly (with user approval via AskUserQuestion — or, under § Goal mode, without it) |
Default to manual mode. Direct execution requires explicit --execute flag regardless of project git restrictions.
`--execute` mode: When --execute is passed, use AskUserQuestion to show the full commit plan and get explicit user approval before executing. This is a skill-level exception to git-workflow rules (same pattern as /push-ci). The one exception to asking is § Goal mode below. § Auto commit below replaces the question the same way, under its own conditions.
Goal mode (git-autonomy FR-17)
While a goal the user set or approved is active, and rules/git-workflow.md § Proactive Offer "Goal mode" says all four of its conditions hold — re-checked before every commit, including review-state.js goal-commit --format=json returning ok: true — --execute runs without the plan approval: the plan is printed, headed by one record line, and execution proceeds:
The goal text itself is never printed — a user may have put a secret in it. Everything else in this skill is unchanged: every diagnostic and HALT, the sensitive-file exclusion, the attribution guard on smart-commit-execute.sh commit, and every judgement question (an identity conflict, an ambiguous grouping, a --sign/--no-sign override) still asks. --ai-co-author is never passed on this path: when the user explicitly asks for it, Goal mode does not apply and the ordinary per-use approval runs, so the attribution whitelist is always reached through the user. needs_branch_allowance: true means the first goal-mode commit on that protected branch asks first (recommend a feature branch; if declined, ask to allow the branch for this goal).
Auto commit (git-autonomy R8)
Where the task-autonomy policy the user adopted says Auto Commit: on, --execute commits a task without the plan approval when @skills/push-ci/references/authorization-contract.md § Task autonomy "Auto commit" says all four of its conditions hold — re-checked before every commit. The procedure around it (task start, ownership, branch) is references/task-contract.md.
- Gates first. Every gate the change requires has passed after the last edit — review,
/precommit, the Adequacy Gate where it applies, Doc Sync and its doc review. A gate that is stale is run, through the auto-loop, before anything else; this path never commits on a warning (Step 2's advisory row does not apply here).
- The check.
node <scripts>/review-state.js task commit-check --format=jsonmust return
ok: true. Its candidate list is the selection — the whole dirty set, every path declared by the task with task own — and replaces the live-status selection of Step 3. Any reasons entry (baseline-dirty, unowned, staged, sensitive, gates-open, protected, …) means this path does not run: the ordinary per-use approval does, with the reason stated. Never commit a subset, and never stash, reset or git add -p to make the check pass. In a plan with more than one group the check runs again before each later group: inside the batch it answers with the remaining candidates, and batch-broken stops the batch there: a commit since the task's tip that is not one of the batch's own groups (another parent count, a path the check did not plan, content other than what it recorded), or a tree that no longer digests to what it recorded.
- Print, then commit. The plan is printed, not asked, headed by
[AUTO_COMMIT] task=<id> | branch=<branch> | digest=<digest> | <ISO8601>; each group stages exactly its candidates. When the plan has more than one group, it adds final tree verified; the intermediate commits were not verified on their own.
- Verify. After the last group,
review-state.js task committedmust returnok: true— the
commits sit on the task's tip, the tree is clean, and the final committed tree (every path, mode and object) digests to exactly what the gates passed at. ok: false is reported as it reads (tree-mismatch, not-clean); the commit stays local and is never published.
Everything Goal mode keeps, this path keeps: every diagnostic and HALT, the attribution guard, verify-last, every judgement question; --ai-co-author is never passed on it.
1b. Learn Commit Style
Infer format, type vocabulary, subject conventions (capitalization/tense/ticket ID), and language from recent commits.
| Condition | Behavior | |
|---|---|---|
| Commits listed | Infer the convention from them | |
Non-zero exit, does not have any commits yet on stderr | Not an error — this is the first commit of a new repository, which is a case /smart-commit exists for. Fall back to the default <type>: <subject> convention and continue. Do not apply the "stop and report the stderr" rule the later steps carry: they read state a commit depends on, this one reads history that may legitimately be empty | |
| Any other non-zero exit | Stop and report the stderr — the repository could not be read |
1c. Identity Diagnostics
Shared diagnostic (preferred path):
The prefix goes on the delegation, not inside the helper: git-profile.sh runs its own git commands, and stripping at the boundary is what makes it and the fallback below agree. The interpreter is /bin/bash -p -- for the reason given once in execute-mode.md § Why the entrypoint is spelled `/bin/bash -p --` — it applies here too, and this is the path whose JSON decides HALT versus continue.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/smart-commit/SKILL.md
Popularity
- Repository stars
- 157
- Repository forks
- 21
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 23 May 2026, 6 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sd0xdev/sd0x-dev-flow/smart-commit)