Asking for changes: context, goal, constraints and acceptance criteria
Course contents (20 lessons)
- Meet Claude Code
- What Claude Code is and how it differs from a chat window
- Installing Claude Code and signing in
- Your first session: explore, ask, change
- Asking well and staying in control
- Asking for changes: context, goal, constraints and acceptance criteria
- Reading and approving edits
- Permission modes: how much freedom to give
- Project memory and slash commands
- CLAUDE.md: teaching the tool about your project
- Slash commands and custom commands
- Everyday coding workflows
- The plan-first workflow
- Understanding unfamiliar code
- Debugging with Claude Code
- Refactoring safely
- Writing tests with Claude Code
- Git, small changes, cost and security
- Git workflows: branches, commits and pull request descriptions
- Keeping changes small and reviewable
- Context and cost awareness
- Security habits: secrets, commands and untrusted input
- Extending the tool, teamwork and a final project
- Hooks and MCP servers explained
- Team practices for AI-assisted coding
- Final project: building a small app step by step
The problem with short requests
"Add pagination" is a perfectly clear sentence to you, because you know the project. To the tool, it is a hundred open questions. Which page? Offset or cursor? What page size? Where does the UI come from? The tool can read your code to answer some of them, but not the ones that live in your head, such as "we may switch to cursor paging next quarter".
The best structure I have found has four parts: context, goal, constraints and acceptance criteria.
The four parts
- Context: where the work happens and what already exists. Name files, modules or the feature area. Mention anything that is not obvious from reading the code.
- Goal: the outcome you want, in terms of behaviour, not code.
- Constraints: what must stay the same or must be used. Libraries, style, compatibility, "do not touch the public API".
- Acceptance criteria: how we will know it is done. Specific tests to pass, behaviours to observe, commands to run.
Weak versus strong
Weak:
Add pagination to the orders list.
Strong:
Context: The orders list is served by GET /api/orders in OrdersController and rendered by the OrdersTable component. It currently returns all rows.
Goal: Add page-based pagination. The API accepts page and pageSize, and the table shows Previous and Next buttons and the current page number.
Constraints: Default pageSize 20, maximum 100 (reject larger values with a 400). Do not change the response shape for existing fields, only add totalCount. Use the existing Button component. No new dependencies.
Acceptance: Add API tests for default size, a custom size, a page past the end (empty list) and an oversized pageSize. Run the full test suite and report the result. Do not change anything outside the orders feature.
Why the strong version works
Every line removes a guess. The tool does not have to decide the paging style, the limit, the UI component or the testing approach. The acceptance criteria give it a way to check itself and give you a way to check it. Notice that the request does not say how to write the code. It describes the result and the boundaries. That is the right split between you and the tool.
It looks long, but it takes two minutes to write and often saves an hour of corrections.
You do not need all four every time
For tiny tasks, one sentence works: "Rename the variable tmp to retryCount in this file and fix all uses." Use the full structure for anything that touches several files or has real risk.
Point at things
You can refer to files by name in your prompt, and in the terminal tool you can usually type @ followed by a path to attach a file reference. The exact way to do this depends on the version, but naming the path in plain text always works.
Follow the pattern used in src/api/customers.ts for validation and error handling. Do the same for the new suppliers endpoint.
Pointing at an existing, good example is one of the strongest things you can do. Tools copy patterns well, and your codebase stays consistent.
Say what you do not want
Tools sometimes do more than asked, such as reformatting a whole file or adding extras. Add a line like "Only change what is needed for this task. Do not reformat unrelated code and do not add new abstractions." This keeps your diff small, and the diff is what you will review.
Ask for questions
Before you change anything, list any questions or assumptions you have about this task. Wait for my answers.
This is useful for unclear tasks. The questions often show a gap in your own thinking, which is worth finding before there is code.
When the request is large
Break it up. "Build the whole reporting module" is too big. Instead: the data model first, then the API, then the UI, with a review after each. Big requests produce big diffs, and big diffs are hard to review honestly.
The common mistake
The common mistake is describing the solution you imagine instead of the problem. "Add a cache in the OrdersService using a dictionary" may block a better answer. Say "the orders page takes four seconds to load; target under one second; keep data fresh within a minute" and let the tool propose the approach. You can still reject its idea.
Try it yourself
Pick a small feature or fix in your project. Write the request twice: one line, then the four-part version. Run the one-line version first, look at the diff, then revert, and run the four-part version. Compare the two diffs on size, correctness and how much you had to correct.
This course is free to read. Create a free account to enrol, save your progress and pick up where you left off.
Sign up free I already have an account