commit
Scannednpx machina-cli add skill mkrtchian/spec-driven-dev/commit --openclawObjective
Create a clean, well-scoped git commit following conventional commits.
1. Understand the changes
Run in parallel:
git status(never use-uall)git diffandgit diff --cachedto see staged and unstaged changesgit log --oneline -5to see recent commit style
Read changed files if needed to understand intent — don't guess from filenames.
2. Stage
- Stage relevant files by name — never
git add -Aorgit add . - Never stage files that look like secrets (
.env, credentials, tokens) - If unrelated changes are mixed, ask the user whether to split into multiple commits
3. Write the commit message
Follow conventional commits: type(scope): description
Types (pick the most accurate):
feat— new functionalityfix— bug fixdocs— documentation onlyrefactor— code change that neither fixes a bug nor adds a featuretest— adding or updating testschore— build, CI, dependencies, tooling
Rules:
- Subject line only — never add a body. One line is enough.
- Subject line: imperative mood, lowercase, no period
- Scope is optional — use it when it clarifies (e.g.,
feat(auth):,fix(parser):) - Never use a scope just to have one
- Always add a
Co-Authored-Bytrailer with your own model name and version (you know which model you are) - In this repo, skills and agents are the product — changes to them are almost always
featorfix, notrefactor. A rewording that changes behavior is afix; a new capability is afeat. Reserverefactorfor pure structural reorganization with no behavioral change.
4. Commit
Use a HEREDOC for the message:
git commit -m "$(cat <<'EOF'
type(scope): description
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"
5. Confirm
Run git status after commit to verify clean state. Show the user the commit hash and message.
Source
git clone https://github.com/mkrtchian/spec-driven-dev/blob/main/.claude/skills/commit/SKILL.mdView on GitHub Overview
Create clean, well-scoped git commits using conventional commits. This skill guides you through understanding changes, staging only relevant files, and writing a one-line subject with an optional scope, plus a Co-Authored-By trailer. It emphasizes verification after each commit to ensure a clean history.
How This Skill Works
You inspect changes with git status, git diff, and git log to understand intent. Then stage files by name (avoid git add -A or git add .), craft a one-line subject following type(scope): description, and commit via a HEREDOC including a Co-Authored-By trailer, then verify with git status.
When to Use It
- Preparing a new feature with a clear scope
- Fixing a bug with targeted changes
- Updating project documentation
- Separating unrelated changes into distinct commits
- Collaborative work requiring traceable authorship
Quick Start
- Step 1: Run git status, git diff, and git log --oneline -5 to understand changes
- Step 2: Stage relevant files by name with git add <path> (never use git add -A or git add .) and ensure secrets are excluded
- Step 3: Create the commit using a heredoc, for example: git commit -m "$(cat <<'EOF' type(scope): description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> EOF )" and then run git status to verify a clean state
Best Practices
- Only stage files by name; avoid accidentally including secrets
- Choose the most accurate type: feat, fix, docs, refactor, test, or chore
- Write a concise subject in imperative mood with no trailing period
- Include an optional scope only when it adds clarity
- Always add a Co-Authored-By trailer with your model name and version
Example Use Cases
- feat(auth): add OAuth login flow
- fix(parser): handle null input gracefully
- docs(readme): document conventional commit approach
- test(ui): add snapshot tests for modal
- chore(deps): bump libraries to latest