Here’s what the output looks like: it starts with a large thinking block. It creates a full plan for the article, beginning with foundational topics like basic types, then moving into concepts such as map types, index types, and union types. It reasons about what the user likely knows and doesn’t know, starting from the most basic ideas and progressing to more advanced ones. It also begins with general patterns and then shows specific instances.
We’re using a cheap model here and it’s effectively acting like Matt Pocock. It closes the thinking tag and then begins the article. It takes the table of contents it wrote in the thinking section and turns those items into sections. It also creates on-the-fly code examples to explain each single concept. Overall, it does a really good job, much better than the output in output.md from the problem file.
Looking at the system prompt, the output format says to return two sections:
The crucial part is in the thinking instructions. This not only gets the LLM to output a plan, but also formats that plan in a specific way, so it can then write the article based on that list.
Outputting the plan inside <thinking> XML tags is helpful because we can detect those in the output and render them differently in the frontend. We’re not really getting the LLM to “think”; we’re splitting the work into two tasks: planning the article and then writing the article, within a single LLM call. That’s the power of chain of thought, and it’s very useful for complicated LLM tasks.
<output-format>Return two sections - a <thinking> block and an answer.- The <thinking> block should contain your thought process, and be wrapped in a <thinking> tag.- The answer should be unwrapped.- The answer should be in markdown format, using code blocks for the TypeScript code.</output-format>
<thinking-instructions>Think about your answer first before you respond. Consider the optimal path for the user to understand the code. Consider all of the knowledge dependencies - the pieces of knowledge that rely on other pieces of knowledge. Assume the user knows very little about TypeScript. Create a list of the pieces of knowledge that the user needs to know, in order of dependency.</thinking-instructions>