← All cheatsheets

AI prompts

AI agent prompts — patterns for tool-using LLMs

Six prompt patterns specifically for AI agents that call tools (functions, MCP servers, web search, code interpreters).

## 1. Tool-discovery + plan
```
Here is the task: <task>
Here are the tools you have: <tool list>
Before calling any tool, write a one-line plan: which tools you will call,
in what order, and what you'll do with the results. Then proceed.
```

## 2. Stop-and-ask gate
```
If at any point you would need to call a tool that mutates state (delete,
update, send, payment), STOP and tell me what you propose to do, with
parameters. Wait for confirmation. Do not proceed without it.
```

## 3. Budget cap
```
Maximum 5 tool calls for this task. If you cannot complete it in 5,
return a partial result + what you'd do next.
```

## 4. Verify-after-write
```
Every time you write or modify a file, read it back and confirm the
change landed. If it didn't, surface that and stop.
```

## 5. Cite-your-source for retrieval agents
```
For each factual claim in your answer, cite which retrieved chunk (by
index) supports it. If a claim is not supported by retrieved chunks,
mark it [INFERRED].
```

## 6. Idempotent runs
```
Before doing X, check whether X has already been done. If yes, report
the existing state instead of doing it again.
```

## 7. Loop guard
```
If you find yourself calling the same tool with the same arguments
twice in this session, stop and explain what you're trying to do
differently.
```

## 8. Hand-off summary
```
At the end of the task, produce a 3-bullet summary suitable for the
human to paste into their notes: what was done, what was not done,
what to verify.
```