git-commit

star 3

Stage and commit changes to git in one workflow with automatic pre-commit hook handling. Use when the user asks to commit changes, create a commit, save work to git, or similar git commit requests. Automatically generates commit messages and handles pre-commit failures by fixing linting/formatting errors.

4IRL By 4IRL schedule Updated 4/18/2026

name: git-commit description: Stage and commit changes to git in one workflow with automatic pre-commit hook handling. Use when the user asks to commit changes, create a commit, save work to git, or similar git commit requests. Automatically generates commit messages and handles pre-commit failures by fixing linting/formatting errors.

Git Add and Commit

Streamline git commits by staging files, generating commit messages, and handling pre-commit hook failures automatically.

Branch Guard

Before starting, check the current branch:

  1. If on main or master:
    • Run gmas to ensure main is up to date
    • Suggest a branch name based on the task context (e.g., refactor/splash-validation, fix/login-error)
    • Ask the user: "You're on main. Want me to create and switch to <suggested-branch>?"
    • Do NOT proceed until the user confirms and you've switched branches
  2. If already on a feature branch: proceed normally

Workflow

1. Stage Files

Default: Stage all changes

git add .

Specific files: If user specifies files or folders to exclude, stage only the desired files:

git add <specific-files>

2. Analyze Changes and Generate Commit Message

Before committing, run these commands in parallel to understand the changes:

git status
git diff --staged
git log -3 --oneline  # See recent commit message style

Analyze the staged changes to craft a concise commit message (1-2 sentences) that:

  • Summarizes the nature of changes (feature, fix, refactor, docs, test, etc.)
  • Focuses on "why" rather than "what"
  • Follows the repository's existing commit message style
  • Uses appropriate prefix (add/update/fix/refactor/etc.) based on actual changes

Skill file handling: Changes under .claude/skills/ get special treatment:

  • If skill changes are mixed with other (non-skill) changes: stage and commit everything together, but ignore the skill files when writing the commit message — focus the message only on the non-skill changes.
  • If the only staged changes are skill files: treat them as the focus and write the commit message about the skill updates.

3. Create Commit

CRITICAL: Always run git commit with dangerouslyDisableSandbox: true. Pre-commit hooks invoke Docker-based checks (tsc typecheck via docker compose exec) that require Docker socket access, which the sandbox blocks.

git commit -m "Your commit message here."
  • Keep the git commit to a single line

4. Handle Pre-Commit Failures

If the commit fails due to pre-commit hooks:

  1. Identify the errors - Read the pre-commit output to understand what failed (linting, formatting, etc.)

  2. Fix menial errors - Automatically fix:

    • Code formatting issues (black, prettier, etc.)
    • Linting errors (flake8, eslint, etc.)
    • Import sorting
    • Trailing whitespace
    • Other style/formatting issues
  3. Do NOT fix if changes would:

    • Alter business logic
    • Break functionality
    • Require architectural decisions
    • Need user input to resolve correctly
  4. Re-stage and commit - After fixing errors:

    git add .
    git commit -m "$(cat <<'EOF'
    Your original commit message here.
    EOF
    )"
    
  5. Report to user - Summarize what was fixed and complete the commit

5. Append Changelog Entry

After a successful commit, append a changelog entry per the global CLAUDE.md instructions:

  1. Run date '+%m-%d-%Y %H:%M' to get the current date and time — this is mandatory, never skip it or assume the date from context/filenames
  2. Use the MM-DD-YYYY portion for the changelog filename (changelog/MM-DD-YYYY-changelog.md)
  3. Use the HH:MM portion for the entry timestamp
  4. Append a - [HH:MM] git-commit: <summary> entry

Important Notes

  • Never use --no-verify to bypass pre-commit hooks unless explicitly requested
  • If pre-commit failures require non-menial changes, report to user and ask for guidance
  • Verify commit success with git status after completion
  • All commits must be authored by u4i-claude-code[bot] — do not add any Co-Authored-By trailers
Install via CLI
npx skills add https://github.com/4IRL/urls4irl --skill git-commit
Repository Details
star Stars 3
call_split Forks 1
navigation Branch main
article Path SKILL.md
More from Creator