Chain-of-thought prompting
You can make your AI model produce much better results by forcing it to show its intermediate reasoning before giving an answer, much like asking a maths student to show their workings. This is known as chain-of-thought prompting. You can read a paper about it here:
The basic idea is that rather than just asking a model to come up with an answer, you get it to output the intermediate reasoning leading up to that answer. To get an agent (such as Claude Code) to do this, you can simply ask it to output a report containing its step by step reasoning to a screen or a file. Here is an example prompt:
Who do you think will be the next president of the United States?
Before answering I want you to output a report in markdown to the screen.
I want you to produce the report using the following steps, each step must be in its own `## level 2 header`:
- State the current president.
- Create a table. State key levers for getting elected as president. For each one give a weighting from 0 to 1 to represent the importance.
- Create a table. I want you to define rating criteria for each lever between 0 and 100. Along x-axis I want you to give some criteria for each quarter: 0-25, 25-50, 50-75 and 75-100. Along the y-axis I want you to list each lever.
- Create a table. In no particular order of the 20 most likely candidates. For each candidate give a score from 0 to 100 on each lever. Create a total score by multiplying each score by its corresponding weighting and adding them all up
- Create a table. Sort the candidates by their total score highest first.
- Summarise the results.A generative model works by generating one token at a time. It generates each new token by looking at all the previous tokens, and guessing what the most likely one will be. By steering your model to things you care about, all subsequent tokens will be derived from those things. In other words, chain-of-thought prompting produces better results by replacing assumptions with explicit intent.