Example prompts
Common tasks and how to phrase them for the agent. The techniques behind them are covered in Best practices and Development workflows. Short prompts are grouped by task type; detailed multi-line examples are in Large requests.
What makes a good prompt
Section titled “What makes a good prompt”You don’t need all four parts every time, but the larger the task, the more of them you need.
| Part | Why | Example |
|---|---|---|
| Location | So the agent doesn’t read half the project | ”in export/stream.py, especially the buffering” |
| Constraints | So the change doesn’t spread | ”no new dependencies, don’t change the public interface” |
| Example to follow | So the result matches what the project already does | ”following pages/settings.tsx” |
| Definition of done | So the agent checks itself | ”after the change, run make test and show the output” |
Getting to know a project
Section titled “Getting to know a project”- “walk me through the project: where an incoming request starts, which layers it passes through, and where it ends. if there is an architecture, sketch a diagram”.
- “explain what
internal/billing/is responsible for, and show who calls it”. - “use a subagent to find out how authorization works in the project, and return a short summary: where the entry point is, what the roles are, where sessions are stored”.
Understanding code
Section titled “Understanding code”- “what does
retryWithBackoffdo, and where is it called from? show the chain up to the external call”. - “if
withRetryis removed, what breaks? check by actual calls, not by name”. - “why is this a blocking call and not a queue? look at the change history of this file and explain how it ended up this way”.
Debugging
Section titled “Debugging”- “the stream cuts off on long responses. first reproduce this with a failing test in
stream/, then fix the cause instead of swallowing the exception”. - “
test_pricing.pywent red after the last commit. find the change that broke it and fix it without touching the test itself”. - “here is the error stack trace [paste]. find the place in the code, explain the condition under which this happens, and propose a fix. don’t change anything yet”.
- “write a failing test for the bug in issue #142: a user without permission sees someone else’s order. show that it is red, then make it green”.
- “cover
orders.gowith tests for canceling a paid order and canceling it twice; no mocks, use a test transaction”. - “check that the tests in
test_auth.pytest behavior, not implementation. rewrite any test that would break on a harmless refactor”.
Refactoring
Section titled “Refactoring”- “in
pages/settings.tsx, the form has validation and is split into sections. repeat this structure for the profile page, don’t change how the existing forms behave, keep the tests green”. - “extract the pagination repeated in three handlers into a shared helper; behavior stays the same, and the tests must pass”.
- “go through the branch’s diff and remove what isn’t needed: interfaces with a single implementation, wrappers with no logic, comments that repeat the code”.
Performance
Section titled “Performance”Say how you measure the result, or the agent optimizes blindly.
- “
make benchprints the build time. it is 94 seconds now. get it down to 60, change only the build configuration, run the benchmark after each change, and show the numbers”. - “the
/v1/reportsendpoint takes 2.4 s on the data fromfixtures/large.json. find where the time goes, show measurements before and after, don’t change the behavior”. - “run a loop of experiments: edit only
src/parser.rs, the metric is the output of./bench.sh, keep a change only if it beats the baseline by more than the noise, and revert the rest”.
This kind of loop is covered in detail in Autoresearch.
External libraries
Section titled “External libraries”- “we need to hook up the payment provider’s webhooks. first pull the current documentation for their SDK, show which version and which methods you will use, and only then write code”.
- “compare two ways to do this: with the built-in scheduler and with a separate queue. for each: what we’ll have to maintain, where it breaks. give the conclusion as one table, no code”.
Interface
Section titled “Interface”- “[screenshot] make the table match this mockup. then open the page in a browser, take a screenshot of the result, list the differences, and fix them”.
- “test the sign-up form in a browser: empty fields, an email address that is too long, a double click on the button. show what happens in each case”.
- “this page has an element that appears on hover and shows a tooltip [screenshot]. make the same one in the header, and take the styles from existing components”.
Bulk edits
Section titled “Bulk edits”Start with two files, then do all of them: it is cheaper to catch a bad prompt that way.
- “twelve handlers in
src/api/return errors in different ways. bring them to the format fromhandlers/orders.go. start with two files, show the diff, and we’ll continue from there”. - “collect the list of files that still use the old logging client and write it to
todo.txt. don’t change anything yet”.
Review
Section titled “Review”- “use a fresh subagent to check this branch’s diff against
SPEC.md: are all items implemented, are edge cases covered by tests, is anyone else’s code affected. only discrepancies, no style nitpicks”. - “go through my last change and find edge cases and race conditions I may have missed; for each, show the line and how to reproduce it”.
- “look at the diff through the eyes of someone who will maintain it a year from now: what will be unclear, where is a name or an explanation of the reason missing”.
Git and PRs
Section titled “Git and PRs”- “make a commit from what is staged, with a message about the substance of the change; then open a PR with
ghand put the checklist fromSPEC.mdin the description”. - “show how this branch differs from
main, and write a PR description: what changed and why”.
Defining the task
Section titled “Defining the task”- “I want to move email sending into a separate service. interview me with the
AskUserQuestiontool about the boundaries, the message format, and what to do with the current templates. skip the obvious. write the outcome toSPEC.md”. - “read
SPEC.mdand tell me what is missing before implementation can start: which decisions haven’t been made, which cases aren’t described”.
Large requests
Section titled “Large requests”A short prompt works while the task fits into one thought. Once there are several (what to do, what not to do, in what order, how to check), write a longer prompt in blocks: context, task, constraints, order of work, definition of done, response format. Such a prompt takes longer to write, but it replaces several follow-up clarifications, and you can reuse it in a new session.
Analyzing a large change before starting:
Context: a billing service, the entry point is in `internal/billing/`, amounts arestored as integer cents, rounded down. Tests run with `make test`, the linter with `make lint`.
Task: add partial refunds for an order. A refund is created for an amount,not for line items. The total of all refunds cannot exceed the amount paid.
Constraints: don't add new dependencies, don't change the public interfacesof `OrderService`, change the DB schema only through a migration.
Order: first read `internal/billing/` and show where payment happens todayand where the operation history is kept. Then propose a plan and stop,I'll review it. We write code after I approve.
Keep in mind: a repeated request with the same ID, a refund on an order thatwas already refunded, a race between two refunds, rounding when dividing.Implementing a spec in a new session:
Read SPEC.md and implement the "Partial refunds" section.
Rules: for each acceptance criterion, a failing test first, then the code.Don't touch files outside `internal/billing/` and `migrations/`. If the specdoesn't cover something, don't fill in the gaps: stop and ask.
Done means: `make test` and `make lint` are green, every acceptance criterionis covered by a test, and you have shown the output of both commands.
At the end, give a list: spec item, the test that checks it.Investigating an incident with attached data:
[paste the stack trace][paste the log excerpt from the minute before]
What we know: the error reproduces on roughly one request in a thousand,it started after Tuesday's release, and only on long responses.
Work step by step: find the place from the stack trace in the code, explainwhat combination of circumstances makes it reachable, check the hypothesisagainst the code and the log, and only then propose a fix. If data is missing,say what you need.
Don't change anything yet.Length alone does not help: a prompt with no constraints and no definition of done stays vague, however many lines it has.
What to avoid
Section titled “What to avoid”| Prompt | What’s wrong with it |
|---|---|
| ”make it look nice” | No criterion; the agent stops at the first plausible version |
| ”study the project” | It reads hundreds of files and fills up the context |
| ”fix the tests” | It may “fix” them by editing the tests themselves |
| ”optimize the code” | Without a metric, optimization turns into a matter of taste |
| ”finish the rest” | The scope is undefined, so the diff is unpredictable |