A customer clicks Export. The new service returns the same HTTP 202 as the old one. The test passes. But the worker never receives a job, and the customer keeps waiting for a file that will never arrive.
This is the hard part of a production migration. An AI coding agent can move a lot of code quickly. It needs a way to see what the old service does, including the work that happens after the response. I start with one workflow, give the agent a reusable migration skill, and write down how we will know when that workflow is ready.
Start with One Workflow
“Rewrite the export service” makes for a poor assignment. “A user requests an export and can download the finished file” gives the agent a path to trace and the reviewer an outcome to verify.
Ask the agent to follow the workflow from the entry point to its last observable effect. For an export, the API creates a job, a worker writes a file, and the user checks the job status. Find out what happens if the queue delivers the same message twice or the worker fails after writing the file. Map the dependencies that matter to that behavior.
Then decide what to move. The new service might own the API while the existing worker keeps running behind the same queue. Reusing that boundary can turn a service rewrite into a much smaller change. Record who owns each write during the transition, especially when both versions are live.
Put the Repeated Work in a Skill
A migration skill is a set of instructions the coding agent loads whenever it moves a workflow. Put it in a versioned SKILL.md where the team can review it. Give it a description that says when it applies, and link to the repository's coding rules, test setup, and migration plan. Keep decisions about each workflow in the plan so the skill stays usable on the next one.
Here is a migration skill you can adapt.
- Build the task from current evidence. Read the existing plan, then trace the active entry points and their callers in both implementations. Check each supported client or build that can reach the workflow. Record the source and destination paths, what already works, and the behavior still missing. Treat a disagreement between the plan and the running code as something to investigate.
- Assign each operation to an owner. Identify who handles the request, who writes state, who publishes or consumes events, and who owns startup and configuration. Use the target system's existing clients, queues, and worker setup where they preserve the required behavior. Record any new dependency and the reason it is needed.
- Define the contract before editing. List the public responses, state changes, background work, and failure behavior that callers rely on. Include cases such as duplicate delivery or partial failure where they affect the workflow. Label intentional behavior changes in the task and get a decision on ambiguous ones before implementing them.
- Verify through the normal entry point. Run the same acceptance cases against the old and new service where possible. Start the real handlers and workers through the usual registration and initialization paths. Use controlled infrastructure dependencies to trigger failures, and keep the test assertions on observable outcomes. If a database stub cannot model locking, record that limit and verify the concurrency behavior against the real database before relying on it.
- Finish the workflow through its callers. Check that clients, routes, event readers, configuration, and fixtures agree with the migrated contract. Before removing an old path, search for remaining callers and map its acceptance checks to their replacements. Keep the migration status open while required dependencies or checks are pending.
- Hand off evidence. Report what changed, which checks ran, which were skipped or blocked, and what remains before cutover. An independent reviewer should be able to follow the legacy path and reproduce the important checks from that handoff.
For the export example, the task can be a few lines. The request endpoint already exists. The missing behavior is handing the job to the existing worker and showing the finished file to the caller. The queue contract is a dependency. The acceptance evidence is an export completed through the public API, including a test that redelivers the job. The skill tells the agent how to get that evidence and what to report if it cannot.
Keep repository conventions in their own skill. The migration skill should work whether the target is written in Go, Python, or the same language as the original service. For an example of packaging coding conventions for an agent, see GO Coding Guideline as Agent Skill.
Run the Tests Against the Old Service First
Before asking the agent to implement anything, run the acceptance cases against the legacy service. Use equivalent starting data for each run. Check the response and the downstream effects that callers rely on.
For the export example, a useful test requests an export, waits for completion, and verifies that the file contains the expected rows. A second test redelivers the worker message and checks that there is still one completed export. A third makes storage temporarily unavailable and checks that the user eventually sees the expected result or a clear failure.
Compare fields such as timestamps and generated IDs by their meaning. A new job ID can be valid as long as it identifies the same job throughout the workflow. If the legacy system behaves in a surprising way, record whether you will preserve it or change it deliberately. That decision belongs in the task so a reviewer can tell an intentional change from a regression.
Review the Evidence and Keep the Next Task Small
Give the implementation agent a workflow, the agreed behavior, and the command that runs its tests. Give the reviewer the same task and the legacy entry point. Ask the reviewer which important behavior could still be broken with every test passing. That question often produces a better test than another pass over the diff.
Keep the migration plan in the repository. One row per workflow is usually enough. Include the owner, dependencies, current status, and a link to the checks. Use specific states such as mapped, parity verified, and live. A workflow can pass every acceptance test and still be waiting for a queue or a deployment change.
For more on defining a clear result when delegating to an agent, see How I Get at Least 10x More Work Done with an AI Coding Agent.
Move Traffic When You Can Move It Back
Start with a small cohort and pick the signals that will decide whether to expand it. For the export workflow, watch time to completion, failed jobs, and queue age alongside HTTP errors. A healthy API can still have a stalled worker.
Before raising traffic, check what happens when you route new requests back to the old service. Jobs already queued and records already written still exist. If the old worker cannot read the new job format, agree on how to drain those jobs or keep both versions compatible before switching traffic.
For the deployment mechanics, see Zero-Downtime Kubernetes Deployments.
Final Note
Start with one workflow that has a clear outcome and a dependency you can observe. Write down the behavior, run the checks against the old service, and turn the steps you expect to repeat into a skill. When a review finds a mistake that could recur, add the general rule to the skill. For example, if a workflow was missed because the agent inspected only one client, add a check for every active client. When you hand the next workflow to another agent, it should be able to start from the plan, run the checks, and show you what still needs a decision.



