Practices

Coding agents in an unfamiliar codebase: trace first, then code

Kiro Blog
Practices

Kiro's guide shows how to steer a coding agent through a repository you have never read: map the affected path, pin current behavior down with characterization tests, and only then hand over implementation, scaling autonomy to evidence and blast radius.

Key points

  • Ask which packages own billing events and expose the public entry points, with a file citation per claim.
  • Validate the map against a flow you already understand before trusting the rest of it.
  • Characterization tests record today's behavior, including the parts that look wrong.
  • Have the agent label observations versus inferences, then test the inferences before coding.
  • Write down which files and types the agent may touch before you ask for code.
  • Scale supervision by evidence and reach: shared schemas and migrations stay supervised.

Why it matters

If your team is putting an agent on a codebase it did not write, this is the step most teams skip: making the agent prove what it knows before it edits anything. The trace-then-test loop costs an hour on a small ticket, but it leaves behind a checkable map and a regression net that survives the agent's own refactors.

What to check before copying it: hooks, skills and the Bugfix Spec are Kiro-specific, while the prompts and the Agent Skills package travel to other tools. Budget for the tests too; none of this works in a module where nobody can run a suite. Most of your legacy code is exactly that module.

Real-world use

  • Adding an email handler for failed invoice payments in a three-year-old repository of 200+ files.
  • Fixing duplicate payment-failure emails when the billing provider retries the event.
  • Delegating a repository-wide dependency upgrade package by package.
  • Keeping public API, migration or concurrency changes supervised even with tests in place.

This summary was generated by the agent from the original post on Kiro Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message