
Smart Commit
Turn a messy working tree into one or more conventional commits with pre-push issue checks when you say commit or /commit.
Overview
smart-commit is an agent skill for the Ship phase that clusters your git changes, drafts conventional commit messages, checks for common issues, and commits per group after you confirm the plan.
Install
npx skills add https://github.com/fearovex/claude-config --skill smart-commitWhat is this skill?
- Reads full working tree via git status --porcelain and staged diff via git diff --cached
- Groups changed files into functional clusters (test, docs, chore, directory prefix)
- Builds a multi-commit plan with one conventional message per group and user confirmation
- Flags secrets, debug statements, and large files before commits execute
- Falls back to a single-commit flow when everything maps to one cluster
- Matches recent commit message style from the last 5 oneline log entries
- Step 1 mandates git status --porcelain, git diff --cached, and git log --oneline -5
Adoption & trust: 1 installs on skills.sh; 1 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
You are ready to commit but your working tree mixes tests, docs, and chores and you do not want one sloppy message or to leak secrets on push.
Who is it for?
Solo builders who want Conventional Commits-style history and automatic grouping without writing commit messages from scratch.
Skip if: Repos that forbid partial staging, require signed commits only via external tooling, or need commit messages entirely outside conventional format without override.
When should I use this skill?
When the user says "commit", "smart commit", or /commit.
What do I get? / Deliverables
You get an approved multi- or single-commit plan with conventional messages and executed git commits, with issue flags reviewed before anything is pushed.
- Multi-commit execution plan with user confirmation
- One or more git commits with conventional messages per file group
Recommended Skills
Journey fit
Ship is where you finalize changes and review before they leave your machine; this skill runs at commit time with explicit pre-push hygiene. Review covers structured examination of diffs and safety signals (secrets, debug noise, large blobs) before changes are recorded.
How it compares
Use instead of typing git commit -m in chat without reading the full diff or grouping related files.
Common Questions / FAQ
Who is smart-commit for?
Developers using Claude Code, Cursor, or similar agents who want structured git commits from the full working tree, not just whatever happens to be staged.
When should I use smart-commit?
Say commit, smart commit, or /commit when committing staged or unstaged work, when you want conventional messages, or when you want secrets and debug checks before push.
Is smart-commit safe to install?
It runs local git and diff commands on your repo; review the Security Audits panel on this page and never commit if the skill flags suspected secrets until you verify.
SKILL.md
READMESKILL.md - Smart Commit
**Triggers**: When the user says "commit", "smart commit", or /commit. ## When to Use **Triggers**: When the user says "commit", "smart commit", or /commit. - Committing staged changes in any git repository - When you want a well-structured conventional commit message - When you want automatic detection of common commit issues before pushing --- ## Process ### Step 1 — Read working-tree state Run these commands and collect their output: ```bash git status --porcelain # full working-tree state: staged, unstaged, untracked git diff --cached # full diff for content analysis (staged changes) ``` Also check: ```bash git log --oneline -5 # recent commits to match message style ``` Parse the `git status --porcelain` output and assign a **staging-status** tag to each file: - Lines where `XY = "??"` → tag `untracked` - Lines where X is `A`, `M`, `R`, `D`, or `C` (index column non-space) → tag `staged` - If X = `R` (rename), split the entry on `" -> "` and include both the old path and the new path; both receive tag `staged` - Lines where X = `" "` and Y is `M`, `D`, or `T` (worktree column non-space) → tag `unstaged` - When both X and Y are non-space (staged change also has worktree modifications), the index change takes precedence: tag `staged` If `git status --porcelain` returns empty output, report: > Nothing to commit. Working tree is clean. And stop — do not proceed. ### Step 1b — Group detected files Using the file paths collected in Step 1, apply the following grouping heuristic in priority order. Each detected file is assigned to exactly one group — the first rule that matches wins, and the file is not reconsidered by later rules. Each file's `staging-status` tag (assigned in Step 1) travels unchanged through the grouping step and is preserved in the group record. **Rule 1 — Test files** (highest priority, applied before any directory check): - Paths matching `*.test.*`, `*.spec.*`, `_test.*`, or `*_test.*` → group `test` - This rule applies regardless of which directory the file lives in. **Rule 2 — Config/infra files**: - Root-level files (no subdirectory) matching `*.json`, `*.yaml`, `*.yml`, `*.toml`, `*.sh`, or `*.env*` → group `chore` **Rule 3 — Docs files**: - Paths under `docs/` → group `docs` - Root-level files matching `*.md` or `README*` → group `docs` **Rule 4 — Directory prefix**: - Remaining files are grouped by their first path segment (e.g., `skills/smart-commit/SKILL.md` → group `skills`; `hooks/smart-commit-context.js` → group `hooks`) **Fallback**: - Files that match none of the rules above (e.g., a root-level `foo.rb` with no subdirectory and no recognized extension) → group `misc` No detected file may appear in more than one group. Every detected file must appear in exactly one group. **Single-group fast-path**: If grouping produces exactly one group → skip the multi-commit plan and fall through to Step 2 unchanged. Behavior is identical to the pre-grouping version of this skill. If the single group contains any files tagged `unstaged` or `untracked`, print `Auto-staging N file(s): <list of those files>` then issue `git add <unstaged/untracked files>` before proceeding to Step 2. **Multi-group branch**: If grouping produces two or more groups → proceed to Step 1c (multi-commit plan) before executing any commit. ### Step 1c — Presen