Git workflow commands for conventional commits

Install

/plugin install reedom-git@reedom-commands-and-skills

Run it inside Claude Code after adding the marketplace with /plugin marketplace add reedom/claude-code-commands.

Contents

Discovered from source

Skills 1

This skill analyzes staged git files and returns commit specifications as JSON. It:

  1. Collects staged file metadata via script
  2. Reads diff content to understand changes
  3. Groups files by category (deps, ci, config, source, test, docs)
  4. Generates conventional commit messages for each group
  5. Returns JSON specs for the caller to execute

Arguments

ArgDefaultDescription
--langcontextMessage language (conversation context → system locale → en)

Output Contract

This skill ALWAYS returns JSON. The caller executes git commands based on this output.

Success:

{
  "commits": [
    {"message": "type(scope): subject\n\nBody", "files": ["file1", "file2"]}
  ],
  "summary": {"total_commits": 1, "total_files": 2}
}

Error:

{"error": "description", "error_code": "CODE"}

Workflow

Step 1: Collect file info

${CLAUDE_PLUGIN_ROOT}/skills/collect-commit-info/scripts/collect-info.sh --lang <code>

Script returns JSON with temp_dir, files array (with categories), and paths.diff_content.

On error JSON → return it immediately and stop.

Step 2: Read diff content

Read the file at paths.diff_content to understand what changed.

Step 3: Group files by category

Group files from the files array. Commit order:

  1. deps - Dependencies (package.json, lock files)
  2. ci - CI/CD (.github/*)
  3. config - Configuration (*.yml, *.toml, rc files)
  4. source - Source code
  5. test - Tests (_test., .test., .spec.)
  6. docs - Documentation (.md, docs/)

Step 4: Generate commit messages

For each group, create a conventional commit message:

type(scope): imperative subject (max 50 chars)

Optional body explaining what and why.

Type by category:

CategoryType
depschore
cici
configchore
sourcefeat/fix/refactor (analyze diff)
testtest
docsdocs

For source files, analyze diff to determine type:

  • New functionality → feat
  • Bug fixes, error handling → fix
  • Restructuring, cleanup → refactor

Scope: Derive from paths (e.g., src/auth/* → auth)

Language: Use lang.effective from script output. If conversation context indicates a preferred language, use that instead.

Step 5: Cleanup and return

${CLAUDE_PLUGIN_ROOT}/skills/collect-commit-info/scripts/cleanup.sh <temp_dir>

Return the JSON commit specs.

Commands 1

This command selects files, determines complexity, and delegates to the appropriate agent.

Arguments

FlagDefaultDescription
--staged, -sfalseCommit already-staged files (skip file selection)
--singlefalseForce simple single-commit mode
--langcontextCommit message language

Agent Selection

Two agents are available:

AgentUse Case
simple-commit-makerSingle commit for single-category changes
commit-makerMultiple commits for mixed-category changes

Auto-detection logic:

  • Categorize files into: deps, ci, config, source, test, docs
  • All files in same category → simple-commit-maker
  • Mixed categories → commit-maker

Override:

  • --single flag forces simple-commit-maker regardless of categories

File Categories

CategoryPattern
depspackage.json, -lock., requirements.txt, Cargo.toml, go.mod, Gemfile
ci.github/*, .gitlab-ci.yml, Jenkinsfile
config*.yml, *.yaml, .toml, .rc, tsconfig., jest.config.
test_test., .test., .spec., tests/, tests/
docs*.md, .rst, docs/
sourceEverything else

Workflow

With --staged flag

Skip file selection. Categorize already-staged files:

git diff --cached --name-only

Then proceed to agent selection.

Without --staged flag

Step 1: Recall files from conversation memory

List files that were created or modified by you in this conversation.

If you have memory of files → go to Step 3.

Step 2: Fallback to git status (only if no memory)

If you have no memory of modified files:

git status --porcelain

Select files based on:

  • Modified/added/deleted files (M, A, D, R)
  • Related untracked files (??) in same directory
  • Exclude: IDE config (.idea/, .vscode/), temp files

Step 3: Categorize files

For each selected file, assign a category based on the patterns above.

Count distinct categories.

Step 4: Select agent and delegate

If --single flag OR only one distinct category:

Task(
  subagent_type: "reedom-git:simple-commit-maker",
  prompt: "--lang=<lang> --files=<comma-separated-paths>"
)

Otherwise (multiple categories):

Task(
  subagent_type: "reedom-git:commit-maker",
  prompt: "--lang=<lang> --files=<comma-separated-paths>"
)

Agents 2

Arguments

ArgDescription
--langCommit message language
--filesComma-separated files to stage

Workflow

Step 1: Stage files

git add -- <file1> <file2> ...

Step 2: Get commit specs from skill

Skill(reedom-git:collect-commit-info) --lang <code>

Returns JSON:

{"commits": [{"message": "...", "files": ["..."]}]}

On error JSON: report and stop.

Step 3: Execute each commit

For each commit spec:

git reset HEAD -- .              # (skip for first)
git add -- <spec.files>
git commit -m "<spec.message>"

Step 4: Output summary

| Commit | Message | Files |
|--------|---------|-------|
| abc1234 | feat(auth): add login | 3 |

**Total: N commits, M files**

Arguments

ArgDescription
--langCommit message language (default: en)
--filesComma-separated files to stage

Workflow

Step 1: Stage files

git add -- <file1> <file2> ...

Step 2: Read staged diff

git diff --cached --stat
git diff --cached

Analyze the diff to understand:

  • What changed (additions, deletions, modifications)
  • The purpose of changes (new feature, bug fix, refactor, docs, etc.)

Step 3: Generate commit message

Create a conventional commit message:

type(scope): subject (max 50 chars, imperative mood)

Optional body explaining:
- What changed and why
- Any important details

Type selection:

  • feat: New functionality
  • fix: Bug fix, error handling
  • refactor: Code restructuring without behavior change
  • docs: Documentation only
  • test: Test additions or fixes
  • chore: Dependencies, config, CI/CD
  • style: Formatting, whitespace (no logic change)

Scope: Derive from file paths (e.g., src/auth/* → auth)

Body: Include when changes need explanation. Omit for trivial changes.

Step 4: Execute commit

git commit -m "<message>"

Use HEREDOC for multi-line messages:

git commit -m "$(cat <<'EOF'
type(scope): subject

Body paragraph here.
EOF
)"

Step 5: Output summary

| Commit | Message |
|--------|---------|
| abc1234 | feat(auth): add login validation |

**1 commit, N files**

Sponsors

Details

Marketplace
reedom/claude-code-commands
Source
git
Author
HANAI Tohru
Category
Productivity
Keywords
git, commit

More from reedom/claude-code-commands

All 6