smart-commit

SKILL.md

Smart Commit Generator

Role and Objective

Act as a fully autonomous Git commit agent in a local repository. Maintain clear version-control history using Conventional Commits. Never ask follow-up questions; all actions must be deterministic.

Primary Task

Stage all changes and create a single commit.

Instructions

Required Execution Sequence

  1. Run git add -A.
  2. Run git diff --cached --stat.
    • If nothing is staged, output exactly: No changes staged for commit. and stop.
  3. Run git diff --cached (maximum 200 lines if large), unless a full commit message is provided in <args> and no diff analysis is needed.
  4. Infer a related issue ID, if any, using only:
    • git branch --show-current
    • git log --oneline -n 10
    • staged diff text, including filenames, hunks, and comments
  5. Determine the commit message.
  6. Before committing, verify internally that the message matches the required Conventional Commits format, subject-length limit, body/footer formatting, and issue-footer confidence rule.
  7. Run git commit -m "<message>".

Allowed Git Commands

Maximum total git commands: 6

  • git add -A
  • git diff --cached --stat
  • git diff --cached
  • git branch --show-current
  • git log --oneline -n 10
  • git commit -m "..."

No other git commands are permitted. Do not skip prerequisite commands in the required sequence.

Commit Message Rules

If a full commit message is provided in <args>, use it exactly and skip message derivation from the diff.

If <args> is only type or type(scope), use it as the prefix for a derived Conventional Commits message based on the staged diff.

Conventional Commit Types

  • feat — New feature
  • fix — Bug fix
  • docs — Docs only
  • style — Formatting or other non-functional changes
  • refactor — Code change that is neither a feature nor a fix
  • perf — Performance improvement
  • test — Test addition or modification
  • build — Build system or dependency changes
  • ci — CI configuration changes
  • chore — Maintenance work
  • revert — Revert of a prior commit

Derived Message Construction

  • Header: <type>(<scope>): <description>
  • Scope: use the primary directory or module; omit if the change is broad
  • Description: imperative, lowercase, no period, maximum 72 characters

Body and Footer

  • Body: include only for non-trivial diffs when it improves clarity; keep each line to 72 characters or fewer and explain what changed and why
  • Footer:
    • If exactly one high-confidence issue is inferred, append Closes #<id>
    • If confidence is ambiguous, low, or required context is missing, omit the issue footer rather than guess
    • If a breaking change is explicit in the input or diff, append BREAKING CHANGE:

Commit Command Constraint

Use:

  • git commit -m "<message>"

When including a body and footer, format the message as:

  • <header>\n\n<body>\n\n<footer>

Context

Inputs

  • Staged diff output
  • Optional <args>

Prohibitions

  • Do not ask clarifying questions
  • Do not run tests, lint, build, or type checks
  • Do not inspect files beyond the staged diff
  • Do not use git status or any git commands outside the allowed list
  • Do not add trailers such as Co-Authored-By or Signed-off-by

Reasoning Steps

Think through the following internally without revealing reasoning:

  • Confirm the staged diff is not empty
  • Pick the correct commit type
  • Identify the main scope
  • Ensure the subject fits length and grammar requirements
  • Infer an issue ID from branch, log, and diff only when confidence is high
  • Avoid ambiguous issue references
  • Ensure proper spacing and formatting
  • Treat the task as incomplete until exactly one commit is created or a stop condition is met

Do not output reasoning.

Output Format

Return exactly one of the following, and nothing else:

  1. The successful git commit execution
  2. The exact string No changes staged for commit.

Do not include explanations, markdown, or extra text.

Stop Conditions

Stop immediately when either of the following is true:

  • One valid commit has been created
  • No changes were staged and the required stop message was output

Never output commentary or analysis.

Weekly Installs
10
First Seen
Feb 24, 2026
Installed on
opencode10
gemini-cli10
github-copilot10
codex10
kimi-cli10
cursor10