commit

Create well-formatted git commits for changes made during the session

Best use case

commit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Create well-formatted git commits for changes made during the session

Teams using commit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/commit/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/toolkit/packages/skills/commit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/commit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How commit Compares

Feature / AgentcommitStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Create well-formatted git commits for changes made during the session

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Commit

You are tasked with creating git commits for the changes made during this session.

## Initial Response

When invoked, respond with:
```
I'll help you create git commits for the changes in this session.

Let me review what was accomplished and prepare appropriate commits.
```

## Process

### Step 1: Pre-Commit Cleanup

Before creating any commits, ALWAYS perform cleanup:

1. **Check for files that should NOT be committed**:
   ```bash
   # Look for env files that might not be ignored
   ls -la .env* env.* *.env

   # Check if they're in .gitignore
   cat .gitignore | grep -E "\.env|env\."
   ```

   If any `.env` files are not in `.gitignore`, add them:
   ```bash
   echo ".env*" >> .gitignore
   echo "*.env" >> .gitignore
   ```

2. **Remove debug/test files created during development**:
   ```bash
   # Look for common debug/test files
   ls -la test_*.* debug_*.* tmp_*.* temp_*.*
   ```

   Remove any files that were created just to assist development:
   ```bash
   rm test_script.js debug_output.txt temp_*.py
   ```

3. **Remove unnecessary documentation**:
   ```bash
   # Check for markdown files created during this session
   git status | grep "\.md"
   ```

   Unless explicitly requested by the user, remove:
   - Work tracking documents
   - Temporary notes
   - Auto-generated docs

   Keep only:
   - Explicitly requested documentation
   - Essential README updates
   - API documentation if requested

4. **Anything the agent produces for its own reference is LOCAL-ONLY** — scratch notes, goals, plans, research, handover docs, status scripts. Usually under `.agents/{goals,plans,research,scratch,handover}/`, but apply by intent not path. `git rm --cached` anything already tracked, ensure the dir is in `.gitignore`. Exceptions: `.agents/pr-signals/`, `.agents/MEMORY.md` and similar deliberately-tracked agent infrastructure.

5. **Verify cleanup**:
   ```bash
   git status
   ```

   Present to user if cleanup is needed:
   ```
   I found some files that should be cleaned up before committing:

   Files to remove:
   - test_oauth.js (debug script)
   - debug_notes.md (work tracking)
   - .env.local (should be in .gitignore)

   Shall I clean these up before creating commits?
   ```

### Step 2: Understand What Changed

1. **Review the conversation history**:
   - Understand what was accomplished in this session
   - Identify the purpose and context of changes
   - Note any bug fixes, features, or refactoring done

2. **Check git status** (after cleanup):
   ```bash
   git status
   ```
   - See all modified, added, and deleted files
   - Identify untracked files that need to be added

3. **Review the actual changes**:
   ```bash
   git diff
   git diff --staged
   ```
   - Understand the specific modifications
   - Group related changes together
   - Identify if changes should be one commit or multiple

### Step 3: Plan Your Commits

1. **Determine commit strategy**:
   - Single commit for related changes
   - Multiple commits for distinct features/fixes
   - Atomic commits that each serve a single purpose

2. **Group files logically**:
   - Feature files together
   - Test files with their implementation
   - Configuration changes separately if significant

3. **Draft commit messages**:
   - Use imperative mood ("Add", "Fix", "Update", not "Added", "Fixed")
   - First line: concise summary (50 chars or less ideally)
   - Blank line, then detailed explanation if needed
   - Focus on WHY the change was made, not just what

### Step 4: Present Your Plan

Show the user your commit plan:

```
Based on the changes, I plan to create [N] commit(s):

**Commit 1**: [Type]: [Summary]
Files:
- path/to/file1.js
- path/to/file2.js

Message:
```
feat: add OAuth2 authentication support

- Implement OAuth2 flow with refresh tokens
- Add token storage and validation
- Include error handling for auth failures
```

**Commit 2**: [Type]: [Summary]
Files:
- tests/auth.test.js

Message:
```
test: add comprehensive OAuth2 tests

- Test token refresh flow
- Verify error handling
- Add integration tests for providers
```

Shall I proceed with these commits?
```

### Step 5: Execute Upon Confirmation

1. **Stage files for each commit**:
   ```bash
   # For each commit, add specific files
   git add path/to/file1.js path/to/file2.js

   # NEVER use git add -A or git add .
   # Always be specific about what you're committing
   ```

2. **Create the commit**:
   ```bash
   git commit -m "feat: add OAuth2 authentication support

   - Implement OAuth2 flow with refresh tokens
   - Add token storage and validation
   - Include error handling for auth failures"
   ```

3. **Verify the commits**:
   ```bash
   git log --oneline -n 3
   ```
   Show the user the created commits

## Commit Message Format

Follow conventional commits format:

### Types:
- **feat**: New feature
- **fix**: Bug fix
- **docs**: Documentation changes
- **style**: Code style changes (formatting, semicolons, etc)
- **refactor**: Code refactoring without changing functionality
- **perf**: Performance improvements
- **test**: Adding or updating tests
- **build**: Build system or dependencies
- **ci**: CI/CD changes
- **chore**: Maintenance tasks

### Structure:
```
<type>(<scope>): <subject>

<body>

<footer>
```

### Examples:

```bash
# Simple feature
git commit -m "feat: add user profile page"

# Bug fix with detail
git commit -m "fix: resolve race condition in payment processing

The payment webhook could process twice if requests arrived
simultaneously. Added mutex locking to ensure single processing."

# Breaking change
git commit -m "feat!: update API response format

BREAKING CHANGE: API now returns data in 'result' field instead
of root level. Clients need to update response parsing."
```

## Important Rules

### Cleanup Rules (MUST DO BEFORE COMMITS)
1. **ALL `.env.*` files MUST be in `.gitignore`**
   - Never commit environment files
   - Add patterns to .gitignore if missing

2. **REMOVE all debug/test scripts created to assist agent**
   - Delete temporary test files
   - Remove debug output files
   - Clean up any helper scripts

3. **NO documentation unless explicitly requested**
   - Delete work tracking documents
   - Remove temporary markdown notes
   - Only keep docs the user specifically asked for

4. **Anything the agent produces for its own reference must NOT be committed**
   - Scratch notes, goals, plans, research, handover docs, status scripts —
     local-only. Usually under `.agents/{goals,plans,research,scratch,handover}/`
     but apply by *intent*: if the file exists for the agent's benefit, not the
     repo's, it doesn't ship. Add to `.gitignore`, `git rm --cached` slips.
   - Exception: `.agents/pr-signals/`, `.agents/MEMORY.md` and similar
     deliberately-tracked agent infrastructure.
   - **Never use `git add -A` or `git add .`** — those are the fastest path
     to dragging agent scratch into a commit. Always stage by named paths.

### Commit Rules
1. **NEVER add co-author information or Claude attribution**:
   - No "Generated with Claude" messages
   - No "Co-Authored-By" lines
   - Commits should be authored solely by the user

2. **Write commits as if the user wrote them**:
   - Use the project's commit style if evident
   - Match the tone of existing commits
   - Be professional and concise

3. **Be selective with staging**:
   - Only commit files that are ready
   - Don't include debug code or temporary files
   - Ensure no sensitive information is committed

## Handling Complex Scenarios

### Multiple Features in One Session

If multiple unrelated features were implemented:
```
I notice we worked on several distinct features. I'll create separate commits for:

1. OAuth implementation (5 files)
2. User profile updates (3 files)
3. Bug fix for payment processing (2 files)

This keeps the git history clean and makes reverting easier if needed.
```

### Large Changes

For extensive changes, consider:
```
This is a large change. I recommend breaking it into logical commits:

1. Core implementation
2. Tests
3. Documentation
4. Configuration changes

This makes code review easier and helps track what changed where.
```

### Work in Progress

If implementation is incomplete:
```
The implementation isn't complete yet. Would you like me to:

1. Commit completed parts with a clear message
2. Create a WIP commit to save progress
3. Wait until the feature is complete

What's your preference?
```

## Verification Steps

After committing, always:

1. **Show the commit log**:
   ```bash
   git log --oneline -5
   ```

2. **Verify nothing was missed**:
   ```bash
   git status
   ```

3. **Check the commit contents** (if requested):
   ```bash
   git show HEAD
   ```

## Push to Remote

### When to Push

After creating commits, automatically push to remote with these rules:

1. **Automatic push for feature branches**:
   - Push immediately after commits on non-protected branches
   - Inform user what was pushed after completion

2. **Ask permission ONLY for main/master**:
   ```
   You have commits ready to push to main/master branch.
   This is a protected branch. Please confirm:
   - Have all tests passed?
   - Is the code reviewed?
   - Are you ready to deploy?

   Proceed with push to main/master? (yes/no)
   ```

3. **Always check remote status first**:
   ```bash
   # Check if branch exists on remote
   git branch -r | grep origin/[current-branch]

   # Check if local is ahead/behind
   git status -sb

   # Fetch latest without merging
   git fetch origin
   ```

### Push Process

#### Step 1: Verify Branch and Remote

```bash
# Check current branch
BRANCH=$(git branch --show-current)

# Determine if it's a protected branch
if [[ "$BRANCH" == "main" ]] || [[ "$BRANCH" == "master" ]]; then
    # Requires user confirmation (see rules above)
    PROTECTED=true
else
    # Will push automatically
    PROTECTED=false
fi

# Check tracking branch
git branch -vv

# See commits that will be pushed
git log origin/$BRANCH..HEAD --oneline
```

#### Step 2: Inform User What Will Be Pushed

```bash
# Show the commits that will be pushed
echo "Pushing the following commits to origin/$BRANCH:"
git log origin/$BRANCH..HEAD --oneline

# Example output:
# "Pushing the following commits to origin/feature/oauth:
# abc1234 feat: add OAuth2 authentication
# def5678 test: add auth tests
# ghi9012 fix: handle token refresh"
```

#### Step 3: Handle Different Scenarios

**New Branch (not on remote):**
```bash
echo "Creating new remote branch and pushing..."
git push -u origin $BRANCH
echo "✓ Successfully pushed $BRANCH to origin"
```

**Existing Branch (already tracking):**
```bash
echo "Pushing to origin/$BRANCH..."
git push
echo "✓ Successfully pushed updates to origin/$BRANCH"
```

**Behind Remote (need to pull first):**
```bash
# Fetch and check
git fetch origin

# Always use rebase when pulling to keep history clean
echo "Branch is behind remote. Syncing with rebase..."
git pull --rebase
echo "Retrying push after rebase..."
git push
echo "✓ Successfully pushed after rebasing on remote changes"
```

#### Step 4: Verify and Report Success

```bash
# Confirm push completed
git log origin/$BRANCH..HEAD --oneline

# Report success to user
echo "✓ Push complete. Your branch is up to date with 'origin/$BRANCH'"

# For feature branches, suggest next steps
if [[ "$PROTECTED" == "false" ]]; then
    echo ""
    echo "Next steps:"
    echo "- Create a pull request: gh pr create"
    echo "- View on GitHub: gh repo view --web"
fi
```

### Push Rules

1. **Automatic push for feature branches**:
   ```bash
   # For non-protected branches, push automatically after commits
   # Just inform the user what was pushed:
   "Pushing 3 commits to origin/feature/oauth-impl..."
   "✓ Successfully pushed to origin/feature/oauth-impl"
   ```

2. **Ask permission ONLY for protected branches**:
   ```bash
   # Protected branches require confirmation
   if [[ "$BRANCH" == "main" ]] || [[ "$BRANCH" == "master" ]] || [[ "$BRANCH" == release/* ]]; then
       echo "Ready to push to $BRANCH (protected branch)"
       echo "Please confirm push to protected branch (yes/no):"
       # Wait for user confirmation
   else
       # All other branches push automatically
       echo "Pushing to origin/$BRANCH..."
       git push
   fi
   ```

3. **NEVER force push without explicit permission**:
   ```bash
   # If force push is needed, always ask regardless of branch:
   "This requires a force push which will overwrite remote history.
   This can affect other developers. Are you sure you want to proceed?"
   ```

4. **Always show what will be pushed**:
   ```bash
   # Before pushing, show commits
   echo "Pushing the following commits to origin/$BRANCH:"
   git log origin/$BRANCH..HEAD --oneline
   ```

5. **Handle push rejections gracefully**:
   ```bash
   # If push is rejected, automatically handle it
   echo "Push rejected. Syncing with remote using rebase..."
   git fetch origin
   git pull --rebase

   # Retry push after rebase
   echo "Retrying push after rebase..."
   git push

   # If still fails, it's likely branch protection
   if [ $? -ne 0 ]; then
       echo "Push still rejected. This is likely due to:"
       echo "- Branch protection rules"
       echo "- Insufficient permissions"
       echo ""
       echo "Creating a pull request instead..."
       gh pr create
   fi
   ```

### Common Push Scenarios

**Feature Branch Workflow:**
```bash
# After commits on feature branch, automatically push
echo "Pushing feature branch to origin..."
git push -u origin feature/oauth-implementation
echo "✓ Successfully pushed to origin/feature/oauth-implementation"
echo ""
echo "Pull request can be created with: gh pr create"
```

**Hotfix Push:**
```bash
# For urgent fixes, push immediately
echo "Pushing hotfix to origin..."
git push origin hotfix/critical-security-fix
echo "✓ Hotfix pushed successfully"
echo ""
echo "Creating urgent PR for review..."
gh pr create --title "HOTFIX: Critical security fix" --label "urgent,hotfix"
```

**Release Branch:**
```bash
# Release branches are treated like protected branches
echo "Ready to push to release branch"
echo "Please confirm the following are complete:"
echo "✓ All tests pass"
echo "✓ Version numbers updated"
echo "✓ Changelog updated"
echo ""
echo "Proceed with push to release branch? (yes/no)"
# Only release and main/master branches ask for confirmation
```

## Best Practices

1. **Atomic commits**: Each commit should work independently
2. **Clear messages**: Future developers should understand why
3. **Group related changes**: But don't mix unrelated changes
4. **Test before committing**: Ensure code works
5. **Review diff carefully**: Check for debug code, comments, secrets
6. **Always rebase when syncing**: Use `git pull --rebase` to keep history clean
7. **Automatic push for feature branches**: No confirmation needed, just inform user
8. **Respect branch protection**: Only ask confirmation for main/master/release branches

## Quick Reference

```bash
# See what changed
git status
git diff

# Stage specific files
git add src/feature.js tests/feature.test.js

# Commit with message
git commit -m "feat: implement new feature"

# View recent commits
git log --oneline -10

# Amend last commit (if needed)
git commit --amend

# Unstage files (if needed)
git reset HEAD file.js
```

Remember: You have the full context of what was done in this session. Use that knowledge to create meaningful, well-organized commits that tell the story of what was accomplished.

Related Skills

workflow

8
from stevengonsalvez/agents-in-a-box

Guide through structured delivery workflow with plan, implement, validate phases

webapp-testing

8
from stevengonsalvez/agents-in-a-box

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

validate

8
from stevengonsalvez/agents-in-a-box

Verify implementation against specifications

ui-ux-pro-max

8
from stevengonsalvez/agents-in-a-box

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, Astro, Nuxt, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

tui-style-guide

8
from stevengonsalvez/agents-in-a-box

TUI style guide for consistent terminal interface design

token-usage

8
from stevengonsalvez/agents-in-a-box

Show Claude Code token usage across sessions — daily, weekly, per-project, and per-session breakdowns. Parses {{HOME_TOOL_DIR}}/projects/**/*.jsonl for consumption data. Use when the user asks about token usage, costs, how many tokens were used, session statistics, or wants a usage report.

tmux-status

8
from stevengonsalvez/agents-in-a-box

Show status of all tmux sessions including dev environments, spawned agents, and running processes

tmux-monitor

8
from stevengonsalvez/agents-in-a-box

Monitor and report status of all tmux sessions including dev environments, spawned agents, and running processes. Uses tmuxwatch for enhanced visibility.

tmux-message

8
from stevengonsalvez/agents-in-a-box

Reliable peer-to-peer message delivery to other Claude Code instances via tmux send-keys. Use as a fallback when claude-peers MCP send_message fails to surface in the receiver's inbox (delivered server-side but receiver never picks it up — observed behaviour). Also use when sending a directive to a known Claude Code TUI session by tmux session name or fuzzy hint, or when injecting a multi-line directive into a peer's prompt and submitting it. Trigger phrases — "claude-peers fallback", "tmux send-keys", "send to peer via tmux", "inject directive", "deliver to nanoclaw/hermes peer", "peer message". Tmux-only — won't reach peers running outside tmux.

test-driven-development

8
from stevengonsalvez/agents-in-a-box

Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.

test-ainb

8
from stevengonsalvez/agents-in-a-box

Run tests for the ainb (agents-in-a-box) Rust workspace via a 5-layer strategy — unit, insta snapshot, mock-plugin compositing, real-plugin spawn, vhs recording. Wraps cargo + insta + vhs into one CLI. Use when Stevie says "/test-ainb", "test ainb", "run ainb tests", "snapshot <component>", "regenerate vhs tapes", or any phrasing about validating ainb test layers. The skill autodetects which ainb-tui worktree the cwd sits in and dispatches to scripts/run.sh.

sync-learnings

8
from stevengonsalvez/agents-in-a-box

Sync user-level agent config changes back to toolkit repository (works for Claude, Codex, Copilot)