Advanced Patterns & Optimization
Power user techniques for maximum productivity
Pixl presents
Parallel agents, worktrees, cost control, and an honest list of when not to use Claude Code. Power user stuff, minus the ego.Parallel agents, worktrees, cost control, and an honest list of when not to use Claude Code. Power user stuff, minus the ego.

This is the stuff experienced Claude Code users lean on to get the most out of it. We're covering parallel agents, keeping costs sane, managing sessions and plugging Claude into CI/CD.
Parallel Agents with Git Worktrees#
Git worktrees let you check out several branches at the same time, each in its own directory. Pair that with Claude Code and you get REAL parallel development.
Step 1. Create Worktrees#
git worktree add -b feature/auth ../feature-auth
git worktree add -b feature/search ../feature-search
git worktree add -b fix/login-crash ../fix-bugThe -b flag makes a brand new branch for each worktree. If the branch already exists, leave -b off and put the branch name at the end instead (git worktree add ../feature-auth feature/auth).
Claude Code can also do this part for you. claude --worktree feature-auth (or claude -w feature-auth) starts a session inside its own fresh worktree under .claude/worktrees/.
Step 2. Run Claude in Each#
Open a separate terminal for each worktree directory and launch Claude in every one. Each runs on its own with its own context.
Step 3. Work in Parallel#
Give each Claude its own task. They don't bump into each other, because they're on different branches in different directories.
When to use this
- Several independent features in the same sprint
- Long-running tasks you want to split up
- A/B testing two different takes on the same feature
Cost Management#
Model Switching#
Not every task needs the biggest, smartest model (and your wallet will thank you for remembering that).
| Task Type | Recommended Model | Reason |
|---|---|---|
| Architecture decisions | Opus | Best reasoning for complex tradeoffs |
| Feature implementation | Sonnet | Good balance of speed and capability |
| Simple edits, formatting | Haiku | Fast and cheap for straightforward work |
| Debugging complex issues | Opus | Better at reasoning through edge cases |
| Code reviews | Sonnet | Sufficient for pattern recognition |
Switch models with /model in the middle of a session. The lineup changes as new models ship (as of October 2026 there's also Fable, Anthropic's most capable model, for big jobs that run longer than one sitting), so run /model to see what your plan actually offers.
Session Management#
Naming Sessions#
Use /rename to give a session a name you'll actually recognize later.
/rename add-search-featureResuming Work#
--continue- Pick back up in your most recent session--resume- Choose from a list of past sessions, or pass a session name or ID to jump straight to it
Super handy when you stop halfway through a task and want to come back later with all the context still there.
Session Patterns#
# Start fresh for a new task
claude
# Continue where you left off
claude --continue
# Pick from a list of past sessions
claude --resume
# Resume a specific named session
claude --resume add-search-featureCI/CD Integration#
Claude Code can run inside CI pipelines in headless mode, which is where -p comes in.
Headless Mode#
claude -p "Fix all lint errors in this PR" --permission-mode dontAsk --allowedTools "Read" "Edit" "Bash(npm run lint:fix)"Key flags
-p- Runs your prompt with no interactive session, prints the result and exits--allowedTools- Pre-approves the tools and commands Claude can use without asking--permission-mode dontAsk- Anything NOT pre-approved gets denied instead of waiting on a prompt nobody's there to answer--tools- Shrinks the toolbox itself, if you want certain tools gone entirely
Common CI Patterns#
These steps assume an earlier step already installed Claude Code on the runner and handed it an ANTHROPIC_API_KEY from your repo secrets. Without both, claude won't run.
Auto-fix lint issues
- name: Fix lint
run: claude -p "Fix all ESLint errors. Don't change logic." --permission-mode dontAsk --allowedTools "Read" "Edit"Generate PR descriptions
- name: PR Description
run: claude -p "Generate a PR description from the diff" --permission-mode dontAsk --allowedTools "Read" "Bash(git diff *)" "Bash(git log *)"Review for common issues
- name: Code Review
run: claude -p "Review for security issues. Report findings." --permission-mode dontAsk --allowedTools "Read" "Bash(grep *)"When NOT to Use Claude Code#

Claude Code isn't the right tool for every job.
- Real-time debugging with breakpoints - Use your IDE's debugger
- Visual design work - Use Figma or whatever design tool you like
- Learning a brand new concept from scratch - Read the docs first, then use Claude to practice
- Highly regulated code - Financial or medical systems may need human-only changes
- Judging how something feels to use - Claude can open your app in a browser and click through it, but only a real person can tell you if it feels right
Know when to step back to the old-school tools. Claude Code shines brightest when the task is well-defined and you know what "done" looks like. Same reason my Bulk Image Processor can chew through 100 images in about 5 minutes... the job is clear and the finish line is obvious.
TL;DR#
- Git worktrees let you run parallel Claude sessions on different branches
- Match the model to the job (Opus for architecture, Sonnet for features, Haiku for simple edits)
- --continue and --resume save your work across breaks
- Headless mode plugs Claude into CI/CD with locked-down tools
- Know when Claude Code isn't the right tool for the job
This lesson ends with 2 short activities.