Skip to main content
AI coding agents, such as GitHub Copilot, Claude Code, Codex, and Cursor, write better GDK code when they work from the APIs and documentation of the GDK you build with, instead of from what their model remembers. This article describes the GDK context you can give an agent and how to set up each source. This guidance applies to the Microsoft Game Development Kit (GDK) and the Microsoft GDK with XBOX Extensions (GDKX) on a Windows PC development computer.

Before you begin

  • Install the GDK. The examples use the October 2026 GDK (edition 261000). Replace 261000 with the edition your game builds with.
  • Use an agent that can connect to a Model Context Protocol (MCP) server, read files on your computer, or run commands. Most coding agents can do all three.
  • Find out which AI tools your organization approves for confidential content. GDKX documentation, headers, and tools are confidential.

Choose the GDK context to give the agent

The online sources describe the current GDK. When you build with an earlier GDK, give the agent the installed headers and the offline documentation too, so it doesn’t use APIs that your GDK doesn’t have.

Connect the XBOX docs MCP server

The XBOX docs MCP server at https://docs.xbox.com/mcp lets an agent search and cite the published docs. It doesn’t need an API key or sign-in. For example, in Visual Studio Code, add the server to a .vscode/mcp.json file in your project:
.vscode/mcp.json
For the setup steps for Claude Code, GitHub Copilot CLI, Cursor, Codex, and Claude, see Use these docs with AI tools on the home page. Agents that can’t use MCP can read the docs in other formats:
  • https://docs.xbox.com/llms.txt lists every page with a short description.
  • https://docs.xbox.com/llms-full.txt contains the full text of the docs in one file.
  • Add .md to the end of any page URL to get that page as Markdown.

Give the agent the offline documentation

The GDKX installs the GDK documentation as Markdown files in GDKDocumentationMarkdown.zip, in the xbox\documentation folder of the GDK edition. Because the files match the GDK you installed, they’re the most accurate documentation source for that version. Each page starts with YAML frontmatter. The permissioned-type value gives the page’s access classification: public, private, or secret. The site-map.md file at the root of the archive lists the pages.
The archive contains confidential pages. Use the full archive only with AI tools that your organization approves for confidential GDKX content. Don’t add the extracted files to a public repository or to any location that people outside your organization can read.
  1. Extract the archive to a folder outside your source repository. In PowerShell, run the following commands.
  2. If your AI tool isn’t approved for confidential content, keep only the public pages. The following command deletes every Markdown file whose permissioned-type isn’t public, including files that don’t have the field.
  3. Give the agent access to the folder. For example, add it to your editor’s workspace, or name it in your project instruction file.
Extract the archive again for each GDK edition you install, into a folder named for that edition.

Point the agent at the installed headers and tools

The GDK installer sets environment variables that give the agent the installed GDK’s location:
  • GameDK is the GDK root folder. It contains the bin folder of command-line tools and a folder for each installed edition, such as %GameDK%261000\.
  • GameDKCoreLatest and GameDKXboxLatest point to the most recent installed edition.
When more than one edition is installed side by side, the most recent edition might not be the one your game builds with. Give the agent the edition folder your game uses, such as %GameDK%261000\, instead of these variables. For the folders under each edition, see GDK header and library directory structure. Tell the agent to check declarations in the headers under the edition’s windows\include folder for PC, or its xbox\include folder for XBOX consoles, before it uses an API. Some headers, such as the XBOX services API (XSAPI), libHttpClient, and PlayFab headers, also include doc comments that describe each API. The command-line tools in %GameDK%bin print their usage when you run them with /?. An agent can run a tool’s /? before it uses the tool, instead of guessing its options. To translate an HRESULT into a description, use xberror.exe:

Give the agent version-matched sample code

Use the XBOX GDK sample list to find examples of the feature you’re implementing. Check the repository and sample READMEs for GDK version, directory layout, and platform requirements. If the main branch doesn’t match your project, choose a compatible sample release. Clone or download the compatible release and give the agent the local paths to the relevant sample’s source and README. Ask it to follow the sample’s initialization, error handling, asynchronous lifetime, and cleanup patterns. Have the agent verify APIs against your installed headers rather than copying project settings from a different GDK layout.

Let the agent build from the command line

To build, an agent needs the same environment as a Gaming Command Prompt. Run GamingDesktopVars.cmd with the arguments that the Start menu shortcut uses, and then run the build in the same cmd process:
Use GamingDesktopVS2022 for Visual Studio 2022. The environment doesn’t carry over between separate commands, so the agent must run the script and the build together.

Add a project instruction file

Most coding agents read a project instruction file, such as AGENTS.md or .github/copilot-instructions.md, at the root of your repository. Use it to give every agent session the same GDK context. Start from the following example, and replace the values in angle brackets.
AGENTS.md

Review the agent’s work

Before you review a change, ask the agent to self-review its work. For example, give it this prompt:
Self-review doesn’t replace your review. Review and test agent-written code as you would any other code. Verify claims about platform support, policies, and certification requirements in the docs, not in the agent’s answer.

See also

Last modified on November 18, 2026