> ## Documentation Index
> Fetch the complete documentation index at: https://docs.potpie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Migration

> Migrate a module to a new pattern with full dependency awareness.

Migrating a module to a new pattern requires knowing every file that needs to change before starting. A change that appears isolated often touches dozens of consumers, interfaces, and tests across layers.

**Build** reads the existing module through the [knowledge graph](/concepts/knowledge-graph), maps every dependent service and interface, and generates a **specification** listing every file to create or modify before a line of code is written.

**Request:**

```
Migrate the payment module from REST to GraphQL
```

**Build maps:**

* Every service that consumes the current module's interface
* Every contract or type definition that needs to change
* Every test that covers the existing behavior

**Code generation includes:**

* Updated module implementing the new pattern
* Adjusted consumers with matching interface changes
* Modified tests reflecting the new contract

The complete change set appears as a **diff** before PR creation. [Create the PR](/build-flow/build-a-feature#what-it-produces) directly from the **diff** view.

Try it yourself on your codebase → [Build a Feature](/tutorials/make-code-changes)
