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.

Related rules

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

Claude Agent SDK CLAUDE.md

CLAUDE.md for building agents with the Claude Agent SDK (Python/TypeScript): options, tools, permissions, and hooks.

Claude Code (CLAUDE.md)LLM apps & agents

Code review Copilot instructions

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

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.