jj-workflow
Jujutsu (jj) version control for AI-assisted development. Use when:- Repo has `.jj/` directory (check with `jj root`)- Need undo/recovery after breaking changes- Curating messy history before PR
When & Why to Use This Skill
This Claude skill integrates Jujutsu (jj), a next-generation version control system, into AI-assisted development workflows. It simplifies versioning by eliminating the staging area, providing a robust operation log for instant recovery from breaking changes, and allowing developers to curate clean, professional commit histories before pushing to Git repositories. It is specifically designed to provide a safety net for rapid, AI-driven iterations.
Use Cases
- Instant Recovery: Use the operation log to immediately revert to a functional state if an AI-generated code change introduces breaking errors or unexpected behavior.
- History Curation: Seamlessly combine and organize messy incremental checkpoints into logical, readable commits using squash and describe commands before submitting a Pull Request.
- Risk-Free Experimentation: Quickly create new change branches to test experimental features or refactors, with the ability to easily abandon them if they fail without impacting the main codebase.
- Git-Compatible Workflow: Manage complex local versioning logic using jj's mutable change model while maintaining full compatibility with standard Git-based team environments.
| name | jj-workflow |
|---|---|
| description | | |
jj Workflow
Mental Model
No staging area. Your working directory is always a commit. Every save is tracked.
@= your current change (the working copy)@-= parent of current change- Changes are mutable until pushed
When to Use What
| Situation | Do This |
|---|---|
| Starting new work | jj new -m "what I'm trying" |
| Work is done, move on | jj new (current becomes parent) |
| Annotate what you did | jj describe -m "feat: auth" |
| Broke something | jj op log → jj op restore <id> |
| Undo one file | jj restore --from @- <path> |
| Combine messy commits | jj squash |
| Split bloated commit | jj split |
| Try something risky | jj new -m "experiment", then jj abandon @ if it fails |
AI Coding Pattern
During implementation, don't think about commits. Just work. jj tracks everything.
# Before risky change
jj describe -m "checkpoint: auth works"
jj new -m "adding OAuth"
# If it breaks
jj op log # Find good state
jj op restore <id> # Go back
# When done, curate
jj log -r 'ancestors(@, 10)'
jj squash # Combine checkpoints
jj describe -m "feat: OAuth support"
Push to GitHub
jj bookmark create feature-x # Name for pushing
jj git push --allow-new # Push to remote
Teammates see clean git. They don't know you used jj.
Recovery
The oplog records every operation. Nothing is lost.
jj op log # See all operations
jj undo # Undo last operation
jj op restore <id> # Jump to any past state
Bail Out
rm -rf .jj # Delete jj, keep git unchanged