Home › Agent workflows › /commit slash command (Claude Code)

/commit slash command (Claude Code)

A Claude Code /commit slash command that reviews staged changes and writes a Conventional Commits message.

Claude Code (CLAUDE.md)Agent workflows

How to use

Save this as .claude/commands/commit.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.claude/commands/commit.mdDownload  
---
description: Review staged changes and create a Conventional Commits commit
allowed-tools: Bash(git status:*), Bash(git diff:*), Bash(git log:*), Bash(git commit:*)
argument-hint: [optional summary or scope]
---

## Context
- Status: !`git status --short`
- Staged diff: !`git diff --cached`
- Recent commits (for style): !`git log --oneline -10`

## Task
1. If nothing is staged, stop and tell me which files have changes; do not stage files yourself.
2. Check the staged diff for problems before committing: secrets or `.env` contents, debug logs, `.only`/focused tests, large generated files, unrelated changes mixed together. If you find any, stop and list them.
3. Write one commit message in Conventional Commits format:
   - `type(scope): summary`, imperative, lowercase, ≤ 72 chars, no period.
   - Types: feat, fix, refactor, perf, test, docs, build, ci, chore. Use `!` plus a `BREAKING CHANGE:` footer for breaking changes.
   - Body (wrapped at 72) explaining why, if the change isn't obvious.
   - Use this hint from me if given: $ARGUMENTS
4. Commit with `git commit -m "<summary>" -m "<body>"`.
5. Show the resulting `git log --oneline -1`.

Never use `--no-verify`, `--amend`, or push.

More: all Agent workflows rules · all Claude Code (CLAUDE.md) rules

Related rules

Code review Copilot instructions

Copilot instructions focused on pull request review: what to flag, severity labels, and how to word comments.

GitHub CopilotAgent workflows

Code reviewer subagent (Claude Code)

A Claude Code subagent definition that reviews the current diff for bugs, security, and tests, reporting by severity.

Claude Code (CLAUDE.md)Agent workflows

Git commits & PRs AGENTS.md

AGENTS.md rules for how agents commit: Conventional Commits, atomic changes, safe git commands, and PR descriptions.

AGENTS.mdAgent workflows

Debugger subagent (Claude Code)

A Claude Code subagent for root-cause analysis of errors, crashes, and failing behavior, with a verified minimal fix.

Claude Code (CLAUDE.md)Agent workflows

Systematic debugging CLAUDE.md

CLAUDE.md workflow for debugging with Claude Code: reproduce, isolate, hypothesize, verify, and avoid guess-fixes.

Claude Code (CLAUDE.md)Agent workflows

Markdown docs Copilot path instructions

Path-specific Copilot instructions for Markdown docs and READMEs: structure, runnable commands, and concise style.

GitHub CopilotAgent workflows

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.