skills/commit/SKILL.md
Stages, commits, and optionally pushes local changes with a conventional commit message — analyzes diffs, generates the message, confirms with the user, and commits. On protected branches, offers to create a feature branch automatically. Multi-repo aware. Use when ready to commit work in one step.
npx skillsauth add oprogramadorreal/optimus-claude skills/commitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Stage, commit, and optionally push local changes with a conventional commit message. Commits on the current branch — or, if the current branch is protected, offers to create a feature branch automatically.
Read $CLAUDE_PLUGIN_ROOT/skills/commit/references/gather-changes.md and follow the procedure (multi-repo detection + git commands).
Read $CLAUDE_PLUGIN_ROOT/skills/commit-message/references/conventional-commit-format.md and follow its instructions to analyze the gathered changes and generate a conventional commit message.
If changes span multiple concerns, use AskUserQuestion to ask whether to commit everything together or split into separate commits. If splitting, process each commit separately through steps 3–7.
In a multi-repo workspace, process each repo with changes through steps 2–7 independently.
If git status --short shows untracked files (??):
.env, *.key, *.pem, *.pfx, credentials.*, secrets.*, *.sqlite, *.db)AskUserQuestion — header "Untracked files", question "Include these untracked files in the commit?":
Get the current branch:
git rev-parse --abbrev-ref HEAD
Check if .claude/hooks/restrict-paths.sh exists. In a multi-repo workspace, check two locations (child repo level first, then workspace root):
<child-repo>/.claude/hooks/restrict-paths.sh<workspace-root>/.claude/hooks/restrict-paths.shUse the first one found (child repo level takes precedence). In a single-repo project, check .claude/hooks/restrict-paths.sh at the project root.
If found, read the file and extract the PROTECTED_BRANCHES array to determine whether the current branch is protected. Remember this result for step 5.
If the hook file does not exist at any checked location, assume the branch is safe for all operations.
If the current branch is protected, generate a feature branch name. Read $CLAUDE_PLUGIN_ROOT/skills/commit/references/branch-naming.md for the naming convention. The <type> comes from the conventional commit message generated in step 2; the <description> is the slugified subject line. Remember this name for step 5.
Present a summary for each repo (in multi-repo, use a heading per repo — e.g., ## repo-name):
Then use AskUserQuestion — header "Action", question "How would you like to proceed?":
If the current branch is NOT protected:
If the current branch IS protected (replace the first two options with feature-branch alternatives):
<name>, commit, and push" — create a new feature branch from the current branch, switch to it, commit, and push<name> and commit only" — create a new feature branch, switch to it, and commit without pushingIf the user chose a "Create branch" option in step 5, create and switch to the feature branch first:
git checkout -b <branch-name>
If branch creation fails (e.g., the branch already exists), report the error and let the user choose a different name or cancel.
Stage the files determined in steps 1 and 3:
git add <specific files>
Prefer git add <specific files> over git add -A. Never stage files that look like secrets.
Commit with the confirmed message. Use a heredoc to preserve multi-line messages (subject + body):
git commit -m "$(cat <<'EOF'
<message>
EOF
)"
If the commit fails for any reason, report the error to the user and stop — do not proceed to the push step.
Only if the user chose an option that includes pushing in step 5:
git push
If there is no upstream tracking branch:
git push -u origin <branch>
If the push fails for any reason, report the error to the user.
Present a summary of what was done (in a multi-repo workspace, show a combined summary across all repos):
<branch-name> (only if a feature branch was created in step 6)<short-hash> <commit message> (per repo in multi-repo)origin/<branch> (if push was performed)If a feature branch was created, inform the user: "You are now on <branch-name>. You can keep working on this branch, or use /optimus:pr to create a pull request."
Otherwise, recommend the next step based on readiness:
/optimus:pr to create or update a PR./optimus:code-review once more changes accumulate). Then emit the closing tip per $CLAUDE_PLUGIN_ROOT/references/skill-handoff.md "Closing tip wording" — use Variant C (default).When /optimus:pr is the recommended next step (either branch above), emit the closing tip per $CLAUDE_PLUGIN_ROOT/references/skill-handoff.md "Closing tip wording" — use Variant A with <continuation-skill(s)> = /optimus:pr and <non-continuation-examples> = /optimus:code-review, etc.
development
Iterative test-coverage improvement loop — dispatches `/optimus:unit-test` (unit-test phase) and `/optimus:refactor` with testability focus (refactor phase) into fresh subagent contexts per cycle, applies tests, runs the test suite, bisects refactor failures, and continues until coverage plateaus or the cycle cap (default 5, hard cap 10). Use to drive coverage up on a codebase that has untestable barriers — the loop alternates between writing tests and unblocking testability so a single skill cannot stall.
development
Iterative project-wide refactoring — runs `/optimus:refactor` in a fresh subagent context per iteration, applies fixes, runs tests, bisects failures, and continues until convergence or the iteration cap (default 8, hard cap 20). Supports `testability` or `guidelines` focus to prioritize finding categories. Each iteration runs in an isolated subagent so context does not accumulate. Requires a test command in .claude/CLAUDE.md. Use for thorough guideline alignment or testability cleanup before /optimus:unit-test.
development
Iterative auto-fix code review — runs `/optimus:code-review` in a fresh subagent context per iteration, applies fixes, runs tests, bisects failures, and continues until convergence or the iteration cap (default 8, hard cap 20). Each iteration runs in an isolated subagent so context does not accumulate. Requires a test command in .claude/CLAUDE.md. Use when single-pass review leaves issues or for thorough cleanup before a release.
development
Implements an approved spec by having Claude design and run its own Claude Code dynamic workflow (real parallel subagents) — you hand it the goal and constraints, it chooses the orchestration. Test-first is enforced as a quality bar (tests accompany or precede code and the suite is left green), not as supervised Red-Green-Refactor. A peer of /optimus:tdd for spec implementation; prefer it for large or parallelizable specs where one linear pass is slow. Requires /optimus:init and a spec (auto-detects docs/specs/ or docs/jira/, or pass a path). Uses meaningfully more tokens than a normal session. Use when a spec is ready to build and you want fan-out implementation instead of turn-by-turn TDD cycles.