Agent skill
committing-changes
Stage, validate, and commit changes with a clear message, optionally pushing to remote and monitoring CI. Use when committing code, creating a commit, pushing changes, or doing a commit-and-push workflow.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/committing-changes-trevors-dot-claude
SKILL.md
Committing Changes
Auto-stage, validate, and commit changes. Pass --push to also push and monitor CI.
Workflow
1. Detect VCS
if jj root 2>/dev/null; then
# USE JJ WORKFLOW
else
# USE GIT WORKFLOW
fi
CRITICAL: Always use -m flag with jj to prevent editor from blocking.
2. Clean Up Checkpoints
Abandon/squash any "checkpoint:" commits from Claude's Stop hook.
3. Check Branch Safety
Read ./CLAUDE.md for project permissions. If on a protected branch without permission, suggest a feature branch. Cache decisions for future runs.
4. Run Validation
Auto-detect project type and run: format -> lint -> typecheck. Stop on failure.
5. Craft Commit Message
Use conventional commits format: type(scope): description
Valid types: feat, fix, refactor, docs, style, perf, test, build, ci, chore.
Choose type from the diff:
- New functionality →
feat - Bug fix →
fix - Code restructuring without behavior change →
refactor - CI/CD config →
ci - Build system, deps →
build - Documentation →
docs
Scope is optional but encouraged for multi-module repos. Keep subject under 50 chars, use imperative mood ("add" not "added"). Focus on the "why" not the "what".
6. Commit
jj workflow (preferred):
jj status && jj diff --stat
jj describe -m "feat: message here"
git workflow (fallback):
git add <specific-files>
git commit -F /tmp/commit-msg.txt
Use the Write tool for commit message files (avoids shell escaping). Handle pre-commit hook failures by re-staging and retrying once.
7. Push (if --push or explicitly requested)
jj:
jj bookmark set <branch> -r @
jj git push --bookmark <branch>
git:
git push -u origin HEAD
8. Monitor CI (after push)
If .github/workflows/ exists and ci=github-actions in hook output:
uv run ~/.claude/skills/monitoring-ci/ci-monitor.py --branch <branch-name>
Run in background. Tell user: "CI monitor running in background."
Error Handling
- Ask user about unknown project permissions
- Stop on protected branch violations
- Auto-fix code quality issues using detected formatters/linters
- Re-stage once if pre-commit hooks fail (git only)
- For jj: use
jj op restoreif something goes wrong
Safety Rules
- Never commit to protected branches without permission
- Use temporary files for all commit message operations
- Stop on merge conflicts
- Check branch protection before making changes
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?