Get the FREE Ultimate OpenClaw Setup Guide →

commit

Scanned
npx machina-cli add skill mkrtchian/spec-driven-dev/commit --openclaw
Files (1)
SKILL.md
2.0 KB

Objective

Create a clean, well-scoped git commit following conventional commits.

1. Understand the changes

Run in parallel:

  • git status (never use -uall)
  • git diff and git diff --cached to see staged and unstaged changes
  • git log --oneline -5 to 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 -A or git 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 functionality
  • fix — bug fix
  • docs — documentation only
  • refactor — code change that neither fixes a bug nor adds a feature
  • test — adding or updating tests
  • chore — 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-By trailer 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 feat or fix, not refactor. A rewording that changes behavior is a fix; a new capability is a feat. Reserve refactor for 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

  1. Step 1: Run git status, git diff, and git log --oneline -5 to understand changes
  2. Step 2: Stage relevant files by name with git add <path> (never use git add -A or git add .) and ensure secrets are excluded
  3. 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

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers