Skip to main content
command CX Codex

commit · carlrannaberg — Claude Code command: what it does, how to install

Builds a git commit that matches your project's conventions: scans the diff, updates docs, writes the message.

MIT ★ 763 updated 2026-03-31

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/commit.md
Open on GitHub

What commit does

The command assembles a commit in whatever style the repo already uses. It first checks whether the last few messages already hold /git:status output and reuses it. Otherwise it fires one bash call: status --porcelain=v1, diff --stat, the diff itself capped at 2000 lines, and log --oneline -5.

From there it looks for secrets, leftover debug code and throwaway scripts in the diff, checks whether README or CHANGELOG need a touch, runs tests and lint, stages files, and writes the message. Conventions come from CLAUDE.md or AGENTS.md. When neither file has them, the command reads recent history and appends a "Git Commit Conventions" section to CLAUDE.md — that edits a tracked file, so read the change before you accept the commit.

The diff is truncated at 2000 lines, so a large refactor shows up only partly; the full file list lives in diff --stat. Merge commits, conflicts and rebase go to the git-expert subagent through Task. Allowed tools: Bash(git:*), Read, Edit, Task.

What it helps with

  • write a commit message that matches repo conventions
  • catch API keys and debug leftovers before they land
  • document commit conventions in CLAUDE.md when none exist
  • keep README and CHANGELOG in sync with the change
  • hand a messy merge or rebase to the git-expert subagent

Example prompts for the agent

  • Review the diff and commit this: /commit
  • Our tickets look like PROJ-123, put the code in the message: /commit
  • Run tests and lint first, then commit: /commit

How to install commit

Manually: put the files in place

.claude/commands/commit.md

Call it with /commit. For all projects use ~/.claude/commands/

Questions about commit

How do I install commit in Claude Code?

Copy the command file to .claude/commands/commit.md inside your project. It then shows up as /commit.

What does the commit command do?

It reads the diff and recent history, checks the changes for secrets and debris, refreshes documentation, runs tests and lint, stages files, and creates the commit with a message in the project's style.

What if my project has no documented commit conventions?

The command analyses commit history and adds the patterns it finds as a "Git Commit Conventions" section in CLAUDE.md. That edits a project file, so review it before committing.

Source text

commit.md · MIT
---
description: Create a git commit following the project's established style
category: workflow
allowed-tools: Bash(git:*), Bash(echo:*), Bash(head:*), Bash(wc:*), Bash(test:*), Bash([:[*), Bash(grep:*), Read, Edit, Task
---

Create a git commit following the project's established style

## Git Expert Integration
For complex commit scenarios (merge commits, conflict resolution, commit history issues, interactive rebasing), consider using the Task tool with `git-expert` subagent for specialized git expertise.

## Efficiency Note:
This command intelligently reuses recent git:status results when available to avoid redundant operations. If you just ran /git:status, the commit process will be faster.

When git conventions are already documented in CLAUDE.md/AGENTS.md, use them directly without verbose explanation.

All git commands are combined into a single bash call for maximum speed.

## Steps:
1. Check if the previous message contains git:status results:
   - Look for patterns like "Git Status Analysis", "Modified Files:", "Uncommitted Changes:"
   - If found and recent (within last 2-3 messages): Reuse those results
   - If not found or stale: Run a single combined git command:
   !git --no-pager status --porcelain=v1 && echo "---STAT---" && git --no-pager diff --stat 2>/dev/null && echo "---DIFF---" && git --no-pager diff 2>/dev/null | head -2000 && echo "---LOG---" && git --no-pager log --oneline -5
   - Note: Only skip git status if you're confident the working directory hasn't changed
   - Note: Full diff is capped at 2000 lines to prevent context flooding. The stat summary above shows all changed files
2. Review the diff output to verify:
   - No sensitive information (passwords, API keys, tokens) in the changes
   - No debugging code or console.log statements left in production code
   - No temporary debugging scripts (test-*.js, debug-*.py, etc.) created by Claude Code
   - No temporary files or outputs in inappropriate locations (move to project's temp directory or delete)
   - All TODO/FIXME comments are addressed or intentionally left
3. Use documented git commit conventions from CLAUDE.md/AGENTS.md
   - If conventions are not documented, analyze recent commits and document them
4. If the project uses ticket/task codes, ask the user for the relevant code if not clear from context
5. Check if README.md or other documentation needs updating to reflect the changes (see "Documentation Updates" section below)
6. Run tests and lint commands to ensure code quality (unless just ran before this command)
7. Stage all relevant files (including any updated documentation)
8. Create commit with appropriate message matching the project's conventions
9. Verify commit succeeded - Report with ✅ success indicator
10. Check if any post-commit hooks need to be considered (e.g., pushing to remote, creating PR)

## Documentation Updates:
Consider updating relevant documentation when committing changes:
- README.md: New features, API changes, installation steps, usage examples
- CHANGELOG.md: Notable changes, bug fixes, new features
- API documentation: New endpoints, changed parameters, deprecated features
- User guides: New workflows, updated procedures
- Configuration docs: New settings, changed defaults

## Commit Convention Documentation:
Only when conventions are NOT already documented: Analyze the commit history and document the observed conventions in CLAUDE.md under a "Git Commit Conventions" section. Once documented, use them without verbose explanation.

The documentation should capture whatever style the project uses, for example:
- Simple descriptive messages: "Fix navigation bug"
- Conventional commits: "feat(auth): add OAuth support"
- Prefixed style: "[BUGFIX] Resolve memory leak in parser"
- Task/ticket codes: "PROJ-123: Add user authentication"
- JIRA integration: "ABC-456 Fix memory leak in parser"
- GitHub issues: "#42 Update documentation"
- Imperative mood: "Add user authentication"
- Past tense: "Added user authentication"
- Or any other project-specific convention

Example CLAUDE.md section:
```markdown
## Git Commit Conventions
Based on analysis of this project's git history:
- Format: [observed format pattern]
- Tense: [imperative/past/present]
- Length: [typical subject line length]
- Ticket codes: [if used, note the pattern like "PROJ-123:" or "ABC-456 "]
- Other patterns: [any other observed conventions]

Note: If ticket/task codes are used, always ask the user for the specific code rather than inventing one.
```

© carlrannaberg · MIT · carlrannaberg/claudekit

Similar slash commands

All slash commands for Git and GitHub →

commit by other authors comes first.

commit official Anthropic Creates a git commit based on current branch changes. Helps stage and commit diffs in Claude Code without typing commit messages. CX Codex +1 4,121installs commit Rohit Ghumare Runs project checks, reviews staged changes, and creates a focused git commit. Use it when a change is ready to be recorded. CX Codex +1 ★ 2,966repo stars commit evmts A slash command that builds your git commit: stages files, writes a conventional-commit message with an emoji, and runs the project's checks first. CX Codex +1 ★ 2,003repo stars commit CloudAI-X Inspects staged Git changes and creates a conventional commit with an automated message. CX Codex +1 ★ 1,424repo stars commit qdhenry Generates task-aligned Conventional Commits, tracks status transitions, and validates changed files against task scopes. CX Codex +1 ★ 1,357repo stars commit-pr ZaxbyHub commit-pr — a portable skill that verifies your code before push, writes conventional commits, and fills in a PR body. Guards against accidentally committing generated files or secrets. CX Codex +1 ★ 539repo stars commit-commands rohitg00 commit-commands automates Git commit workflows with smart file staging and automated pushes in Claude Code. Handles code changes without manual staging steps. ★ 2,858repo stars git-commit official github A GitHub Copilot skill that turns a working diff into a commit: it reads the changes, stages the related files, writes a Conventional Commits message and runs git commit. CX Codex +1 47,165installs commit-all sentimony Creates a single commit for all current branch changes with an auto-generated message. It triggers exclusively via the explicit /commit-all command. CX Codex +1 3,800installs ce-commit EveryInc ce-commit is a Claude Code skill that automatically creates git commits with meaningful messages. It splits staged or unstaged changes into logical groups without pushing. CX Codex +1 3,600installs om-check-and-commit open-mercato om-check-and-commit runs every configured validation command in order, fixes straightforward failures, and publishes the branch. Useful before a push when you want a CI-style gate. CX Codex +1 3,600installs

From the same set54

The whole set →
cli This command checks whether a CLI tool is available, captures its help output, and adds it to CLAUDE.md for future reference. CX Codex +1 ★ 763repo stars checkout The checkout command creates and switches git branches using prefixes such as feature/, hotfix/ and release/, following a repo's branch-naming convention. CX Codex +1 ★ 763repo stars bash-timeout bash-timeout configures bash command timeout values in Claude Code settings.json. Useful when long test runs, builds, or deployments fail due to the default 2-minute cap. CX Codex +1 ★ 763repo stars create-command The create-command command builds a Claude Code slash command from your requirements, then shows its file location and how to invoke it. CX Codex +1 ★ 763repo stars code-search code-search searches the codebase for matching files, functions, and patterns, returning a clean list of paths. Handy for locating relevant code quickly without full explanations. CX Codex ★ 763repo stars validate-and-fix validate-and-fix is a Claude Code command that runs project checks and assigns independent fixes to parallel agents. It discovers build, test, and lint commands in project instructions and package.json. CX Codex +1 ★ 763repo stars migration migration moves CLAUDE.md, .cursorrules and the rest of your AI config files into one AGENTS.md, then links each tool's expected filename to it. CX Codex +1 ★ 763repo stars research-expert research-expert gathers web information in parallel, adapts depth across three distinct modes, and outputs full reports to files to avoid token bloat. CX Codex ★ 763repo stars

Project sponsors

Companies that keep this analytics open