Claude Code Development Workflows
Independent educational resource, not an official Anthropic course. Facts about the API, prices and limits were checked against Anthropic's documentation on 15 November 2026 and the code was run against a local mock of the API, not the live service. Check the linked official pages before relying on a number, and test with your own key.
Knowing the features is one thing; knowing what a good day with Claude Code looks like is another. This lesson walks through a complete workflow, from "I need a coupon feature" to a reviewed pull request, using only the pieces from earlier lessons. It then covers the other everyday patterns: fixing bugs, refactoring, running parallel sessions, resuming work, and scripting Claude from the command line.
What you'll learn
- A repeatable loop for features: explore, specify, plan, implement, verify, review, commit.
- When to use plan mode, and how to start it.
- Prompt patterns for bugs, refactors, tests and pull requests.
- Parallel sessions with git worktrees, and non-interactive runs with
-p.
Before you start
The feature loop
Anthropic's best-practices page boils good results down to a few habits. Tell Claude what it can't see. Give it a check to run. Enforce the rules that can't have exceptions. Here's how those turn into a working sequence for one feature. The example is "add coupon codes to checkout" in the example project from earlier lessons. The prompts below are illustrative wording, and we didn't run this particular feature through a live model.
1. Explore before you change anything
Start a session at the repository root and ask questions first. Reading is cheap and surfaces surprises:
how does checkout calculate the order total today?
where are discounts handled, if anywhere?
which tests cover the checkout flow?
If the answer needs a lot of file reading, say use a subagent to investigate how checkout calculates totals so the files stay out of your main context (lesson 5.8).
2. Write the spec, with Claude interviewing you
When you haven't pinned the details down, let Claude ask:
I want to add coupon codes to checkout but haven't thought it through. Interview me until you could write the spec, then write it to SPEC.md.
Expect multiple-choice questions: percentage or fixed amount, one coupon per order or several, what happens on expiry. Answering them is the real design work. The result is a SPEC.md with requirements and edge cases. Then start a fresh session (/clear) so the build begins with clean context and a written definition of done.
3. Plan before editing
For anything that touches several files, use plan mode. Claude reads and proposes a plan but makes no source edits until you approve. Start it with claude --permission-mode plan, or press Shift+Tab mid-session until the status bar shows plan mode:
read SPEC.md and the checkout code, then propose a plan. list the files you'll change and the tests you'll add
Read the plan as you'd read a colleague's design note. This is the cheapest place to catch "that's the wrong file" or "we already have a helper for that". The plan Claude wrote in plan mode is re-injected after compaction, so it survives a long build.
4. Implement with a check Claude can run
The single most useful line in CLAUDE.md is the command that tells Claude whether the work is done. Ours says vendor/bin/pest, with one test file runnable by path. Make the check part of the prompt:
implement the spec in SPEC.md. write the Pest tests first, run them to see them fail, then make them pass. keep going until vendor/bin/pest tests/Feature/CouponTest.php passes, and show me the output
Anthropic's guidance is that without something that comes back pass or fail, "looks done" is all Claude has to go on, which makes you the test suite. With one, Claude makes the change, runs the check, reads the failure and fixes it. Ask for evidence: the command and its output, not just "all tests pass".
5. Let the harness enforce the boring parts
While this runs, the hooks from lesson 5.7 work for you without being asked. Each edited PHP file is formatted by Pint. An attempt to edit composer.lock or .env is blocked. A destructive artisan command is refused. And the Stop hook sends Claude back to fix any style failure before it can finish. None of that depends on Claude remembering the rules.
6. Review with fresh eyes
Claude reviewing its own work in the same session is weak, because it saw how the code was written. Use a reviewer that didn't:
use the reviewer subagent to compare the coupon changes against SPEC.md. check every requirement is implemented and the edge cases have tests. report gaps that affect correctness and skip style
In the terminal, /code-review reviews the diff in a fresh subagent that never saw your conversation. Keep "skip style". A reviewer asked to find problems always finds something, and fixing every finding leaves extra abstractions and tests for cases that can't happen.
7. Commit, open the pull request, move on
Claude works with git directly:
what files have I changed?
commit my changes with a descriptive message
create a pr
Review the generated pull request description before submitting it, and ask Claude to point out risks. The session is linked to the PR when Claude creates it, so you can come back with claude --from-pr 123. Finish with /clear before the next, unrelated task.
Everyday patterns
Fixing a bug
Give the symptom, the place to look, and what "fixed" means. Compare the vague and the useful forms from Anthropic's page:
fix the login bug
users report login fails after the session times out. look at token refresh in src/auth/, write a failing test that reproduces it, then fix it
Paste the error, tell Claude the command that reproduces it, and say whether it's intermittent. A failing test first gives Claude a check to run and gives you a regression test.
Refactoring
Do it in small, testable steps: find the old pattern, ask for the plan, apply it, run the tests. "Refactor utils.js to use modern JavaScript features while maintaining the same behaviour" followed by "run the tests for the refactored code" is the pattern in Anthropic's recipes. For one large mechanical change across many files, /batch splits the work into 5 to 30 units, shows you the plan, and after approval gives each unit its own worktree and opens a PR or reports back.
Writing tests
Be specific about behaviour: "add tests for the notification service; cover the edge conditions, run them and fix any failures". Claude examines your existing tests to match the style, and can suggest edge cases you missed.
Parallel sessions with worktrees
Work on a feature in one terminal while Claude fixes a bug in another, without the edits colliding. Each git worktree is a separate checkout on its own branch:
claude --worktree feature-auth # or: claude -w feature-auth
Run the same command with a different name in a second terminal for an isolated parallel session. A worktree is a fresh checkout, so gitignored files such as .env and your dependencies aren't there. List the small files you need in a .worktreeinclude file at the repository root (same syntax as .gitignore) and Claude Code copies them in:
.env
.env.local
Keep large directories like node_modules out of it (it copies, it doesn't link), and put the install command in CLAUDE.md instead. A second session also makes the easiest independent reviewer: one session writes the code, another reviews a file without having watched it being written, and you carry the findings across.
Resuming
claude --continue # most recent session in this directory
claude --resume # pick from a list
claude --resume coupons # by name, after /rename coupons
Scripting with -p
Claude Code follows the Unix philosophy: it reads from stdin and writes to stdout, so it composes with other tools. From Anthropic's own examples:
git log --oneline -20 | claude -p "summarize these recent commits"
git diff main --name-only | claude -p "review these changed files for security issues"
tail -200 app.log | claude -p "tell me if you see any anomalies"
These calls use the model, so we haven't executed them here. For unattended runs, Anthropic suggests five questions to answer first: does it know what done looks like, can it check its own work, what is it allowed to touch, what stops it (a cap such as --max-turns or --max-budget-usd with -p, or a spend limit), and who signs off on the result. Lesson 5.11 turns those into a checklist. For recurring jobs there are cloud scheduled tasks, desktop scheduled tasks, GitHub Actions and the /loop command.
Real-world use case (illustrative scenario)
This scenario is an invented example to show how the ideas fit together. It is not a case study and its details are not measured results.
A solo developer runs a Laravel shop and wants coupon codes before a sale. They spend twenty minutes in the interview step, because Claude's questions expose two decisions they hadn't made (stacking and expiry). The plan flags that totals are calculated in two places, which they didn't know. The build takes one session. The reviewer subagent finds that an expired coupon has no test. They fix it, open the pull request and run /clear. The next morning they use --worktree to fix an unrelated bug while the coupon PR waits for a human review. What saved time was the order of steps, not any single clever prompt.
Mistakes to avoid
- Jumping straight to "build it" without exploring or specifying.
- Skipping plan mode for multi-file changes.
- Letting the session that wrote the code review it.
- Accepting "done" without evidence.
- Running unattended with no cap, no check and no reviewer.
- One long session across unrelated tasks.
Security notes
Keep permissions tight while the work is automated. Don't run bypassPermissions outside a container. Treat scripts that pipe untrusted input (logs, issue text, web pages) into claude -p as injection risks: the model reads that text, and it can contain instructions. Have a person approve anything you can't take back, such as a merge, a deploy or a migration against a real database.
Cost and speed
Planning and a written spec cost a few requests and often save many corrective ones. Parallel worktree sessions and subagents finish sooner but use more total tokens. Clear between tasks, and check /usage to see where the spend goes.
Key takeaways
- A reliable loop: explore, specify, plan, implement against a check, enforce with hooks, review with fresh eyes, commit.
- Plan mode (
--permission-mode plan or Shift+Tab) lets you review before anything is edited.
- Specific prompts, a failing test first and evidence of passing save the most time.
- Worktrees give isolated parallel sessions;
-p pipes make Claude scriptable; unattended runs need a done-condition, a check, limits, a cap and a sign-off.
Lesson recap: the reliable loop from first question to commit.
Quick quiz
- Why start a fresh session after writing
SPEC.md?
- How do you start Claude in plan mode?
- Why is a reviewer in a new context better than asking the same session to review?
- What does
claude --worktree feature-auth do?
- Name two of the five questions to answer before an unattended run.
Answers and explanations
- The build starts with clean context and a written definition of done, and the spec can be used to review the result.
claude --permission-mode plan, or press Shift+Tab in a session until the status bar shows plan mode.
- It hasn't seen your reasoning or the implementation discussion, so it judges the result without being swayed by it.
- It starts a session in a new git worktree: a separate checkout on its own branch, so parallel edits don't collide.
- Any two of: does it know what done looks like, can it check its own work, what may it touch, what stops it, and who signs off.
Official references and further reading
Related tutorials