Standard workflow for all commit operations ('commit', 'save changes', 'create commit', 'check in'): replaces bash-based git add/commit workflows with automated Git Safety Protocol—analyzes changes, drafts convention-aware messages, enforces mainline protection, handles pre-commit hooks safely. Canonical commit implementation for git-workflows.
/plugin marketplace add cblecker/claude-skills/plugin install git-workflows@claude-skillsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Use this skill for commit requests: "commit these changes", "create a commit", "save my work", "commit with message X".
Use other skills for: creating PRs (creating-pull-request), viewing history (git log directly).
Executes atomic commit workflow with analysis and validation gates using optimized scripts for maximum performance.
Extract from user request: commit message format ("use conventional commits" → force, default auto-detect), explicit message (if provided, else auto-generate)
Objective: Collect all commit context in a single atomic operation.
Steps:
Run ../../scripts/gather-commit-context.sh to collect all commit context
Parse the JSON response and handle results:
IF success: false:
Handle error based on error_type:
clean_working_tree:
message field from responsenot_git_repo:
message and suggested_action from responsegit_status_failed:
message from responseOther errors:
IF success: true:
Extract and store context:
{
"current_branch": "branch name",
"mainline_branch": "main",
"is_mainline": false,
"uses_conventional_commits": true,
"conventional_commits_confidence": "high",
"working_tree_status": {...},
"staged_files": [...],
"unstaged_files": [...],
"untracked_files": [...],
"file_categories": {...},
"recent_commits": [...],
"diff_summary": {...}
}
IF `is_mainline: false` (on feature branch):
Continue to Phase 2
IF `is_mainline: true` (on mainline):
Check user request and context:
IF user explicitly stated commit to mainline is acceptable:
Examples: CLAUDE.md allows mainline commits, request says "commit to main"
INFORM: "Proceeding with mainline commit as authorized"
Continue to Phase 2
IF no explicit authorization:
INVOKE: creating-branch skill
WAIT for creating-branch skill to complete
IF creating-branch succeeded:
VERIFY: Now on feature branch (not mainline)
RE-RUN Phase 1 (gather context again on new branch)
Continue to Phase 2
IF creating-branch failed:
STOP immediately
EXPLAIN: "Branch creation failed, cannot proceed with commit"
EXIT workflow
Phase 1 complete. Continue to Phase 2.
Objective: Draft a concise, informative commit message using context from Phase 1.
Generate commit message considering:
uses_conventional_commits: trueCommit Message Format:
Conventional Commits (if uses_conventional_commits: true):
<type>[scope]: <description>feat(auth): add JWT token refreshStandard (if uses_conventional_commits: false):
<Subject line>Add JWT token refresh mechanismBody (optional):
Co-Authored-By:
includeCoAuthoredBy setting in Claude Code configurationContext Available for message generation:
file_categories: Types of files changed (code, tests, docs, config)diff_summary: Scale of changes (files, insertions, deletions)recent_commits: Recent commit messages for style matchinguses_conventional_commits: Whether to use conventional formatstaged_files, unstaged_files, untracked_files: What's being committedContinue to Phase 3.
Objective: Present commit details for user review and approval.
Steps:
Present commit details:
staged_files (or all if staging all)diff_summary (files changed, +insertions, -deletions)Display change summary (not full diff):
diff_summaryRequest approval using AskUserQuestion tool:
HANDLE user selection:
Objective: Stage files and create commit.
Plan Mode: Auto-enforced read-only if active
Steps:
Stage files:
git add .
Or stage specific files from context if user requested selective staging.
Create commit with approved message:
git commit -m "<approved message from Phase 3>"
Pre-commit Hooks:
Error Handling:
IF commit fails:
git config user.email and git config user.nameContinue to Phase 5.
Objective: Confirm commit was created successfully and provide standardized report.
Steps:
Parse the git commit output from Phase 4, which has the format:
[branch-name abc1234] Commit subject
N files changed, M insertions(+), P deletions(-)
Extract commit details:
[ and first space after ))])])Display standardized report to user:
✓ Commit Completed Successfully
**Commit:** <short_hash> \
**Branch:** <branch_name> \
**Subject:** <subject> \
**Files Changed:** <file_count>
Verify: Compare subject to approved message from Phase 3; warn if differs (indicates hook modification)
Run git status to confirm working tree is clean
Workflow complete.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.