Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • Claude.ai Interface Tour: Every Control You Need on One Screen
  • The AI Fluency Model: Delegation, Description, Discernment and Diligence
  • Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
  • Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
  • What Claude Can Do: Extended Thinking, Web Search, Artifacts and File Analysis
  • Getting More From a Claude Chat: Steer the Conversation Instead of Starting Over
  • Claude Research Mode End to End: From One Prompt to a Cited Briefing
  • Claude's Capability Layer: When to Use Skills, Code Execution or Memory
  • Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
  • Adding and Using Skills in Claude: Let Claude Pick the Skill, Then Teach It Your Format
  • Claude Memory, Curation and Incognito: Keep What Helps, Remove What Has Gone Stale
  • Claude Styles, Preferences and Project Instructions: Three Dials, Three Scopes
  • Claude Projects: Knowledge, Instructions and a Real Workspace You Set Up Once
  • Keeping a Claude Project Current and Connected: Refresh, Prune and Grant the Least
  • Claude Scheduled Tasks: Let Claude Work on a Schedule and Email You the Result
  • Claude Code and Claude for Chrome: What They Are and Who They Are For
  • Anatomy of a Good Prompt: Role, Context, Task, Format and Examples
  • Shaping Claude's Output: Format, Tone and Length in a Few Words
  • Iterating and Refining a Prompt: Read, Diagnose, Adjust, Repeat
  • Five Prompting Patterns for Work: Summarise, Extract, Rewrite, Classify and Draft
  • Why Evaluating AI Output Matters Most: Trust, Then Verify
  • Spotting AI Hallucinations and Fabrications: Four Tells and Where Risk Spikes
  • Fact-Checking Claude's Answers: Four Techniques and a Line-by-Line Claim Log
  • Judging AI Output Quality: Four Questions That Score Any Answer
  • Adapting AI Output for Your Audience: One Answer, Three Readers
  • When a Human Must Review AI Output Before It Ships
  • A Personal Validation Checklist for AI Output: Six Lines, Any Draft
  • Fitting Claude Into Real Work: Where It Helps and Where It Never Should
  • Breaking Big Tasks Into Steps With Claude: Small Asks, Checked Hand-offs
  • Designing a Repeatable Claude Workflow: A Reusable Weekly Report Template
  • Measuring If Claude Is Actually Working: One Number, Before and After
  • Communicating AI Value and Limitations to Stakeholders: The Honest Pitch
  • Data Privacy With Claude: What Never Goes in a Prompt, and How to Redact a Document Before You Paste It
  • Responsible AI Use and Transparency: Helpful, Honest, Harmless, and One Honest Line
  • Troubleshooting a Weak Claude Answer: Name the Cause, Fix One Thing, Then Make It Cheaper
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • Claude Code's Built-in Tools: Read, Write, Edit, Bash, Grep and Glob, and When Each One Is the Right Pick
  • The CLAUDE.md Hierarchy: User, Project and Directory Files, How They Stack, and the Team Rule Stuck on One Laptop
  • Split a 600-Line CLAUDE.md: @import Lines, .claude/rules Files and Which One to Pick
  • Path-Specific Rules in Claude Code: paths Globs, When a Rule Loads and the Glob That Matches Nothing
  • Claude Code Slash Commands and Skills: Project vs User Scope, $ARGUMENTS, context: fork and allowed-tools
  • Iterative Refinement with Claude Code: Input/Output Examples, Tests First and the Interview Pattern
  • Claude Code Sessions: Resume by Name, Fork From a Baseline, or Start Fresh With a Summary Card
  • CI Reviews That Don't Repeat Themselves: Prior Findings, Existing Tests and Test Standards in CLAUDE.md
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  • Validation-Retry Loops for Claude Extraction: Send Back the Exact Errors, and Stop When a Retry Cannot Help
  • Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
  • When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
  • Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
  • Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking
  • Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them
  • Lab: An Extraction Pipeline With a Nullable Schema, Validation-Retry, a 100-Request Batch and Human Review
  • Lab: A Research Pipeline With Parallel Subagents, a Timeout That Keeps Its Partial Results, and a Report With Its Trail
  • Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
  • Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
  • Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
  • Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts
  • Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone
  • Scoped Tools per Agent and tool_choice: Three to Five Tools per Role, a Shared One, and auto, any or a Forced Tool
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts

A three-file pull request is reviewed in four passes: one per file, then one integration pass over the notes. Each file looks fine alone; only pass 4 finds that cart.py sends one argument where price needs two. Then the dynamic plan for a legacy codebase, and how to choose.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Split a pull request review into per-file passes plus one integration pass
  • Explain attention dilution and why one giant prompt misses cross-file bugs
  • Build a dynamic plan for open-ended work: map, prioritise, adapt as dependencies appear
  • Pick a fixed chain or a dynamic plan from the shape of the task

Before you start

  • The Claude Messages API: your first call
  • Workflow or agent: who picks the next step

Your teammate says: please review this pull request. Simple words, big job, and a big job is never one step. The skill is choosing how to cut it into smaller ones.

Here are two big tasks that sound alike. Job A: review a pull request. We know the files and we know the checks, so the plan can be written before we start. Job B: add tests to a legacy codebase. Nobody knows what's in there, which parts matter, or what depends on what, so the plan can't be written first. Same words, "big task", different shape. This article is about picking the cut from that shape.

A related but different question is who picks the steps, your code or the model. That one is covered in workflow or agent. Here the question is how to split the work once you've decided to split it.

A factory line, or a detective

On a factory line, station one cuts, station two paints, station three checks. Same stations, same order, every single time. That's a fixed chain.

A detective works differently. A muddy boot is the first clue, so check the garden. There, a new clue, a ladder, so ask the neighbour. Each next step depends on the last clue. That's a dynamic plan. Known steps use a chain; unknown steps need a plan that adapts.

Prompt chaining: each file alone, then across files

Per-file passes, then an integration pass prices.py cart.py api.py pass 1: note 1 pass 2: note 2 pass 3: note 3 pass 4 all the notes cross-file bug cart sends 1 arg, price needs 2
No single file shows the bug. It appears only when one pass looks at how the files fit together.

Each file gets its own narrow job. Pass 1 looks at prices.py only and writes note 1. Pass 2 does cart.py, pass 3 does api.py. Then pass 4 reads all the notes together and checks how the files fit.

Why split it at all? One giant pass spreads attention thin. The exam guide's word for it is attention dilution: every file competes for the same attention, and detail gets lost.

chain_review.py in 28 lines

The project uses the Anthropic SDK with a stand-in model on a mock transport (stand_in.py), so no API key is needed. With a real key in .env the same chain calls Claude.

from stand_in import make_client
FILES = {
    "prices.py": "def price(item, qty):\n    return item * qty",
    "cart.py": "from prices import price\n"
               "def total(items):\n"
               "    return sum(price(i) for i in items)",
    "api.py": "from cart import total\n"
              "def checkout(items):\n"
              "    return {'total': total(items)}",
}
client = make_client()


def ask(prompt):
    reply = client.messages.create(
        model="claude-sonnet-5-5", max_tokens=300,
        messages=[{"role": "user", "content": prompt}])
    return reply.content[0].text


notes = []
for n, (name, code) in enumerate(FILES.items(), 1):
    note = ask(f"LOCAL REVIEW of {name} only:\n{code}")
    print(f"pass {n} {name}: {note}")
    notes.append(f"{name}: {note}")
text = "\n".join(notes)
summary = ask("INTEGRATION REVIEW of:\n" + text)
print("pass 4 across files:", summary)
  • FILES is the pull request: three small files. Look closely and you can see the bug: price takes item, qty, and cart.py calls price(i).
  • ask() is one call: one prompt in, one text out.
  • The loop makes one narrow pass per file. The prompt says LOCAL REVIEW and carries only that one file.
  • The integration prompt reads the notes, not the whole code.

Four passes, one bug

pass 1 prices.py: test model reply: price(item, qty) looks fine.
pass 2 cart.py: test model reply: price(i) looks fine here.
pass 3 api.py: test model reply: checkout looks fine.
pass 4 across files: test model reply: cart.py sends 1 argument, price needs 2.

Passes 1 to 3: every file looks fine alone, and from inside one file that's true. Pass 4 reads all the notes together, and only now does the cross-file bug show up. The replies come from the stand-in (they start with test model reply), which is scripted to answer this way, so treat this run as a picture of the pattern. With a real model the structure still matters: each local prompt holds only one side of the price call, so no local pass can see the mismatch. The integration pass can catch it because the notes carry the signatures, price(item, qty) and price(i). If the notes drop those details, the integration pass has nothing to compare.

That's a fixed chain: the same steps, in the same order, for every pull request.

Break it: a giant review in one prompt

The tempting shortcut is to hand Claude forty files at once. One prompt, one huge context, and every file competes for the same attention. The lecture shows the kind of reply you get: uneven, small style nits everywhere, and the cart bug, the one that really matters, not mentioned. Detail lost, cross-file bug missed.

The fix is the chain we just built: per-file passes, plus one integration pass. Small focused passes first, then one pass for how the files fit together.

Dynamic decomposition: map first, plan second, adapt

Now job B: add tests to a legacy codebase. You can't write a chain here, because you don't know the steps yet. So the plan is built from what you find.

A plan that changes as you learn 1 map the structure 2 high-impact areas 3 prioritised plan plan v1 1 payments 2 login 3 reports found on the way: payments needs a test DB plan v2 0 set up test DB 1 payments 2 login 3 reports
Each finding can add, reorder or drop a subtask.
  1. Map the structure. Folders, modules, who calls whom.
  2. Find the high-impact areas. The most used code and the most risky code.
  3. Make a prioritised plan. Payments first, then login, then reports.

On the way, you discover that payments needs a test database. So the plan changes: a new step zero, set up the test database, before payments. The plan adapts as dependencies are discovered. There's no project code for this half of the lecture; it's a planning pattern, and the steps are decided at run time by what each step finds.

Choose by the shape of the task

PatternUse it whenThe next step isSignals in a question
Prompt chainingPredictable, multi-aspect reviewKnown before you start"each file", "same checks", "before every release"
Dynamic decompositionOpen-ended investigationDecided by what you find"legacy", "unfamiliar", "explore", "comprehensive"

A scenario like "check every module of a billing service for the same five issues before each release" is predictable: known checks, known modules, so per-module passes plus an integration pass. An open-ended plan would be overkill there, and one prompt with all the code dilutes attention. Choose the pattern from the task, not from habit.

Common mistakes

  • One prompt for the whole pull request. Attention dilution: nits everywhere, the real bug missed.
  • Per-file passes with no integration pass. Every file "looks fine", and the cross-file bug ships.
  • A fixed chain for unknown work. On a legacy codebase you can't list the steps in advance; map first.
  • A plan that never changes. A dynamic plan that ignores what it discovers is just a guessed chain.

Quick recap

Task shapeCutKey step
Known items, known checksFixed chainOne pass per item, then an integration pass
Unknown territoryDynamic planMap, prioritise, adapt as you learn

The project and its stand-in model are in the community, free to join.

Try it yourself

Add a fourth file to FILES, for example a tax.py that prices.py imports, and add a line for it in LOCAL in stand_in.py. Or change cart.py to call price(i, 1) and run it with a real key: does the integration pass still report a problem? Then sketch, on paper, a dynamic plan for adding tests to a project you've never opened.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 121 of 123

Previous
Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
Next post
Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Related posts

The Claude Messages API: Your First Call, Field by Field

One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.

Claude Tool Use: How tool_use and tool_result Work in the Messages API

Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.

Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared

Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.

Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move

Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.

On this page

  • A factory line, or a detective
  • Prompt chaining: each file alone, then across files
  • chain_review.py in 28 lines
  • Four passes, one bug
  • Break it: a giant review in one prompt
  • Dynamic decomposition: map first, plan second, adapt
  • Choose by the shape of the task
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.