Intro to prompting

Claude is trained to be a helpful, honest, and harmless assistant. It is used to speaking in dialogue, and you can instruct it in regular natural language requests as if you were making requests of a human.

The quality of the instructions you give Claude can have a large effect on the quality of its outputs, especially for complex tasks.

What is a prompt?

A prompt is the text that you give Claude to elicit, or "prompt," a relevant output. A prompt is usually in the form of a question or instructions. For example:

RolePrompt
UserWhy is the sky blue?

The text that Claude responds with is called a "response", sometimes also called an "output" or "completion."

RoleResponse
AssistantThe sky appears blue to us due to how the molecules in the air scatter light from the sun. The shorter wavelength light (blue) scatters more easily than the longer wavelength light (like reds and yellows), so when we look up at the sky, what we see is all the scattered blue light. This is known as Rayleigh scattering. The color of the sky varies based on conditions like the angle of the sun and amount of dust/water in the air, but during the day with a clear sky, the blue wavelength of light is most responsible for the color we perceive.

Claude works by sequence prediction

Claude is a conversational assistant, based on a large language model (LLM). The model uses all the text that you have sent it (your prompt) and all the text it has generated so far to predict the next token that would be most helpful.

This means that Claude constructs its responses one set of characters at a time, in order. It cannot go back and edit its response after it has written it unless you give it a chance to do so in a subsequent prompt.

Claude can also only see (and make predictions on) what is in its context window. It can't remember previous conversations unless you put them in the prompt, and it can't open links.

If you're ready to chat with Claude, visit claude.ai to chat with Claude on the web or check out our quickstart guide to get quickly up and running using the API.

Prompt length

The maximum prompt length that Claude can see is its context window. See our model comparison table for a list of context window sizes per model.


Prompt engineering

For more advanced techniques and tips on creating effective prompts, check out our prompt engineering guide or interactive prompt engineering tutorial. Here, you'll find a wealth of information on how to enhance Claude's performance through careful prompt design, including best practices, common pitfalls to avoid, and real-world examples. We encourage you to experiment with different prompts and techniques to see how they impact Claude's responses and performance.

For code examples with accompanying prompts for various use cases and capabilities, check out the Anthropic cookbook.


Prompt library

Our prompt library features an extensive collection of prompts for various use cases, covering both work and play. It's a great resource to explore when you're looking for ideas or want to understand how to use Claude to solve specific problems. From creative writing to data analysis to character role-play, the prompt library has something for everyone.

Note: The prompt library currently features only prompts without images. Prompts involving images are coming soon.


Metaprompt

We also provide an experimental helper metaprompt that prompts Claude to create a prompt for you, based on guidelines you provide. The metaprompt is experimental, but may be helpful for drafting an initial prompt or quickly creating many prompt variations.

Happy prompting, and don't forget to share your creations in our Discord community!