Skip to solution
mediumAI Engineering

What is chain-of-thought prompting and when does it actually help?

481 views
01

Understand the problem

Making the model 'think out loud' — why it works, when it is wasted tokens, and reasoning models.

chain-of-thoughtreasoningprompting
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

Chain-of-thought (CoT) prompting asks the model to reason step by step before answering, which improves accuracy on math, logic and multi-step tasks because each token of reasoning conditions the next. It costs extra tokens and does not help simple lookups or classification. Modern 'reasoning' models internalize this w

Solution ready — 2 min read

Classified // press E to declassify

04

Read the code

Structured reason-then-answer output
const prompt = [
  "Solve the scheduling question below.",
  "First write your reasoning inside <thinking> tags.",
  "Then output ONLY the final schedule as JSON inside <answer> tags.",
  "",
  question,
].join("\n");

const reply = await complete(prompt);
const answer = between(reply, "<answer>", "</answer>"); // parse the fenced part only
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 41 of 80 decoded in the AI Engineering track. One more won't hurt.

Back to track