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.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

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.