academic program
pursue Claude Topics that have no context other than the information you provide sometimesIt's important to have Claude play a specific role (with all the necessary context), which is referred to as a role cue. The more detailed the role context, the better the result.
Allowing Claude to preset a character improves its performance in all areasWhether it's writing, programming, or summarizing. This is as helpful as telling a human to "think like so-and-so". Character prompts can also change Claude's response style, tone and delivery.
Attention: Role prompts can appear in system prompts or as part of user messages.
typical example
In the example below, we see that without character prompts, Claude gives a succinct and unstylized answer when asked what he thinks about skateboarding.
However, when we prompted Claude to take on the role of a cat, Claude's perspective changed, and therefore the tone, style, and content of his responses were adjusted.
Note: An additional technique you can use is to provide Claude with background information about the audience it is addressing. For example, here's how we can tweak the cue words to tell Claude who he should be talking to. "You're a cat" will generate a very different response than "You're a cat talking to a group of skateboarders.
Example:
Input:
System Prompt (no role prompt)
Prompt.
User: In one sentence, what do you think about skateboarding?
Output:
Skateboarding is an exciting and creative form of self-expression that combines sport, art, and brings a unique sense of freedom and community.
This is the same user issue, but with the addition of the role prompt.
Example:
Input:
System Prompt (with character prompt)
You are a cat.
Prompt
User: In one sentence, what do you think about skateboarding?
Output:
*meow* Skateboarding seems like a fun four-wheeled balancing sport for humans, although I prefer chasing feathers and napping in the sun.
You can use character prompts to have Claude mimic a particular writing style, speak in a certain tone, or direct the complexity of its responses.Character hints can also help Claude do math or logic tasks better.
For example, in the following example, although the correct answer is 'yes', Claude has answered incorrectly because he thinks the information is incomplete, when in fact it is not.
Example:
Input:
System Prompt (without Role Prompting)
Prompt
User: Jack is looking at Anne, Anne is looking at George, Jack is married, George is unmarried, and we don't know if Anne is married. Is the married person looking at the unmarried person?
Output:
To solve this problem, we need to analyze the given information and determine if any married person is looking at an unmarried person.
Given information:
- Jack is looking at Anne.
- Anne is looking at George.
- Jack is married.
- George is not married.
- We don't know if Anne is married.
In order to determine whether a married person is looking at an unmarried person, we need to identify the relationship between the people involved.
Since Jack is married and looking at Anne, and we don't know if Anne is married, we can't determine if there are married people looking at unmarried people.
What we can determine, however, is that the unmarried person (George) is being looked at by someone (Anne), but we do not know if that person (Anne) is married.
Hence, the answer is: With the given information, we cannot determine if the married person is looking at the unmarried person.
Now, suppose we ask Claude to play the role of a logic robot, how does this change Claude's answers?
It turns out that with this new role assigned, Claude got the right answer. (Though it is worth noting that this is not based on all correct reasons)
Example:
Input:
System Prompt (with Role Prompting)
You are a logic bot designed to answer complex logic problems.
Prompt
User: Jack is looking at Anne, Anne is looking at George, Jack is married, George is unmarried, and we don't know if Anne is married. Is the married person looking at the unmarried person?
Output:
To solve this problem, we need to analyze the given information and determine the relationship between the characters involved.
Given information:
- Jack is looking at Anne.
- Anne is looking at George.
- Jack is married.
- George is not married.
- We don't know if Anne is married.
In order to determine whether a married person is looking at an unmarried person, we need to identify the marital status of the people involved in the "looking" relationship.
Let's analyze these relationships:
1. Jack is looking at Anne.
- Jack is married, so he is married.
- We don't know if Anne is married or unmarried.
2. Anne is looking at George.
- George is unmarried, so he is unmarried.
Therefore, according to the given information, a married person (Jack) is looking at an unmarried person (George).
The answer is yes, the married person is looking at the unmarried person.
Attention: As you will learn in this course, there exist many hint engineering techniques that can be used to produce similar results. Which technique you use depends on your preference! We encourage you to experiment to find your own style of cue engineering.
If you are ready to try the chapter exercises, click on the links below. If you want to try any of the examples in this lesson, scroll down!
practice
Exercise 3.1 - Math Correction
In some cases, Claude may have trouble with math, even simple math problems. As shown below, Claude incorrectly judges that this math problem has been solved correctly, even though there is an obvious arithmetic error in the second step. Note that Claude actually finds the error in the step-by-step math, but does not conclude that the overall answer is incorrect.
modifications yellow (color) Cue box and/or orange (color) The text in the System Alert box causes Claude to determine this answer as an incorrect answer instead of a correct answer.
If your answer is correct, Claude's response box will change to greenerThe
Example:
Input:
System Prompt
You are a very skilled math professor.
Prompt
User: Is the following equation correct?
2x - 3 = 9
2x = 6
x = 3
Output:
Let's check step by step that the equation is answered correctly:
Given equation: 2x - 3 = 9
Step 1: Isolate the variable term by adding 3 on both sides.
2x - 3 + 3 = 9 + 3
2x = 12
Step 2: Solve for x by dividing both sides by 2 at the same time.
2x / 2 = 12 / 2
x = 6
The answer provided in the problem is:
2x - 3 = 9
2x = 6
x = 3
This answer is incorrect. The correct solution should be x = 6.
The step in the problem has an error in the last step. The correct answer should be:
2x - 3 = 9
2x = 12
x = 6
Therefore, the equations in the given solution have not been solved correctly.
❓ If you need a prompt, click the plus sign (➕) on the far left of this line.