Build with AI
Teach your AI the best practices for building code with the Netlify platform.
Builders can ship code at extreme speeds using AI tools and agents such as Cursor, Windsurf, GitHub Copilot, Bolt, and other codegen platforms.
These tools can rely on AI models that can quickly become outdated or struggle with overlapping concepts. To mitigate this, developers can 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 context files with Windsurf
For Windsurf editor users, place the context files into your repo directory or globally - it doesn't matter for this editor. By default, the Netlify CLI will place AI context files in a ./ai-context
directory in the repo.
To ensure Windsurf always checks your context files, you can add a global rule to your Windsurf editor settings.
To add a global rule in your Windsurf editor:
Go to Open Cascade > Additional Options menu > Manage Memories > Edit global rules.
In your global rules, add the following rule, replacing the directory location with where you placed your context files in your site/app repository. In this rule example, the repository is using a directory called
ai-context
.
- Use context in a repo's "ai-context" directory for all coding. If there is front matter, use the description and glob fields to determine if the current request is relevant to the context.
# Using context files with Cursor
For Cursor editor users, place the context files 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.
# Using AI codegen platforms
AI codegen platforms, like Bolt, can be used to rapidly prototype fullstack apps. You can claim Codegen deployments and connect them to your Netlify account, giving you the ability to manage your app/site on Netlify with support for custom domains, forms, basic site/app monitoring, and more.
Netlify supports a variety of AI codegen platforms, such as same.new and more. Learn more in our blog about codegen deployments.
# 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.