jj-commit
Generate conventional commit messages for jj by analyzing diffs, running tests first, and handling immutable commits
When & Why to Use This Skill
This Claude skill automates the generation of standardized conventional commit messages for the Jujutsu (jj) version control system. It streamlines the development workflow by analyzing code diffs, performing automated test validation before committing, and intelligently managing VCS-specific constraints like immutable commits to ensure a clean and professional project history.
Use Cases
- Automated Documentation: Generate precise, context-aware commit messages (feat, fix, refactor) by analyzing code changes, saving time and maintaining consistency across the repository.
- Pre-commit Quality Gates: Automatically detect project frameworks and run relevant test suites (e.g., pytest, cargo test, npm test) to ensure only passing code is committed.
- Jujutsu Workflow Optimization: Simplify the use of the Jujutsu VCS by handling complex CLI commands and providing smart workarounds for immutable commit errors.
- Standardizing Team Contributions: Enforce the Conventional Commits specification across a team by providing a guided, automated interface for change descriptions.
| name | jj-commit |
|---|---|
| description | Generate conventional commit messages for jj by analyzing diffs, running tests first, and handling immutable commits |
JJ Commit Message Generator
Generate conventional commit messages for Jujutsu (jj) by analyzing diffs.
Instructions
When the user asks to create a commit message or commit changes:
Run tests first:
- Detect test framework from project (package.json, Cargo.toml, pyproject.toml, etc.)
- Run appropriate test command:
- npm/yarn:
npm testoryarn test - Rust:
cargo test - Python:
pytestorpython -m pytest - Go:
go test ./...
- npm/yarn:
- If tests fail:
- Show failures to user
- Ask: "Tests failing. Fix before commit, skip tests, or commit anyway?"
- Only proceed with commit if user explicitly chooses to skip/ignore
- If no test command found, proceed without testing
Gather context:
- Run
jj diffto see current changes - Run
jj log -r @to see the current change description - If working with specific revisions, use
jj diff -r <revision>
- Run
Analyze changes:
- Identify the type: feat, fix, refactor, docs, test, chore, style, perf
- Determine scope if clear from file paths
- Summarize the "why" (intent) not just "what" changed
Generate message: Format:
<type>(<scope>): <subject>- Subject: imperative mood, lowercase, no period, < 72 chars
- Body (optional): explain why, not what
- Favor precision over verbosity
Examples:
feat(ui): add dark mode togglefix(auth): prevent token refresh looprefactor(api): simplify error handling
Handle immutable commits: If you get error:
Commit ... is immutable:- Explain that the commit is immutable
- Suggest running the command with
--ignore-immutableflag - Ask user if they want to proceed with the flag
Execute commit:
- Use
jj describe -m "message"for current change - Or
jj describe -r <revision> -m "message"for specific revision - If immutable and user approves, add
--ignore-immutable
- Use
Tool access
allowed-tools:
- Bash
- Read
- Grep
Notes
- Keep messages concise and clear
- Focus on intent, not implementation details
- Follow conventional commit format strictly