| name | migrate-global-code |
| description | Migrates global code from a Kentico Xperience 13 project to Xperience by Kentico. Sets up the target project structure, generates code files, and migrates shared code including localization, styles, business logic, and project startup configuration. Use when starting a KX13 to XbyK codebase migration. |
| compatibility | Requires Kentico Docs MCP |
You are tasked with the process of migrating global code from a Kentico Xperience 13 project to an Xperience by Kentico project.
Structure of the projects
You are currently located in the root folder, which contains two subfolders:
KX13/ - This folder contains the Kentico Xperience 13 project files. This is the legacy/source project.
XbyK/ - This folder contains the Xperience by Kentico project files. This is the new project.
Migration Steps
- Review the structure of both the legacy and new project.
- Use Kentico Docs MCP to read the following page: https://docs.kentico.com/guides/upgrade-to-xbyk/upgrade-walkthrough/adjust-global-code (note that this guide is written for a sample project and that there will be some differences between the sample project and the project you are migrating)
- Create a new project for generated code files (named {ProjectName}.Entities).
- Configure given project as described in the documentation.
- CRITICAL: Ensure the .csproj file contains the following (without this, content item reference fields will fail to populate):
<ItemGroup>
<AssemblyAttribute Include="CMS.AssemblyDiscoverableAttribute" />
</ItemGroup>
- Generate code files by running the
--kxp-codegen command as described in the documentation. Always use --skip-confirmation flag to avoid interactive prompts
- Copy relevant global code from source project to the new project.
- Localization
- Shared views
- Styles and scripts
- Identifiers
- Services registration
- Configure the project to display content.
- Enable Content tree-based routing and Page Builder.
- Add future custom service registrations and localization.
- Ensure that the new project builds successfully without errors and warnings. If it doesn't, some part of the documentation was not followed correctly. Fix the issues based on the docs page.
Notes relevant to the migration process:
- Do not change any other files or settings outside of the global code migration process (that are not mentioned in the docs page).
- When commenting out code, always add "TODO:" note to make it easier to find later.
Output format
When done, provide the user with this exact output (without any additional text):
# Migration Complete
Global code migration from the legacy project to the new one has been successfully completed.
**Next steps:**
- Update your channel configuration to include the port of the local XbyK instance (the one the project launches with).
Follow these steps: https://docs.kentico.com/guides/upgrade-to-xbyk/upgrade-walkthrough/adjust-global-code#adjust-system-url
- Review the changes to ensure everything looks as expected.
- Continue with the migrate-page-widgets skill to migrate Page Builder widgets used by the specified page.