Commit Changes
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Usage
/commit [options]
Create commits for: $ARGUMENTS
Arguments
$ARGUMENTS - Commit Context (optional)
Specify commit approach:
- Auto-analyze: No arguments - analyzes changes and proposes commits
- Single commit: "Create commit for all changes"
- Multiple commits: "Create logical commits for each component"
- With message: "Commit with message: Add user authentication"
- With attribution: "--co-author" or "--claude" to add Claude co-author attribution
Default Behavior
If no arguments:
- Analyzes git status and diff
- Groups related changes logically
- Drafts conventional commit messages
- Presents plan for user confirmation
- Creates commits after approval
Commit Changes
You are tasked with creating git commits for the changes made during this session.
Process:
-
Think about what changed:
- Review the conversation history and understand what was accomplished
- Run
git statusto see current changes - Run
git diffto understand the modifications - Consider whether changes should be one commit or multiple logical commits
-
Plan your commit(s):
- Identify which files belong together
- Draft clear, descriptive commit messages
- Use imperative mood in commit messages
- Focus on why the changes were made, not just what
-
Present your plan to the user:
- List the files you plan to add for each commit
- Show the commit message(s) you'll use
- Ask: "I plan to create [N] commit(s) with these changes. Shall I proceed?"
-
Execute upon confirmation:
- Use
git addwith specific files (never use-Aor.) - Create commits with your planned messages
- Show the result with
git log --oneline -n [number]
- Use
Attribution Options:
- Default: No co-author attribution (commits authored solely by user)
- With --co-author or --claude flag: Adds Claude attribution:
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com> - Write commit messages as if the user wrote them (unless attribution requested)
Remember:
- You have the full context of what was done in this session
- Group related changes together
- Keep commits focused and atomic when possible
- The user trusts your judgment - they asked you to commit
Action Policy
<default_behavior> This command implements changes by default when user intent is clear. Proceeds with:
- Git status analysis and change review
- Conventional commit message generation
- Automatic staging and committing of changes
- Pre-commit hook execution (if configured)
- Co-authored-by Claude attribution
Provides concise progress updates during commit execution. </default_behavior>
Output Templates
Commit Plan Template
## Proposed Commits
### Commit 1
**Files:** 3 files
- `src/auth/login.ts` (modified)
- `src/auth/logout.ts` (new)
- `tests/auth.test.ts` (modified)
**Message:**
feat(auth): Add logout functionality with session cleanup
Implements secure logout with token invalidation.
- Clear session tokens on logout
- Revoke refresh tokens
- Add logout tests
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
**Ready to commit?** [Y/n]
Result Template
✅ Commit Created
**Hash:** abc1234
**Branch:** feature/auth
**Message:** feat(auth): Add logout functionality with session cleanup
**Files:** 3 changed (+45, -10)
**Next:** `git push` or continue development
Verification Steps
Before creating commit:
- Run
git statusto see all changes - Run
git diffto review modifications - Group related files logically
- Draft conventional commit message (type(scope): description)
- Present plan to user for approval
- Stage specific files (never
git add .or-A) - Create commit with planned message
- Verify with
git log --oneline -1
Success Output
When commit completes successfully:
✅ COMMAND COMPLETE: /commit
Commits: N created
Files: M staged
Hash: <commit-hash>
Next: git push or continue development
Completion Checklist
Before marking complete:
- Git status analyzed
- Changes grouped logically
- Commit message(s) drafted
- Commit(s) created successfully
- Result shown to user
Failure Indicators
This command has FAILED if:
- ❌ No changes to commit
- ❌ Pre-commit hook failed
- ❌ Git staging failed
- ❌ Commit creation failed
When NOT to Use
Do NOT use when:
- No changes in working tree
- Changes need manual review first
- Want to commit specific files only (use git directly)
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Commit without review | Bad commits | Always review changes first |
| Vague messages | Unclear history | Use conventional commit format |
| Skip pre-commit hooks | Quality issues | Let hooks run |
Principles
This command embodies:
- #9 Based on Facts - Analyzes actual changes
- #6 Clear, Understandable - Conventional commit messages
- #3 Complete Execution - Full commit workflow
Full Standard: CODITECT-STANDARD-AUTOMATION.md