All Tech Notes

Tech Notes

AI Best Practices Part 4 Plan the change before writing code

Chris Byers

A good AI coding task begins with a conversation about the change you actually need.

If you ask an agent to “improve the invoice page,” it has to fill in a lot of blanks. It might change the layout, add filters, rewrite the data loading, or introduce a new component. Each choice could seem reasonable while moving further from what you had in mind.

Spend a few minutes making the request specific. Discuss the requirements, capture them in a specification, and review an implementation plan. Once the plan is clear, add the verification steps. Then authorize the work.

Use spec-driven development to guide the change

Spec-driven development, or SDD, makes a reviewed specification the reference for planning, implementation, and verification. The specification describes the intended behavior, scope, constraints, and acceptance criteria. The implementation plan explains how the team will deliver it. GitHub’s Spec Kit provides one structured approach to this workflow. Spec Kit methodology.

For the workflow I’m describing here, a short specification saved with the project can be enough. Record the decisions made during the discussion so the agent has a clear reference throughout the task. Make it detailed enough that someone else could understand the required outcome without reconstructing the conversation.

Describe the change in enough detail to make decisions

Give the agent the current behavior, the problem, and the outcome you want. Include the relevant page or workflow, who uses it, and any constraints that affect the solution.

For example, imagine you want to add a status filter to an invoice list. An initial request could look like this:

On the customer’s invoice list, add a status filter with All, Draft, Sent, Paid, and Overdue options. Default to All. Keep the selected filter when moving between pages, and return to the first page when the filter changes. Show a clear empty state when there are no matches. Keep the existing sorting and customer access restrictions. First inspect how filtering and pagination currently work, ask me about any ambiguities, and draft a specification for my review. Once we agree on the specification, propose an implementation plan. Wait for my approval of the plan and verification steps before editing code.

That gives the agent useful boundaries. It also explains that the first stage of the task is investigation and planning.

You don’t need to prescribe every function or database query. Give enough product context for the agent to investigate the implementation and bring the relevant choices back to you.

Discuss the approach before accepting a plan

Ask the agent to read the relevant code and explain how the existing workflow operates. That can expose details your original request didn’t account for.

For the invoice filter, the discussion might reveal that Overdue is calculated from the due date, while the other statuses are stored. Filtering only the records already loaded in the browser could produce an incomplete result. The agent should identify that issue before building the control.

Talk through those decisions. Ask which existing logic can be reused, where the behavior should be implemented, and which assumptions need confirmation. Resolve questions that affect the design before treating the approach as settled.

This is also a useful time to challenge unnecessary work. If a small feature comes with a proposal to replace the entire page, ask what makes that replacement necessary and what behavior it needs to preserve.

Update the specification with the answers and review it before planning implementation. In the invoice example, that means agreeing on how Overdue is determined and whether filtering applies across the full dataset. Those decisions become requirements the plan and verification steps must satisfy.

Review the plan yourself

Have the agent turn the reviewed specification into an implementation plan. It should explain the intended changes, the components or services involved, and the order of the work. For larger changes, break the plan into tasks that can each be traced to a requirement.

Read it against the specification and your original request. Look for missing requirements, unexpected scope, and assumptions that were never agreed upon. Check that it accounts for existing data and the behavior current users rely on.

If something looks wrong, revise the plan before implementation. A plan is valuable when it helps you make those decisions early. Approving it without reading it gives up much of that benefit.

Add verification steps once the approach is clear

The reviewed plan should make it easier to see how the change needs to be verified. Add those checks before asking the agent to start coding, linking each check to the specification’s acceptance criteria.

For the invoice example, the plan might lead to these verification steps:

  1. Create test invoices across the supported statuses, with enough records to span multiple pages.
  2. Confirm each filter returns the expected invoices across the full dataset.
  3. Verify that changing the filter returns to page one and that subsequent pages retain the selection.
  4. Check that the existing sort order still applies within the filtered results.
  5. Exercise the empty state and capture desktop and mobile screenshots.
  6. Confirm that another customer’s invoices remain inaccessible through both the page and direct API requests.

Choose the evidence for each check. Some need a live workflow and inspection of the returned data. Others benefit from code review, a focused automated test, or a screenshot of a particular state.

As discussed in Part 3, you define what “Done” means. The agent can help identify how to demonstrate it. Review the verification steps so they reflect your requirements.

Start implementation with an agreed scope

Once the plan and verification steps are ready, tell the agent to proceed. Ask it to report the outcome of each check and identify anything it couldn’t verify.

If implementation uncovers an issue that materially changes the design or scope, have the agent bring that decision back to you. Agree on any requirement changes, update the specification, and revise the plan and affected checks before continuing.

This preparation gives the agent a clearer task and gives you a concrete basis for reviewing the result. The time spent discussing the change should reduce the amount of guesswork carried into the code.

A first conversation

Let’s find a time.

Leave your contact details and I’ll get in touch to arrange a meeting. Feel free to add a message.

Your contact details and optional message