|
| 1 | +# KX13 Project codebase migration |
| 2 | + |
| 3 | +AI-assistant prompts for migrating the **codebase** of Kentico Xperience 13 projects to [Xperience by Kentico](https://docs.kentico.com/x/migrate_from_kx13_guides). |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +These prompts are designed to help migrate the live site and page presentation logic as described in the following guides: |
| 8 | + |
| 9 | +- [Adjust global code](https://docs.kentico.com/guides/architecture/upgrade-from-kx13/upgrade-walkthrough/adjust-global-code) – Generating code files for content types, copying localization resources, shared views, styles/scripts, and enabling content tree-based routing and Page Builder. |
| 10 | +- [Display an upgraded page](https://docs.kentico.com/guides/architecture/upgrade-from-kx13/upgrade-walkthrough/display-an-upgraded-page) – Content retrieval services, repositories, view models, views, controllers, and Page Builder sections/widgets. |
| 11 | + |
| 12 | +The following areas are not covered and must be handled manually: |
| 13 | + |
| 14 | +- Custom modules |
| 15 | +- Custom tables |
| 16 | +- Authentication and user management |
| 17 | +- Search functionality |
| 18 | +- E-commerce |
| 19 | +- Marketing features |
| 20 | + |
| 21 | +See the [Adjust and adapt your code](https://docs.kentico.com/x/migrate_your_code_guides) migration guide for details. |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +- Kentico Xperience 13 project (source). |
| 26 | +- Xperience by Kentico project (target) connected to a database migrated using the [Kentico Migration Tool](https://github.com/Kentico/xperience-by-kentico-kentico-migration-tool). The prompts were tested on a fresh Xperience by Kentico project created using the `kentico-xperience-mvc` [project template](https://docs.kentico.com/x/DQKQC). |
| 27 | +- AI coding assistant installed (for example: GitHub Copilot, Cursor, Claude Code). |
| 28 | + |
| 29 | +## Usage |
| 30 | + |
| 31 | +### 1. Set up project structure |
| 32 | + |
| 33 | +Place your KX13 and XbyK projects in the same workspace with the following structure: |
| 34 | + |
| 35 | +``` |
| 36 | +KX13/ # Kentico Xperience 13 project files |
| 37 | +XbyK/ # Xperience by Kentico project files |
| 38 | +``` |
| 39 | + |
| 40 | +Start both projects locally. During the migration, the agent actively visits URLs in both projects to evaluate progress. |
| 41 | + |
| 42 | +### 2. Copy the prompts to the workspace |
| 43 | + |
| 44 | +Copy the appropriate files for your AI assistant. Note that the files also add the Xperience by Kentico [Documentation MCP server](https://docs.kentico.com/x/mcp_server_xp) and [Playwright MCP server](https://github.com/microsoft/playwright-mcp) to your workspace. |
| 45 | + |
| 46 | +> **Important:** For Claude Code, you need to add the MCP servers manually via the command line. Follow the [setup instructions](claude-code/MCP_Setup.md). |
| 47 | +
|
| 48 | +### 3. Run the migration prompts |
| 49 | + |
| 50 | +The prompts are divided into three main groups: |
| 51 | + |
| 52 | +#### Global |
| 53 | +- [**migrate-global-code**](#migrate-global-code) – Sets up the target XbyK project structure, generates code files, and migrates shared code (localization, styles, business logic, etc.). |
| 54 | + |
| 55 | +#### Component |
| 56 | +- [**migrate-shared-component**](#migrate-shared-component) – Migrates reusable components (layouts, headers, breadcrumbs, etc.). |
| 57 | + |
| 58 | +#### Page |
| 59 | +- [**migrate-page-widgets**](#migrate-page-widgets) – Migrates Page Builder widgets and sections used by the specified page. |
| 60 | +- [**migrate-page**](#migrate-page-logic) – Migrates the specified page and related business and presentation logic, including controllers, views, and dependencies. |
| 61 | +- [**migrate-page-visual**](#ensure-page-visual-match) – Ensures migrated pages visually match the original KX13 pages. Used in case the page migration prompts result in visual discrepancies. |
| 62 | + |
| 63 | +In a general workflow, you migrate in waves: |
| 64 | + |
| 65 | +1. Global code to seed the target project with initial logic (using the [*migrate-global-code*](#migrate-global-code) prompt). |
| 66 | +2. A single page to establish working URLs in the target project. |
| 67 | + 1. First, migrate the page's Page Builder dependencies using [*migrate-page-widgets*](#migrate-page-widgets). Skip this step for pages that don't use Page Builder. |
| 68 | + 2. Then, migrate the business and presentation logic using [*migrate-page*](#migrate-page-logic). |
| 69 | +3. Shared components to ensure consistent visuals across pages (using the [*migrate-shared-component*](#migrate-shared-component) prompt). Use the URL of the page migrated in step 2 to verify visual accuracy. |
| 70 | +4. Remaining pages, repeating step 2 for each. |
| 71 | + - If any migration results in visual issues, use [*migrate-page-visual*](#ensure-page-visual-match). |
| 72 | + |
| 73 | +## Best practices |
| 74 | + |
| 75 | +- Run prompts in sequence. Each prompt builds on the work done in the previous step. For example, the full sequence to migrate a page is: *migrate-page-widgets* → *migrate-page* → *migrate-page-visual*, repeating as necessary until all pages are converted. You can also omit prompts based on the requirements of the page being converted. If a page doesn't use Page Builder features, you can skip the *migrate-page-widgets* prompt. |
| 76 | +- Have both the source KX13 and target XbyK applications running -- the agent visits both applications to compare migration progress. |
| 77 | +- After running a prompt, review all generated code before proceeding to the next step. |
| 78 | +- Use the visual matching prompt to fix styling discrepancies. |
| 79 | +- Thoroughly test all migrated functionality. |
| 80 | + |
| 81 | +## Prompt reference |
| 82 | + |
| 83 | +### Migrate global code |
| 84 | + |
| 85 | +Prompt name: **migrate-global-code** |
| 86 | + |
| 87 | +Migrates global code, generates code files, and sets up the project foundation. The prompt makes the following changes: |
| 88 | + |
| 89 | +- Creates a new .NET project in the target folder and marks it as [discoverable](https://docs.kentico.com/x/QoXWCQ) by Xperience. |
| 90 | +- Uses the code generator utility to [generate classes](https://docs.kentico.com/x/5IbWCQ) for migrated database entities (content types, etc.). |
| 91 | +- Copies global project files, such as assets and resources, and global code, such as service registration and project startup logic, to the target. |
| 92 | +- Enables [content tree-based routing](https://docs.kentico.com/x/GoXWCQ) and [Page Builder](https://docs.kentico.com/x/6QWiCQ) on the target. |
| 93 | + |
| 94 | +**VS Code GitHub Copilot example:** |
| 95 | + |
| 96 | +``` |
| 97 | +/migrate-global-code |
| 98 | +``` |
| 99 | + |
| 100 | +### Migrate shared component |
| 101 | + |
| 102 | +Prompt name: **migrate-shared-component** |
| 103 | +Parameters: |
| 104 | + - *componentName*: The name of the shared element to migrate. For example: header, footer, navigation menu, sidebar. |
| 105 | + - *legacyPageUrl*: The URL of the page in the source project |
| 106 | + |
| 107 | +Migrates reusable components like headers, footers, and navigation elements. The prompt locates the specified element in the source project and migrates it together with all dependencies (views, layouts, logic, etc.). |
| 108 | + |
| 109 | +**VS Code GitHub Copilot example:** |
| 110 | + |
| 111 | +``` |
| 112 | +/migrate-shared-component |
| 113 | +
|
| 114 | +componentName: breadcrumbs |
| 115 | +legacyPageUrl: https://localhost:5001/en-us/home |
| 116 | +``` |
| 117 | + |
| 118 | +### Migrate page widgets |
| 119 | + |
| 120 | +Prompt name: **migrate-page-widgets** |
| 121 | +Parameters: |
| 122 | + - *pageName*: The name in the content tree of the source project |
| 123 | + - *legacyPageUrl*: The URL of the page in the source project |
| 124 | + |
| 125 | +Migrates Page Builder [widgets](https://docs.kentico.com/x/7gWiCQ) and [sections](https://docs.kentico.com/x/9AWiCQ) used by the specified page. |
| 126 | + |
| 127 | +This prompt can be omitted if the specific page doesn't use Page Builder features. |
| 128 | + |
| 129 | +**VS Code GitHub Copilot example:** |
| 130 | + |
| 131 | +``` |
| 132 | +/migrate-page-widgets |
| 133 | +
|
| 134 | +pageName: home |
| 135 | +legacyPageUrl: https://localhost:5001/en-us/home |
| 136 | +``` |
| 137 | + |
| 138 | +### Migrate page logic |
| 139 | + |
| 140 | +Prompt name: **migrate-page** |
| 141 | +Parameters: |
| 142 | + - *pageName*: The name in the content tree of the source project |
| 143 | + - *legacyPageUrl*: The URL of the page in the source project |
| 144 | + |
| 145 | +Migrates the code of individual pages: controllers, views, layouts, and dependencies. |
| 146 | + |
| 147 | +**VS Code GitHub Copilot example:** |
| 148 | + |
| 149 | +``` |
| 150 | +/migrate-page |
| 151 | +
|
| 152 | +pageName: home |
| 153 | +legacyPageUrl: https://localhost:5001/en-us/home |
| 154 | +``` |
| 155 | + |
| 156 | +### Ensure page visual match |
| 157 | + |
| 158 | +Prompt name: **migrate-page-visual** |
| 159 | +Parameters: |
| 160 | + - *pageName*: The name in the content tree of the source project |
| 161 | + - *legacyPageUrl*: The URL of the page in the source project |
| 162 | + - *newPageUrl*: The URL of the page in the target project |
| 163 | + |
| 164 | +Ensures the migrated page visually matches the original KX13 page. Use if the migrate-page prompt doesn't successfully replicate the look and feel. The prompt uses Playwright to identify differences in both pages and aligns the migrated page to match the source. |
| 165 | + |
| 166 | +**VS Code GitHub Copilot example:** |
| 167 | + |
| 168 | +``` |
| 169 | +/migrate-page-visual |
| 170 | +
|
| 171 | +pageName: home |
| 172 | +legacyPageUrl: https://localhost:5001/en-us/home |
| 173 | +newPageUrl: http://localhost:60444/en-us/home |
| 174 | +``` |
| 175 | + |
| 176 | +## Prompt customization |
| 177 | + |
| 178 | +These prompt files serve as a baseline for migrating the codebase of KX13 projects to Xperience by Kentico. Modify and enhance the files as required by your implementation, workflow, and requirements. For example, you can update the `instructions/projects-structure.md` file with additional information about the project being migrated. |
0 commit comments