Session Workflows
A session is more than a conversation. Claude saves your history, snapshots files before editing, links sessions to PRs, and lets you run multiple instances in parallel without conflicts. These patterns help you manage that infrastructure.
Creating Pull Requests
Claude can create PRs directly — either in one shot or step by step.
create a pr for my changesOr guide it through for a better description:
summarize the changes I've made to the auth modulecreate a prenhance the PR description with more context about the security improvementsThe three-step version gives you a PR description you can actually stand behind. Once Claude runs gh pr create, the session is linked to that PR. Resume it later — new context, same PR:
claude --from-pr 123Tip: After creating the PR, ask Claude to highlight the riskiest parts of the change — useful for calling out what reviewers should focus on.
Desktop Notifications
Long-running tasks mean switching windows and forgetting to check back. Set up a notification so Claude alerts you when it is done or needs approval.
Open ~/.claude/settings.json and add:
{ "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'" } ] } ] }}For Linux, replace the command with:
notify-send 'Claude Code' 'Claude Code needs your attention'For Windows:
powershell.exe -Command "[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Claude Code needs your attention', 'Claude Code')"Narrow it with a matcher — fire the notification only for specific events:
| Matcher | Fires when |
|---|---|
idle_prompt | Claude is done and waiting for your next prompt |
permission_prompt | Claude needs you to approve a tool use |
elicitation_dialog | Claude is asking you a question |
auth_success | Authentication completes |
Leave matcher empty (as above) to fire on all events. To verify your hook is registered, run /hooks inside a Claude session.
Running Parallel Sessions
When you are working on multiple tasks at the same time, each Claude session needs its own isolated copy of the codebase. Without isolation, edits from one session corrupt the other.
Git worktrees solve this: each session gets a separate directory, a separate branch, and a separate context. They share repository history and remote connections, but nothing else.
# Terminal 1 — auth refactor in its own branch and directoryclaude --worktree feature-auth -n "auth-refactor"
# Terminal 2 — separate bug fix, completely isolatedclaude --worktree bugfix-login -n "login-fix"Each worktree is created at <repo>/.claude/worktrees/<name> and branches from your default remote branch. When you exit a session with no changes, the worktree is cleaned up automatically. With changes, Claude asks whether to keep or remove it.
Add .claude/worktrees/ to your .gitignore to keep worktree contents out of your main repo’s untracked files list.
Copying local config to worktrees: Worktrees are fresh checkouts — they do not include .env or other gitignored files. Add a .worktreeinclude file to your project root to copy them automatically:
.env.env.localconfig/secrets.jsonResuming Sessions
Sessions are saved automatically. Three ways to return to previous work:
# Resume the most recent session in this directoryclaude --continue
# Pick from a list of sessionsclaude --resume
# Resume by name (if you named it)claude --resume auth-refactor
# Resume a session linked to a specific PRclaude --from-pr 123Inside a session, use /resume to switch to a different conversation. The picker shows session name, time elapsed, message count, and git branch. Press P to preview before resuming.
Name sessions when you start: It is much easier to find auth-refactor than the first few words of whatever you typed.
claude -n auth-refactorOr during a session:
/rename auth-refactorRewinding When Something Goes Wrong
Every file edit is reversible. Before Claude edits any file, it snapshots the current contents. If a change goes wrong, you have options.
Press Esc twice to open the rewind menu:
| Option | What it does |
|---|---|
| Restore code + conversation | Roll back files and conversation to the snapshot |
| Restore conversation only | Keep file edits, undo the conversation history |
| Restore code only | Roll back file edits, keep the conversation |
| Summarize from here | Compact conversation to this point and continue |
Checkpoints are local to your session and separate from git. They cover file changes only — actions that affect remote systems (databases, APIs, deployments) are not reversible this way. That is why Claude asks before running commands with external side effects.
Knowing you can rewind makes it easier to let Claude experiment on complex problems without fear.
Asking Claude About Itself
Claude has access to its own documentation and can answer questions about its features.
how do I set up hooks to auto-format on save?what's the best way to structure my CLAUDE.md?how do I use MCP with Claude Code?what's the difference between a skill and a subagent?Run /powerup for interactive lessons with animated demos. Run /doctor to diagnose common installation issues.
Related: Prompting Patterns for the techniques you use within sessions. Creator Workflows: Parallel Execution for Boris Cherny’s advanced patterns for running dozens of sessions simultaneously.