netlify-config
Installation
SKILL.md
Contains Shell Commands
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Netlify configuration
Config lives in three files at the repo root (or the base/package directory for monorepos):
netlify.toml: build, contexts, plugins, functions, server, redirects, headers, dev._redirects: plain-text redirect/rewrite rules, saved to the publish directory, no extension._headers: plain-text response headers, saved to the publish directory.
netlify.toml values take precedence over the Netlify UI when they conflict. Paths in netlify.toml are absolute relative to the base directory (root / by default).
Modern vs legacy syntax to reach for
- Schema: start
netlify.tomlwith"$schema" = "https://open-api.netlify.com/netlify.schema.json"(key is quoted). Editors and agents with TOML JSON-schema support suggest and validate properties. In VS Code, use the Even Better TOML extension. Netlify ignores the key at build/deploy. A schema-valid file can still fail to build, because checks like whether a directory exists happen only during the build. - Functions bundler: use
node_bundler = "esbuild".zisiis the legacy JS default. TypeScript always usesesbuild. - Temporary redirect: use
status = 302.307is unsupported. - Gatsby Image CDN: use
NETLIFY_IMAGE_CDN, not the deprecatedGATSBY_CLOUD_IMAGE_CDN. - Injecting env values into TOML:
key = "$VAR"is NOT supported (exceptsignedin proxy redirects). Use a build-commandsedsubstitution or a build plugin (see below).