AI context files
Learn how to use Netlify’s AI context files to improve the results you get when building with AI tools and code agents.
Netlify maintains its own context files that give guidance on using the Netlify platform and features so that your AI tools and code agents can generate better code and offer better user experience.
Your AI tool may use different file formats or you can share documentation context with your AI tool directly with Netlify’s llms.txt
file.
We recommend sharing llms.txt
with your AI tool as well as specific context files (sometimes called rule files depending on your AI tool) for working with Netlify’s platform.
You can also share a rule or context file for working with your project’s framework to improve your AI tool’s results.
# Using llms.txt
You can share Netlify documentation context with your AI tools with https://docs.netlify.com/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.
# Using Netlify context files
Use our official context files (or rule files) to help you and your code agents generate more reliable code with your AI tools of choice.
You can download the official Netlify context file directly from this URL: https://docs.netlify.com/ai-context/netlify-development.mdc
Or use the Netlify CLI to add or update the context files in your project automatically. Learn more about using the Netlify CLI to auto-update context files.
# Context file updates
We will continue to update these context files with details related to new feature releases.
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, you can add context files in the .windsurf/rules/
directory at the root of your project’s directory or use the Windsurf UI to manually add your context files.
You can apply rules to only your project directory or to all projects you manage with Windsurf.
Learn more about your options and check out examples from the official Windsurf documentation:
# 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.
Did you find this doc useful?
Your feedback helps us improve our docs.