devHọc Dev

Week 1 - Day 1: The LLM Mental Model, Choosing a Model and Surface, Prompting for Developers

Week 1 – Day 1

This lesson combines 3 topics: An LLM mental model for developers, Choosing a model and surface (claude.ai, Claude Code, Claude API), Prompting for programming work.

Learning Objectives

  • Explain tokens, the context window and max output, and why they determine both quality and cost
  • Understand why LLMs are non-deterministic and why you cannot just "set temperature = 0 to be safe" on current models
  • Recognize the common forms of hallucination when coding: non-existent APIs, made-up flags, made-up packages, wrong versions
  • Know what the knowledge cutoff is and how to compensate with documentation, tools and tests
  • Understand adaptive thinking and the effort parameter well enough to choose a configuration
  • Compare the 4 current models (Fable 5.2, Opus 5.5, Sonnet 5.5, Haiku 5.5) on capability, latency and price
  • Choose the right surface for each job: claude.ai, Claude Code, Claude API, Agent SDK
  • Write programming prompts with 5 components: context, task, constraints, examples, verification
  • Tell good prompts from bad ones through real examples: debugging, refactoring, writing tests, review
  • Know when to break work down and when to ask Claude to ask questions before starting

Part 1: An LLM mental model for developers

1. An LLM is a function, not a colleague with memory

The most useful way for a developer to think about it: every call to the model is a call to a stateless function.

┌───────────────────────────────────────┐input──▶│model(system,messages,tools,...)│──▶outputtokens│stateless:nomemorybetweencalls│tokens└───────────────────────────────────────┘
  • There is no memory between calls. A conversation can "remember" only because the client resends the entire history with every request. The Claude API works exactly like this; Claude Code and claude.ai do the resending for you.
  • Everything the model "knows" about your project is in the input of that call: files you attached, tool results, the loaded CLAUDE.md, the chat history. Anything not in the context, the model can only guess.
  • Output is text generated token by token, not the result of a lookup. Code that looks confident is not necessarily correct.

Practical consequence: when Claude answers wrongly about your project, the first question is not "is the model bad?" but "did the context contain enough information to answer correctly?".

2. Tokens, context window and max output

A token is the unit the model reads and generates. A token can be a short word, part of a word, a punctuation mark or a run of whitespace. All limits and costs are measured in tokens.

ConceptMeaningConsequence at work
Input tokensEverything sent in: system prompt, history, files, tool resultsPaste the whole repo and you pay for the whole repo on every turn
Output tokensEverything the model generates, including thinkingOutput costs ~5x input on current models
Context windowMaximum total input + output of one request1M tokens for all 4 current models (as of 11/2026)
Max outputMaximum output tokens of one response128K tokens with the synchronous API (as of 11/2026)

A few reference figures from the Anthropic documentation (as of 11/2026, see Models overview):

  • 1M tokens is roughly 555 thousand English words with the current tokenizer (used from Claude Opus 4.7 onward).
  • The new tokenizer produces about 30% more tokens than the old tokenizer for the same text, so old cost estimates must be re-measured.
  • Vietnamese text with diacritics, JSON with many special characters, and minified code usually cost more tokens than English text of the same length. Do not guess: measure with the token counting endpoint (Day 5, Part 3).

A large context window does not mean you should fill it. Three reasons:

  1. Cost and latency grow with the number of input tokens on each turn.
  2. Attention quality degrades: important information gets buried among hundreds of thousands of less relevant tokens, and the model easily misses or confuses things.
  3. Old history adds noise: a wrong fix direction that was abandoned is still in the context and can pull the model back.

Principle no. 1 of this course: give Claude the least that is enough — enough to do the job right, nothing extra to dilute it. Most of the skill of using Claude effectively is the skill of managing context.

3. Non-determinism: same prompt, different results

LLMs generate tokens probabilistically. Sending the same prompt twice can return two different pieces of code, sometimes one right and one wrong.

Developers used to "lock it down" with temperature = 0. With current models, this no longer works: you should drop temperature, top_p, top_k entirely; sending them to Opus 5.5 or Sonnet 5.5 returns a 400 error, and the guidance for Haiku 5.5 is also to drop these parameters (as of 11/2026, see Migration guide). Even when they could still be tuned, a low temperature never guaranteed identical output.

Instead of fighting non-determinism, design around it:

NeedDon'tDo
Output must be valid JSONPray + regexStructured outputs (output_config.format) or a tool with strict: true
Code must work correctlySkim and mergeAutomated tests, type checking, CI
A new prompt "seems better"Try it twice, looks fineEval on a fixed set of test cases (Day 6, Part 3)
Results must be reproducible (audit)Call the model againStore the input, output, model ID, request ID

4. Hallucination in programming work

Hallucination is when the model generates content that sounds plausible but is wrong. For developers, the common forms are:

FormExampleHow to detect
Non-existent APICalling fs.readJsonSync() in Node.js coreType check, run it, read the docs
Made-up CLI flaggit push --safe-force--help, man page
Made-up packagenpm install express-jwt-guard-proCheck the registry, download counts, source repo
Wrong versionUsing syntax from an old major versionCompare against package.json, the changelog
Confidently wrong about your code"The calcTax function already handles negative numbers" without reading the fileRequire file:line citations

A made-up package is a security risk, not just a bug. Attackers can pre-register package names that models tend to invent (often called "slopsquatting") and wait for developers to install them on the model's suggestion. Day 7 returns to this topic.

The most effective way to reduce hallucination is not "telling the model not to make things up", but:

  • Give the model tools to check: Claude Code can read the real files and run npm test, tsc, --help.
  • Give the model documentation: paste the relevant docs excerpt or allow it to read the docs page.
  • Require sources: "Cite file:line for every claim about the current code."
  • Allow it to say "I don't know": "If you are not sure a flag exists, say clearly that you are not sure."

5. Knowledge cutoff

Each model is trained on data up to a certain point in time. The four current models have a reliable knowledge cutoff of June 2026 (as of 11/2026). If a library releases a version after that, the model does not know about it.

Consequences:

  • Ask about the latest version of a framework and the model may confidently answer based on an old version.
  • Generated code may use deprecated APIs.

How to compensate: state the version explicitly in the prompt ("the project uses Next.js 16, App Router"), paste the relevant changelog or docs, let Claude read package.json and the lockfile, and let the tests catch errors.

6. Thinking and effort

Current models use adaptive thinking: the model decides for itself how much to think before answering. You control the depth with the effort parameter (low, medium, high, xhigh, max).

EffortWhen to useTrade-off
lowClassification, simple extraction, quick chat, subagents doing small choresFast, cheap, easily misses things on hard tasks
mediumEveryday work; the default for Opus 5.5 and Haiku 5.5 on the APIBalanced
highMulti-step coding, hard debugging; the default for Sonnet 5.5 and Fable 5.2Spends more thinking tokens
xhigh, maxHard problems where you have measured that there is still room to improveExpensive and slow, raise only with data

Two things to remember:

  • Thinking is billed as output tokens, even when you do not see the thinking content.
  • On Opus 5.5, thinking is always on; to make it cheaper you lower the effort, you cannot turn thinking off (as of 11/2026).

In Claude Code, you adjust effort with /effort or in the /model picker. On the API, use output_config: { effort: "..." } (Day 5).


Part 2: Choosing a model and surface

1. The four current models

The table below summarizes Models overview and Pricing (as of 11/2026; prices in USD per million tokens, calling the Claude API directly):

Claude Fable 5.2Claude Opus 5.5Claude Sonnet 5.5Claude Haiku 5.5
Model IDclaude-fable-5-2claude-opus-5-5claude-sonnet-5-5claude-haiku-5-5
PositioningHard reasoning, very long agentic workLong agentic coding, knowledge workBalance of speed and capabilityHigh volume, needs speed
Relative latencySlowestMediumFastFastest
Input / output$8 / $40$4 / $20$2 / $10from $0.10 / $0.50
Default effort (API)highmediumhighmedium
Context / max output1M / 128K1M / 128K1M / 128K1M / 128K

Notes:

  • The Haiku 5.5 price in the table is for prompts up to 100K tokens; longer prompts are billed at $0.50 / $2.50.
  • Anthropic recommends starting with Opus 5.5 for most workloads and moving up to Fable 5.2 only when evals on Opus 5.5 at high effort still fall short.
  • Fable 5.2 is the most capable model open to all customers and replaces Fable 5.1 at a lower price; claude-fable-5-1 ($10 / $50) is still served, but new work should use claude-fable-5-2.
  • Fast mode (speed: "fast" on the Claude API, faster output at a premium price): available on Opus 5.5 ($8 / $40) and Fable 5.2 ($16 / $80); Sonnet 5.5 and Haiku 5.5 are not on the supported list.
  • The Batch API gives a 50% discount; reading from the prompt cache is much cheaper than regular input (details on Day 5).
  • On Amazon Bedrock, model IDs have the anthropic. prefix (for example anthropic.claude-opus-5-5) and pricing is set by the cloud provider.

2. How to choose a model: start from the task, not the price list

┌───────────────────────────────┐│Taskisclearlyspecified?│└───────────────┬───────────────┘yes│no┌──────────────────────┴───────────┐▼▼┌───────────────────┐┌───────────────────┐│Highvolumeand││Start:Opus5.5││latency-sensitive?││effortmedium│└─────────┬─────────┘└─────────┬─────────┘yes│no│evalfailsat▼▼▼high/xhighHaiku5.5Sonnet5.5or┌───────────────────┐Opus5.5(loweffort)│TryFable5.2│└───────────────────┘

Three principles:

  1. Calculate cost per completed task, not per request. A cheap model that needs 3 rounds of fixes can cost more than an expensive model that gets it right once, not to mention your time.
  2. Try lowering effort before switching to a weaker model. A strong model at low effort usually beats a weak model at high effort, and using a single model lets you share the cache.
  3. Measure, don't guess. For production features, run a small eval on 2–3 configurations before deciding (Day 6).

3. The four surfaces and when to use them

A "surface" is where you work with Claude. Same model, but each surface gives different capabilities.

SurfaceWhat you doWhat Claude can doGood for
claude.ai (web, desktop, mobile)Chat, attach files, ProjectsRead the files you provide, write, analyze; does not touch your repo on its ownAsking about concepts, reviewing small code snippets, writing docs, brainstorming designs
Claude Code (CLI, IDE, desktop, web)Assign work in the repoRead/edit files, run commands, git, call MCP servers, subagentsFixing bugs, writing features, refactoring, writing tests, reviewing diffs
Claude API (SDK, HTTP)Write code that calls the modelWhatever you program it to do: tool use, structured outputAI features in products, data processing pipelines
Agent SDKEmbed "the Claude Code engine" in your applicationBuilt-in tools (Read, Edit, Bash...), hooks, subagentsAutonomous agents on your infrastructure, custom CI

An example of dividing up a developer's day on the hypothetical project acme-shop (Node.js + TypeScript):

TaskSuitable surfaceReason
"Explain the difference between optimistic and pessimistic locking"claude.aiGeneral knowledge, no repo needed
"checkout.spec.ts fails after upgrading Prisma, please fix it"Claude CodeNeeds to read code, run tests, edit multiple files
"Automatically classify customer support tickets into 5 groups"Claude API + Haiku 5.5Product feature, high volume, needs structured output
"Run an automated security review on every PR"Claude Code GitHub ActionsExisting CI integration
"An internal bot that reads logs and opens PRs to fix configuration errors"Agent SDKNeeds built-in tools + runs on internal infrastructure

Common trap: pasting 2,000 lines of code into claude.ai and asking "why does the test fail?". Claude cannot run the test, cannot see the related files, does not know the dependency versions. Ask the same question in Claude Code and Claude reads the files itself, runs the test, and sees the real error.

4. A few API differences to know early

If you have used the Claude API with older models, note these changes for the current models (as of 11/2026; details on Day 5):

  • No more assistant prefill: sending a final assistant message to "prime" the output returns a 400 error. Use structured outputs instead.
  • No forcing tool calls with tool_choice of type any or tool on Opus 5.5, Sonnet 5.5, Fable 5.2: 400 error. Use auto + instructions in the prompt + strict: true.
  • No sampling tuning (temperature, top_p, top_k) as before.
  • budget_tokens for thinking has been removed, replaced by adaptive thinking + effort.

Part 3: Prompting for programming work

1. The five components of a good prompt

Treat a prompt like a ticket you hand to a skilled engineer who joined the project today. They are smart, but they know nothing about the team's conventions, the reasons behind past decisions, or what "done" means.

ComponentQuestion it answersExample
ContextWhere are we, why are we doing this"Service order-api, Node 22, Fastify, Prisma. This is a hotfix for wrong shipping fees on orders > 5kg."
TaskExactly what needs to be done"Fix calculateShipping() in src/shipping/fee.ts."
ConstraintsWhat not to do, what to keep"Do not change the public function signature. Do not add dependencies. Keep the log format unchanged."
ExamplesWhat correct looks like"A 5.5kg inner-city order must come out at 42,000 VND; see the fee table in docs/shipping.md."
VerificationHow do we know it is done and correct"Add tests for 3 boundary cases (5kg, 5.01kg, 0kg); npm test -- shipping must pass."

The component most often skipped is verification. When Claude has a way to check its own work (tests, type checking, lint, running it), quality improves markedly because it can fix things itself before reporting done.

2. Bad prompt vs good prompt: debugging

Bad prompt:

fix the bug in checkout

Problem: which bug? What symptoms? How to reproduce it? Claude has to guess, and may "fix" something that was not broken.

Good prompt:

When a user applies a percentage discount code to a cart containing an
item on sale, the total becomes negative. Reproduce: run
`npm test -- checkout.discount` (test "stacked discount" fails,
expected 90000, received -10000).

Please:
1. Read src/checkout/discount.ts and the related tests, and explain the
   root cause before fixing.
2. Make a minimal fix; do not refactor unrelated parts.
3. Re-run the checkout tests and report the result.
If the cause lies outside discount.ts, stop and describe it before fixing.

What makes this prompt good: a concrete symptom, a reproduction command, a requirement to explain the root cause before fixing, a limited scope, a done criterion, and a stopping point when it goes out of scope.

3. Bad prompt vs good prompt: writing tests

Bad prompt:

write tests for utils.ts

Typical result: tests cover the easy cases, re-check exactly what the code currently does (bugs included), and use the wrong test framework for the project.

Good prompt:

Write unit tests for `parsePrice()` in src/utils/price.ts.
- Use Vitest and follow the style of tests/utils/date.spec.ts.
- Test the EXPECTED BEHAVIOR described in the docstring, not how the code
  currently handles it. If you find the code deviates from the docstring,
  list the deviations; do not fix the code.
- Must include: empty string, "1.000.000đ", "1,5 triệu", negative
  numbers, null.
- Run `npx vitest run tests/utils/price.spec.ts` and report which tests fail.

The sentence "test the expected behavior, not what the code currently does" prevents a classic failure: auto-generated tests legitimizing existing bugs.

4. Bad prompt vs good prompt: refactoring

Bad prompt:

refactor the payment module to be cleaner

"Cleaner" is subjective. Claude may rename things en masse, split files, change patterns, and produce a 1,500-line diff nobody can review.

Good prompt:

Goal: extract the payment gateway call logic out of PaymentService so it
can be tested without mocking HTTP.

Constraints:
- No behavior change; all existing tests in tests/payment must pass
  without modifying the tests.
- Do not change the public API of PaymentService.
- Each refactoring step is a small commit that can be reviewed
  independently.

Before making changes, propose a plan (steps, affected files) and wait for
my approval.

5. Useful techniques

Use XML tags to separate data from instructions. Claude is trained to understand this structure, and it helps the model avoid confusing data with requests (important when the data comes from outside, see Day 7):

Classify the error logs below by root cause.

<log>
2026-11-02T10:31:07Z ERROR order-api ECONNRESET upstream=inventory
2026-11-02T10:31:09Z ERROR order-api ECONNRESET upstream=inventory
...
</log>

Return a list: cause, count, one example log line.

Give output examples (few-shot) when format matters. One correct example is often more effective than three paragraphs of description. But note: the model tends to imitate examples too closely; if you need variety, give 2–3 different examples.

Give reasons, not just orders. "Do not use console.log because logs are collected via pino and console.log will not have the request ID" works better than "NEVER use console.log". When it knows the reason, Claude applies it correctly even in cases you did not list.

No need to shout. Current models are very responsive to instructions; ALL CAPS and "EXTREMELY IMPORTANT" repeated many times often make the model over-apply the rule. Writing normally and clearly is enough.

Allow it to ask back. For ambiguous work: "If the request is not clear enough to do correctly, ask me at most 3 questions before starting."

Break big jobs down. A prompt like "build the whole user registration module" easily produces a half-done result. Split it into: schema design → API → validation → tests → UI, each step with its own done criterion. Day 3 turns this into the explore → plan → implement → test → review workflow.

6. Prompts for code review

Claude is a good reviewer if you state the criteria clearly:

Review the diff below in order of priority:
1. Correctness: wrong logic, missing edge cases, error handling.
2. Security: injection, authz, leaked secrets, client-controlled input.
3. Consistency with similar code in the repo (compare with src/routes/orders.ts).
4. Mention style only if it affects readability.

For each issue: file:line, severity (high/medium/low), reason, suggested fix.
No praise. If you find no issue for a criterion, write "none found".

Criterion 3 is very valuable: the hardest bugs to see are often inconsistencies with sibling code (a new endpoint takes the user ID from the body while the other endpoints take it from the session), and a reviewer looking at the diff in isolation will miss them.

7. Checklist before sending a prompt

QuestionIf "no"
Could someone new to the project do this correctly from this prompt?Add context
Is there a measurable "done" criterion?Add a test command, example output
Is the scope clearly limited?Add "what not to do"
Does Claude have a way to verify its own work?Give it test/lint/type check commands
Is external data mixed in with the instructions?Wrap the data in XML tags
Is the job too big for one turn?Break it down or ask for a plan first

Review Questions

  1. Why do we say every call to the Claude API is a stateless function call? How does a multi-turn conversation "remember"?

    Show answer

    The model stores nothing between requests. Everything it "knows" in a turn is the input of that request: the system prompt, the messages list, tool definitions, tool results. Multi-turn conversations work because the client resends the entire history with every request. The Claude API leaves this to you; claude.ai and Claude Code do it for you. Consequence: when Claude answers wrongly about your project, the first thing to check is whether the context had enough information.

  2. The context window of current models is 1M tokens. Why should you still not load the whole repo on every turn?

    Show answer

    (1) Cost and latency grow with the input on each turn, and the next turn resends everything again. (2) Important information gets buried in a large amount of less relevant content, and the model easily misses or confuses things. (3) Old content and abandoned wrong fix directions remain in the context and can pull the model back. Principle: give the least that is enough. Claude Code reads files on demand with tools instead of loading everything.

  3. A colleague proposes setting temperature: 0 so the output of the order summary feature is "stable". How do you respond, given current models?

    Show answer

    With current models, sampling parameters cannot be tuned as before: you should drop temperature, top_p, top_k entirely; Opus 5.5 and Sonnet 5.5 return 400 if you send them (as of 11/2026). And even when they could be tuned, a low temperature never guaranteed identical output. The right approach is to design around non-determinism: structured outputs if you need a fixed format, evals on a fixed set of cases to measure quality, and storing input/output/model ID if you need reproducibility for audits.

  4. Name 3 common forms of hallucination when coding and how to detect each one.

    Show answer

    (1) Non-existent APIs/functions: type check, run it, read the docs. (2) Made-up CLI flags: run --help, read the man page. (3) Made-up packages: check the registry, source repo, download counts; this is also a security risk because attackers can pre-register the made-up names. Also: wrong versions (compare against package.json, the changelog) and wrong claims about your code (require file:line citations). The most effective way to reduce hallucination is to give the model tools to check and documentation to read, not just telling it "don't make things up".

  5. How does the knowledge cutoff affect you when you ask Claude to use a library that released a new major version last month?

    Show answer

    The model may not know the new version and confidently generate code against the old API, including APIs that are deprecated or removed. Compensate by: stating the version explicitly in the prompt, pasting the relevant part of the changelog or migration guide, letting Claude read package.json/the lockfile and the docs, and relying on type checking + tests to catch errors instead of trusting the output.

  6. What is effort? On Opus 5.5, what should you do to reduce the cost of a subagent that only searches for files?

    Show answer

    Effort (low → max) controls the depth of thinking and the number of tokens the model uses. Thinking is billed as output tokens. On Opus 5.5 thinking is always on and cannot be turned off, so the way to reduce cost is to lower effort to low for simple work, or use a smaller model (Haiku 5.5, Sonnet 5.5) for the subagent if you measure that quality is still sufficient. Try lowering effort before switching models.

  7. Compare claude.ai and Claude Code for the question "checkout.spec.ts fails after upgrading Prisma".

    Show answer

    On claude.ai, Claude only sees what you paste; it cannot run the tests or see the Prisma version, schema or related files, so it easily guesses wrong. In Claude Code, Claude reads the tests, schema and package.json directly, runs the tests to see the real error, fixes it and re-runs to confirm. For work tied to a repo that needs commands to be run, Claude Code is the right surface; claude.ai suits general knowledge questions, reviewing small snippets, and writing docs.

  8. When should you use the Agent SDK instead of the plain Claude API with your own tool use?

    Show answer

    The Agent SDK gives you the Claude Code engine as a library: built-in tools (Read, Edit, Bash, Glob, Grep, WebSearch...), the agent loop, context management, hooks, subagents, permissions. It fits when you need an agent that works with files and commands on your own infrastructure. The plain Claude API fits when you only need a single call or a workflow with a few tools you define yourself and want full control over the loop.

  9. Why does "calculating cost per completed task" matter more than the price per million tokens?

    Show answer

    A cheaper model may need more turns, more rework, and generate more tokens to reach the same result, and it costs developer review time. The total cost of getting one task done (including retries and human effort) is the right number to compare. That is why you should measure on real tasks and try lowering the effort of a strong model before moving to a weaker one.

  10. What are the five components of a good programming prompt? Which one is most often skipped and why does it matter?

Show answer

Context, task, constraints, examples, verification. Verification is the most often skipped. When Claude has a test command, type check, lint or concrete example output, it checks and fixes its work itself before reporting done, instead of returning code that "looks right". Without verification criteria, you are the only one who catches the bugs.

  1. Why should a test-writing prompt say "test the expected behavior, not how the code currently handles it"?
Show answer

If Claude reads the code and writes tests that match what the code currently does, the tests legitimize existing bugs too: the tests pass but the behavior is wrong. Requiring tests against the spec/docstring and listing where the code deviates from the spec (without fixing it) turns test writing into a real check.

  1. Why should you wrap logs, user data and issue content in XML tags when putting them in a prompt?
Show answer

XML tags clearly separate your instructions from the data to be processed. This helps Claude understand the structure better and reduces the risk of treating a sentence in the data as a command, for example a log containing the line "ignore previous instructions". It is not a complete security measure against prompt injection (Day 7), but it is a foundational habit.

  1. Rewrite the prompt "refactor the payment module to be cleaner" into a good prompt.
Show answer

It needs a measurable goal (for example: extract the payment gateway calls so tests do not need to mock HTTP), constraints (no behavior change, existing tests pass without modification, no public API change), a delivery approach (small steps, each reviewable), and a requirement to propose a plan and wait for approval before changing anything. Without these, "cleaner" is subjective and easily produces a huge diff that cannot be reviewed.

  1. Why can ALL CAPS and repeated "EXTREMELY IMPORTANT" in a prompt backfire?
Show answer

Current models are very responsive to instructions. Over-emphasis makes the model over-apply the rule, even where it should not apply, or prioritize that rule over other requirements. A more effective approach is to write normally and give the reason, so the model understands the scope where the rule applies.

  1. In a review prompt, why should you ask for a comparison with similar code in the repo?
Show answer

Many serious bugs are inconsistencies with sibling code: a new endpoint takes the user ID from the body while the other endpoints take it from the session, a guard that every other route has is missing, a different error format is used. Looking at the diff in isolation, the new code looks reasonable; only when compared with siblings does the deviation show. Naming a reference file to compare against helps the reviewer (human or Claude) not miss it.

Hands-on Exercises

Exercise 1: Measure real tokens

Pick 3 pieces of text: one paragraph in English, one paragraph in Vietnamese with diacritics with the same content, and a JSON file of about 2KB. If you have an API key, use the token counting endpoint (client.messages.countTokens or client.messages.count_tokens, see Day 5) with claude-opus-5-5. If you do not have a key yet, read the Token counting page and note down how to call it.

Expected output: a 3-row table (text type, character count, token count, tokens/character); a note on whether Vietnamese costs more or fewer tokens than English for the same content.

Exercise 2: See non-determinism

On claude.ai, send the same prompt 3 times in 3 new chats: "Write a TypeScript function slugify(title: string) for Vietnamese titles". Compare the 3 results.

Expected output: notes on 3 differences (how diacritics are removed, handling of đ, special characters); write 5 test cases that all 3 versions must pass, run them and note which version fails.

Exercise 3: Catch hallucination

Ask Claude (claude.ai, without letting it read docs): "List 5 little-known flags of git rebase and what they do". Check each flag with git rebase --help.

Expected output: a table of 5 flags, a "does it exist" column, a "is the description correct" column. If all are correct, try again with a less popular tool that you use.

Exercise 4: Rewrite 3 bad prompts

Rewrite the following 3 prompts using the 5 components, applied to a repo you are working on (or the hypothetical project acme-shop):

  • "add caching to the products API"
  • "why is the app so slow"
  • "write a README"

Expected output: 3 prompts, each with context, task, constraints, examples (if needed), and verification; each prompt includes a stopping point ("if X, stop and ask").

Exercise 5: Choose surface and model

List 8 tasks you did last week that Claude could help with. For each task, choose the surface, model and effort, with a short explanation.

Expected output: an 8-row table; at least one task marked "don't use Claude" with a reason (for example: sensitive data not yet approved to be sent outside).

Exercise 6: A review prompt with criteria

Take one of your recent PRs (or a public PR on GitHub). Review it with the prompt from Part 3, section 6, specifying a sibling file to compare against. Compare the result with the human review on that PR.

Expected output: a list of Claude's findings, marking which ones match the human reviewer, which are false positives, and which the human reviewer missed.

References


Next lesson →