AI CODING TOOLS / LESSON 12
Advanced Patterns & Optimization.
Power user techniques for maximum productivity

Loading the lesson…
Loading activities…
AI CODING TOOLS / LESSON 12
Power user techniques for maximum productivity

Loading the lesson…
Loading activities…
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.
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.
The -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/.
Open a separate terminal for each worktree directory and launch Claude in every one. Each runs on its own with its own context.
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
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.
Use /rename to give a session a name you'll actually recognize later.
--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 itSuper handy when you stop halfway through a task and want to come back later with all the context still there.
Claude Code can run inside CI pipelines in headless mode, which is where -p comes in.
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 entirelyThese 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
Run the project's lint check in a separate CI step after Claude edits the files. If it passes, a separate workflow step with branch-only push permission can commit the changes to the PR branch. Claude itself does not need Git push access.
Generate PR descriptions
Review for common issues
Claude Code isn't the right tool for every job.
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.