Fix a Bug and Build a Feature at the Same Time with Claude Code
You’re halfway through building a new feature with Claude Code when a bug report lands. The fix is straightforward, but your working directory is full of uncommitted feature work. You can’t just switch branches. You could stash, but that’s fragile. You could commit half-finished work, but that’s messy.
This is the most common friction point when working with AI agents: real work doesn’t happen one task at a time.
You can run a bug fix and a feature build simultaneously, with two Claude Code agents, zero conflicts, and a clean git history at the end.
The messy way
Without isolation, the typical approach looks something like this:
- You’re on
feature/dashboardwith Claude building new UI components - Bug report comes in — login is broken in production
- You ask Claude to stop what it’s doing
git stashyour feature workgit checkout main- Fix the bug with Claude, commit, push
git checkout feature/dashboardgit stash pop- Hope nothing conflicted
- Try to remember where Claude left off on the feature
This works, technically. But it breaks your flow, risks merge conflicts from the stash, and forces you to serialize work that could easily run in parallel. Worse, if Claude was mid-edit when you interrupted, you might lose context on what it was doing.
The clean way: two shards, two branches
The same scenario with isolated shards in Crystl.
Step 1: Keep the feature running
Your Claude agent is already working on feature/dashboard in Shard A. Don’t touch it. Let it keep going.
Step 2: Create an isolated shard for the bug fix
Open a new isolated shard from the Crystal Rail. Crystl creates a git worktree branched from main — call it fix/login-redirect. This shard gets its own complete copy of the repo, checked out to the new branch.
Step 3: Fix the bug
In Shard B, tell Claude what’s wrong:
“The login redirect is sending users to /dashboard before their session token is set. Fix the redirect logic in the auth middleware to wait for the token.”
Claude works in the worktree. It edits files, runs tests, iterates. Meanwhile, Shard A is still building dashboard components on its own branch. Neither agent knows the other exists. Neither can interfere with the other’s files.
Step 4: Merge the fix
When Claude finishes the bug fix in Shard B, open the Isolation panel in the shard bar and choose Merge to main. Crystl rebases the fix branch onto main, fast-forward merges, and cleans up the worktree. The shard closes.
Your fix is now on main, ready to push.
Step 5: Keep building the feature
Shard A never stopped. Claude has been working the entire time. When the feature is done, merge it the same way — or push the branch and open a PR, whatever your workflow calls for.
What you gain
The numbers aren’t complicated: two tasks that would take 30 minutes each, done sequentially, take an hour. Done in parallel, they take 30 minutes. But the real win is flow.
No context switching. You don’t have to explain the feature state to Claude again after the bug detour. The feature session was never interrupted.
Clean git history. Each task has its own branch with clear, focused commits. No “WIP: stash before bug fix” commits cluttering the log.
No stash anxiety. git stash is fine for quick saves, but stash conflicts are silent and surprising. With isolated branches, conflicts are explicit and manageable.
Parallel testing. Both agents can run test suites independently. A failing test in the bug fix shard doesn’t block the feature shard.
Taking it further: three or four shards
Once parallel work feels natural, you start using it for more than emergencies. A typical layout might look like:
- Shard 1 — Feature work (isolated,
feature/dashboard) - Shard 2 — Bug fix (isolated,
fix/login-redirect) - Shard 3 — Tests (isolated,
test/api-coverage) - Shard 4 — Main session (regular shard on
main, for quick questions and code review)
Each isolated shard has its own branch and file state. The regular shard stays on main for read-only work. You can see all of them at a glance in the Crystal Rail and know which is which by color and label.
Crystl also shows notifications when a session finishes or needs approval, so you don’t have to keep checking on background shards. If Claude hits a permission request in Shard 3 while you’re focused on Shard 1, an approval card floats onto your screen — respond and keep working.
The workflow, condensed
- Keep your current Claude session running
- Create an isolated shard for the new task
- Let both agents work in parallel
- Merge each branch when its task is done
- Move on
No stashing. No context loss. No merge roulette.
If you’re working with Claude Code on anything bigger than a single-file script, this changes how you think about task management. Parallel agents aren’t a power-user trick — they’re the natural way to handle real workloads.
Get Crystl for free and try the two-shard workflow on your next bug-plus-feature day.