**Arguments received:** $ARGUMENTS
Creates a conventional commit with optional staging, amending, and pushing. Analyzes changes to generate messages or uses provided text, while preventing sensitive file commits.
/plugin marketplace add OshanKHZ/cc-swiss-knife/plugin install oshankhz-claude-code@oshankhz-claude-codeArguments received: $ARGUMENTS
Parse these flags from $ARGUMENTS:
| Flag | Effect |
|---|---|
--push | Push to remote after commit |
--amend | Amend last commit (use with caution) |
--all | Stage all changes before commit (git add -A) |
Examples:
/commit feat: add login → commit with message/commit --push fix: typo → commit and push/commit --all --push → stage all, auto-generate message, push/commit --amend → amend last commit with new messageAfter parsing flags, the remaining text is the commit message.
Before creating the commit, you should check:
git branch --show-currentgit log --oneline -5git diff --cached --statgit status --shortIf nothing is staged (git diff --cached is empty):
git add -A if appropriateNEVER commit:
.env, .env.* files*secret*, *credential*, *.key, *.pem*password*, *token* filesIf detected in staged files, warn and unstage them.
If $ARGUMENTS provided: Use it directly as commit message.
If empty: Analyze staged changes and generate message.
type(scope): description
[optional body - WHY, not WHAT]
Types:
| Type | When to use |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
refactor | Code change (no feat/fix) |
test | Adding/updating tests |
chore | Maintenance, deps, config |
style | Formatting, whitespace |
perf | Performance improvement |
ci | CI/CD changes |
Scope (optional): Area affected in parentheses
feat(auth): fix(api): docs(readme):Breaking change: Add ! before :
feat!: refactor(api)!:Use IMPERATIVE mood - write messages as direct commands:
| ✅ Correct (imperative) | ❌ Incorrect |
|---|---|
| add user login | added user login |
| fix null pointer | fixed null pointer |
| update dependencies | updating dependencies |
| remove deprecated API | this commit removes deprecated API |
| refactor auth module | refactored auth module |
Key principle: Write what the commit does, not what you did.
Think of it as completing the sentence: "This commit will..."
IMPORTANT: The sentence above is just a mental check - NEVER include "this commit will" or "if applied" in the actual message. Just write the action directly.
Length:
After generating the commit message, use AskUserQuestion to confirm:
git commit if user confirmsQuestion format:
Ready to commit with this message:
"[generated message]"
Proceed with commit?
Options:
- Yes, commit now
- No, cancel
If confirmed, create a simple commit without footers:
git commit -m "type(scope): description"
IMPORTANT: Do NOT add any footers like "Generated with Claude Code" or "Co-Authored-By" - keep commits clean and simple.
If --amend flag present:
git commit --amend insteadgit status if branch is ahead of remoteIf --push flag present:
git pushgit push -u origin <branch>After commit, show: