1. Chain-of-Thought Reasoning
For anything with multiple steps — arithmetic, multi-part logic, "compare these three options and pick one" — asking Claude to work through its reasoning before giving a final answer measurably improves accuracy. It's not a trick; it's giving the model room to build up intermediate conclusions instead of trying to leap straight to the answer.
WITHOUT:
"A store had 120 items, sold 35% on day one and 20% of what remained on
day two. How many are left?"
→ Higher chance of a slip on the two-step percentage math.
WITH:
"A store had 120 items, sold 35% on day one and 20% of what remained on
day two. How many are left? Work through the math step by step before
giving the final number."
→ Claude shows day-one math, recalculates the new base, then day-two
math — each step is easier to get right than jumping straight to the end.
If you need the reasoning separated from the final answer (so your code can grab just the number, say), ask for it explicitly with tags — a direct application of Week 2's structuring technique:
"Work through this step by step inside <thinking> tags, then give only
the final number inside <answer> tags."
"Think step by step" on a task that doesn't need it just adds tokens and latency for no accuracy gain. Reserve it for genuinely multi-step problems — math, multi-constraint decisions, debugging — where there's real reasoning to show.
2. System Prompts & Role Prompting
A system prompt is a separate channel from the back-and-forth conversation — it sets behavior, tone and rules that hold for the entire session, instead of something you'd have to repeat in every message. Role prompting ("You are an expert code reviewer") is one common use of it, but the persona label alone does less work than people expect — Claude doesn't gain new facts by being told it's an expert. The real value comes from pairing a role with concrete rules.
WEAK:
"You are an expert code reviewer."
STRONGER:
"You are a code reviewer for a production Node.js API. For every review:
- Flag any unhandled promise rejection or missing error handling first
- Never suggest a rewrite unless the current code has a real bug
- If you see no issues, say so explicitly rather than inventing nitpicks
- Point to the exact line number for every issue you raise"
The second version doesn't just describe a role, it encodes priorities (error handling first), a constraint (no invented nitpicks), and a format expectation (line numbers) — the actual levers that change what Claude outputs, session after session, without you re-stating them every message.
Right now you're writing system prompts by hand in claude.ai. In the API (Week 6 onward), the system prompt is a distinct parameter you set once in code — this is exactly where CLAUDE.md in Claude Code (Week 10) gets its persistent-context idea from too.
3. Forcing Structured Output
Free-text answers are fine for a human to read, but fragile the moment your own code needs to parse the result. Asking for a specific structure — most often JSON — with an exact schema turns Claude's output into something you can reliably load and use.
"Extract the job title, company, and salary range from this posting.
Respond with ONLY valid JSON, no other text, in exactly this shape:
{
"title": string,
"company": string,
"salary_min": number | null,
"salary_max": number | null
}
If a field isn't present in the posting, use null."
Two details matter here: specifying the exact shape (not "return JSON with the relevant fields") and explicitly saying what to do for missing data (null, not a guess) — both close off the small ambiguities that would otherwise produce output your parser occasionally chokes on.
When you're calling Claude from code (Week 6), you can "prefill" the start of Claude's response with { — Claude then continues from there, which makes it essentially guaranteed to produce JSON rather than a sentence followed by JSON. Worth remembering for later; not available in the plain claude.ai chat interface.
4. Reducing Hallucination
Because Claude is fundamentally predicting plausible text (Week 1), a confident, well-formatted, wrong answer is a real risk — especially on facts outside what was in its training data or outside the material you gave it. A few techniques measurably reduce this.
# 1. Explicitly permit "I don't know"
"If you're not confident in an answer, say so rather than guessing."
# 2. Ground answers in provided material, and say so
"Only use information from the <document> below. If the answer isn't
in it, say it isn't in the document."
# 3. Ask for a quote or citation from the source
"Answer, then quote the exact sentence from the document that supports it."
# 4. Ask Claude to check its own answer
"Before finalizing, double-check this against the document once more."
None of these make hallucination impossible — nothing does — but each one removes a path to a confident wrong answer: permission to say "I don't know" removes the pressure to always produce something, grounding removes reliance on possibly-stale training knowledge, and citation requests make it much harder for Claude to state something ungrounded without that mismatch becoming visible to you immediately.
Grounding answers in provided documents is exactly the instinct behind giving Claude the actual source material (Week 4) instead of asking it to recall facts from memory — the fewer things Claude has to "remember" instead of "read," the less room there is for it to go wrong.
5. Hands-on Exercise
Reasoning, a system prompt, and a JSON extraction — all on real inputs
Three short exercises, one per major technique from this week.
Part 1 — Chain-of-thought on a real decision:
- Pick a multi-factor decision from your own life or work (which of two job offers, which of two vendors, a build-vs-buy call) with at least 3 relevant factors.
- Ask Claude for a recommendation with no reasoning requested, then again asking it to weigh each factor step by step before concluding.
- Compare: did the reasoning version surface a factor or tradeoff the first answer missed?
Part 2 — Write and test a real system prompt:
- Write a system prompt for a persona you'd actually use (a resume reviewer, a Git commit message checker, a recipe simplifier) with at least 3 concrete rules, not just a title.
- Test it against 2-3 different inputs and confirm the rules are actually being followed, not just the persona tone.
In claude.ai, use the "custom instructions" or Project instructions to set something that behaves like a system prompt across a conversation, if there isn't a dedicated system-prompt field in your interface.
Part 3 — Force JSON and validate it:
- Find a real piece of unstructured text (a job posting, a product review, an email) and design a JSON schema for the 3-5 fields you'd want extracted.
- Prompt Claude to extract it as JSON only, with an explicit rule for missing fields.
- Paste the output into a JSON validator (or try to
JSON.parseit) and confirm it's actually valid, not just JSON-shaped.
6. Knowledge Check
Four quick questions. Expand each to check your answer.
Q1
Why does asking Claude to "think step by step" tend to improve accuracy on multi-step problems?
Why does asking Claude to "think step by step" tend to improve accuracy on multi-step problems?
It gives Claude room to build up correct intermediate conclusions instead of jumping directly to a final answer, where each smaller step is individually easier to get right than the whole leap at once.
Q2
Why does "You are an expert X" alone do less than people expect, compared to a role paired with explicit rules?
Why does "You are an expert X" alone do less than people expect, compared to a role paired with explicit rules?
A persona label doesn't give Claude new facts or capabilities it didn't already have. The actual behavior change comes from the concrete priorities, constraints and format rules paired with the persona — the label alone is mostly a tone-setter.
Q3
What two details in a JSON extraction prompt most reduce the chance of unparseable output?
What two details in a JSON extraction prompt most reduce the chance of unparseable output?
Specifying the exact schema (field names and types) rather than a vague description, and stating what to do for missing data (e.g. use null) rather than leaving it ambiguous. Both close off small decisions Claude would otherwise make inconsistently across calls.
Q4
Name two concrete techniques that reduce hallucination, and what each one removes.
Name two concrete techniques that reduce hallucination, and what each one removes.
Explicitly permitting "I don't know" removes the pressure to always produce an answer. Grounding in provided documents (and saying so) removes reliance on possibly-stale training knowledge. Asking for a supporting quote makes an ungrounded claim visibly mismatch its "citation."