From hero-skills
Reviews staged Git changes, groups logical changesets, and creates conventional commits. Blocks commits to default branches, runs pre-commit hooks, and detects stale project config.
How this skill is triggered — by the user, by Claude, or both
Slash command
/hero-skills:commit-changesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Reviews your changes, groups them into logical changesets, and creates clean conventional commits.
Reviews your changes, groups them into logical changesets, and creates clean conventional commits.
ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
cat "$ROOT/HERO.md" 2>/dev/null || echo "NO_HERO_CONFIG"
# Stale-HERO check: if project config was committed more recently than
# HERO.md, surface a hint to refresh it. This is an intentional fast subset
# of the hero-skills plugin's scripts/check-hero-staleness.sh — keep the
# four daily-flow copies (commit-changes/push-pr/plan-work/test-changes)
# in sync with each other; the standalone script can carry a longer pattern
# list. The :(glob)**/ pathspecs catch monorepo subprojects.
HERO_TIME=$(git -C "$ROOT" log -1 --format=%ct -- HERO.md 2>/dev/null | grep -E '^[0-9]+$' || echo 0)
CONFIG_TIME=$(git -C "$ROOT" log -1 --format=%ct -- \
pyproject.toml ':(glob)**/pyproject.toml' \
package.json ':(glob)**/package.json' \
go.mod ':(glob)**/go.mod' \
Cargo.toml ':(glob)**/Cargo.toml' \
.github/workflows .pre-commit-config.yaml \
CLAUDE.md Makefile justfile Taskfile.yml 2>/dev/null | grep -E '^[0-9]+$' || echo 0)
if [ "${CONFIG_TIME:-0}" -gt "${HERO_TIME:-0}" ]; then
echo "note: HERO.md may be out of date — run hero-skills:init-hero --update to refresh."
fi
Read HERO.md if it exists. This skill uses:
Fixes: / Relates to: trailersIf HERO.md is missing, suggest hero-skills:init-hero but proceed with auto-detection. If the staleness hint fired, mention it once to the user but do not block — they can refresh later.
BRANCH=$(git branch --show-current)
DEFAULT_BRANCH=$(awk -F': ' '/^- default-branch:/ {print $2; exit}' "$ROOT/HERO.md" 2>/dev/null | xargs)
DEFAULT_BRANCH=${DEFAULT_BRANCH:-main}
echo "Current branch: $BRANCH (default: $DEFAULT_BRANCH)"
If on the default branch (main/master) or any protected branch: STOP. Never commit directly to main. Show:
You are on '$BRANCH', which is the default branch. Hero Commit never commits to the default branch.
I will create a feature branch from your current changes. Suggested name: '{suggested-branch}'
Options:
1. Use suggested name '{suggested-branch}'
2. Provide your own branch name
3. Cancel
Generate {suggested-branch} from the diff:
conventional, infer the type from changed files (docs/ → docs/, tests only → test/, source code → feat/ or fix/ based on heuristics) and append a 3-5 word slug derived from the diff summary, e.g. feat/add-self-review, fix/null-handling-in-auth.{issue-id}-{slug}.Wait for user choice. Then:
git checkout -b "$BRANCH_NAME"
The uncommitted changes follow the checkout into the new branch automatically — no stash needed. Confirm:
git branch --show-current
git status --porcelain
Proceed with the rest of the skill on the new branch.
if command -v pre-commit > /dev/null 2>&1; then
pre-commit run --all-files
else
echo "NO_PRECOMMIT"
fi
If pre-commit is installed and checks fail: report errors, offer to auto-fix, do not proceed until passing. If pre-commit is not installed: skip and continue.
git status --porcelain
git diff
git diff --cached
git diff --stat
For each changed file: read the diff, understand purpose, assess quality.
Invoke the simplify skill via the Skill tool. simplify is not part of this plugin — it ships separately (see the user-invocable skills list in the current session). It reviews the current diff for reuse, quality, and efficiency and fixes any issues found before the commit lands. Step 6 below handles the post-fix pre-commit re-run.
If the simplify skill is unavailable in this environment, report NO_SIMPLIFY_SKILL — falling back to inline checklist and apply this check before continuing to Step 5:
Additional checks beyond simplify:
Naming Consistency
Code Quality
Completeness
Report:
Code Review Summary
===================
Files Changed: 5
Lines Added: 120, Removed: 45
Issues Found:
- CRITICAL: [file:line description]
- WARNING: [file:line description]
Suggestions:
- [improvements]
Fix any CRITICAL or WARNING issues found. Re-run pre-commit after fixes (if available).
Group logically related changes:
git add file1 file2 ...
git diff --cached --stat
git commit -m "$(cat <<'EOF'
{type}({scope}): {description}
{body if needed}
Co-Authored-By: Claude <[email protected]>
EOF
)"
Types: feat, fix, refactor, docs, style, test, chore, perf
If issue ID in branch name: Add Fixes: PROJ-123 or Relates to: PROJ-123.
Dry-run any pre-push hooks now so failures surface before the user runs hero-skills:push-pr:
if command -v pre-commit > /dev/null 2>&1; then
pre-commit run --hook-stage pre-push --all-files
else
echo "NO_PRECOMMIT"
fi
Commit Summary
======================
Branch: {branch-name}
Commits Created: N
1. {type}({scope}): {description}
Files: file1, file2 (+X -Y)
Pre-commit: PASSED (or SKIPPED)
Next steps:
hero-skills:push-pr # Step 7 — push and open a draft PR
hero-skills:review-pr # Step 8 — self-review on the resulting draft (and Step 9 mark-ready)
hero-skills:push-pr--no-verify to skip hooksCo-Authored-By for AI-assisted commitsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub ai-hero/hero-skills --plugin hero-skills