Build with AI
Teach your AI the best practices for building code with the Netlify platform.
AI tools and agents such as Cursor, Windsurf, and GitHub Copilot help developers ship code at extreme speeds. However, these tools rely on AI models that can quickly become outdated or struggle with overlapping concepts. To mitigate this, developers leverage context files that are specific to the tools they are using in their stack.
# Netlify context files
For developers building code for the Netlify platform, we provide official context information that can be used within your AI tool of choice. This context improves the agent experience for your AI tool, resulting in more reliable code.
Netlify’s official context file for building with AI
We will continue to update these context files over time with improvements to the context and with new feature releases.
# Using context files
For most tools, simply add the netlify-development.mdc
file to the project repo or AI tool, then reference them when prompting. Check out the documentation for your AI web development assistant to learn where to save this file and whether you need a different file format.
Using Cursor?
For Cursor editor users, place this file into your .cursor/rules/
directory and Cursor will automatically pick up this context and apply the rules when necessary.
# Adding AI context with the CLI
In addition to making the context files available, we've updated our CLI with a recipe that can add or update these files on your behalf.
This requires the CLI version 18.1.0
or higher. Install or update the CLI on your computer with the following command: npm install -g netlify-cli
.
Add or update Netlify's AI context with the following command in the base directory:
netlify recipes ai-context
This command will walk you through selecting where you want this context to be added or updated if it already exists.
# Overriding AI context
You should not have to make any changes to the provided context files. If you do, we provide a specific location within the context files to allow modifications. Within the context file, a <ProviderContextOverrides>
is near the top. Place all overrides within the opening and closing overrides tag. Placing overrides here allows us to reliably retain customizations when using the CLI to update the context when newer versions are released.
# Support for llms.txt
Netlify's documentation site also provides support for /llms.txt
. Generally, this file is automatically used by tools that support this format when you reference "https://docs.netlify.com"
as the web context you want to source. If interested in using the file yourself, you can find it at https://docs.netlify.com/llms.txt.
# Building AI dev tools?
If you’re building AI code generation assistants, agents, and tools, check out our guide on partnering with Netlify to deploy your apps and sites.
Did you find this doc useful?
Your feedback helps us improve our docs.