Real-World Workflows

Practical workflows evolve as tools mature, but several durable patterns consistently help teams deliver large-scale change safely. This chapter presents an end-to-end example, generalises the approach to multiple contexts, and highlights techniques for legacy codebases.

End-to-end walkthrough: language and platform migration (open source)

An open-source example demonstrates a pragmatic path for migrating a small library from Node.js to Swift whilst preserving behaviour:

Step-by-step approach:

  1. Strengthen tests in the source repository to capture intended behaviour for core algorithms and edge cases; contribute improvements upstream where appropriate via pull request.
  2. Scaffold the target project using standard tooling for the destination language/platform (for example, Swift Package Manager).
  3. Extract and document core algorithms and data structures from the source; identify library equivalents in the target ecosystem.
  4. Plan the migration in small chunks (for example, by feature or module). Capture the plan in plan.md to coordinate agentic and manual steps.
  5. Generate tests first in the target language to lock in behaviour; prioritise high-value and high-risk paths.
  6. Implement incrementally using Copilot suggestions, reviewing each change for correctness, performance, and idiomatic style.
  7. Cross-verify behaviour using a small CLI or script that exercises both implementations with identical inputs.
  8. Update documentation and prompt files as patterns stabilise; record lessons learned to improve subsequent chunks.

Patterns that generalise across contexts

Across all contexts, design for reviewability: small changes, clear intent, and fast feedback.

Handling legacy codebases

Legacy systems benefit from systematic discovery and incremental change:

  1. Discovery: Generate lightweight architecture notes (context, containers, key flows) and dependency graphs.
  2. Golden tests: Add characterisation tests around critical paths to preserve behaviour during refactors.
  3. Seams: Identify boundaries (adapters, gateways) to isolate changes; introduce interfaces where missing.
  4. Strangler pattern: Route a small, stable slice through a modernised component while the legacy remains intact.
  5. Data safety: Rehearse migrations with anonymised samples; add verification queries and back-out plans.
  6. Operational readiness: Extend logging, metrics, and tracing before deep changes to aid diagnosis.

Copilot supports these steps by accelerating scaffolds, tests, and repetitive refactors, but human judgement sets boundaries and validates outcomes.

Collaboration practices

Agent-mode considerations

When using agentic workflows:

Validation and metrics

Track outcomes to ensure value and safety:

Key Takeaways