Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
netlify avatar

Netlify Config

  • 1.5k installs
  • 31 repo stars
  • Updated August 4, 2026
  • netlify/context-and-tools

netlify-config is a reference skill that configures Netlify builds, redirects, headers, edge functions, and deploy contexts through a single netlify.toml file for developers deploying static sites and serverless function

About

netlify-config is a reference skill from netlify/context-and-tools for complete netlify.toml site configuration at the repository root or monorepo base directory. It covers build settings including base, command, and publish paths, plus redirects with splats and conditions, custom headers, deploy contexts, environment variables, Netlify Functions config, and edge functions config. Example snippets show [build] blocks with npm run build and dist publish directories. Developers reach for netlify-config when adding redirects, SPA rewrites, security headers, or per-branch deploy contexts without digging through Netlify docs mid-session.

  • Complete netlify.toml syntax reference with ready-to-copy examples
  • Covers build settings, redirects with splats and conditions, headers, and deploy contexts
  • Includes SPA catch-all, proxy redirects, force overrides, and edge functions configuration
  • Supports monorepos and per-context environment variable handling

Netlify Config by the numbers

  • 1,525 all-time installs (skills.sh)
  • +134 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #144 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/netlify/context-and-tools --skill netlify-config

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.5k
repo stars31
Last updatedAugust 4, 2026
Repositorynetlify/context-and-tools

How do you configure netlify.toml redirects and builds?

Correctly configure Netlify builds, redirects, headers, edge functions, and deploy contexts using a single netlify.toml file.

Who is it for?

Developers shipping static sites or Jamstack apps on Netlify who need correct TOML syntax for builds, redirects, headers, and edge functions.

Skip if: Teams deploying only to Vercel, AWS, or raw Docker without any Netlify hosting in the stack.

When should I use this skill?

The user asks to configure netlify.toml, Netlify redirects, deploy contexts, headers, or edge functions for a site.

What you get

A root-level netlify.toml with build, redirect, header, deploy context, and functions configuration.

  • netlify.toml configuration file

Files

SKILL.mdMarkdownGitHub ↗

Netlify Configuration (netlify.toml)

Place netlify.toml at the repository root (or at the base directory for monorepos).

Build Settings

[build]
  base = "project/"          # Base directory (default: root)
  command = "npm run build"  # Build command
  publish = "dist/"          # Output directory

Redirects

# Basic redirect
[[redirects]]
from = "/old"
to = "/new"
status = 301              # 301 (default), 302, 200 (rewrite), 404

# SPA catch-all
[[redirects]]
from = "/*"
to = "/index.html"
status = 200

# Splat (wildcard)
[[redirects]]
from = "/blog/*"
to = "/news/:splat"

# Path parameters
[[redirects]]
from = "/users/:id"
to = "/api/users/:id"
status = 200

# Force (override existing files)
[[redirects]]
from = "/app/*"
to = "/index.html"
status = 200
force = true

# Proxy to external service
[[redirects]]
from = "/api/*"
to = "https://api.example.com/:splat"
status = 200
[redirects.headers]
  X-Custom = "value"

# Country/language conditions
[[redirects]]
from = "/*"
to = "/fr/:splat"
status = 200
conditions = { Country = ["FR"], Language = ["fr"] }

Rule order matters — Netlify processes the first matching rule. Place specific rules before general ones.

Headers

[[headers]]
for = "/*"
[headers.values]
  X-Frame-Options = "DENY"
  X-Content-Type-Options = "nosniff"

[[headers]]
for = "/assets/*"
[headers.values]
  Cache-Control = "public, max-age=31536000, immutable"

Headers apply only to files served from Netlify's CDN (not to function or edge function responses — set those in code).

Deploy Contexts

Override settings per deploy context:

[context.production]
command = "npm run build"
environment = { NODE_ENV = "production" }

[context.deploy-preview]
command = "npm run build:preview"

[context.branch-deploy]
command = "npm run build:staging"

[context.dev]
environment = { NODE_ENV = "development" }

# Specific branch
[context."staging"]
command = "npm run build:staging"

Environment Variables

[build.environment]
NODE_VERSION = "20"

[context.production.environment]
API_URL = "https://api.prod.com"

[context.deploy-preview.environment]
API_URL = "https://api.staging.com"

Do not put secrets in netlify.toml (it's committed to source control). Use the Netlify UI or CLI for sensitive values. See the netlify-cli-and-deploy skill for CLI environment variable management.

Functions Configuration

[functions]
directory = "netlify/functions"   # Default
node_bundler = "esbuild"

# Scheduled function
[functions."cleanup"]
schedule = "@daily"

Edge Functions Configuration

[[edge_functions]]
path = "/admin"
function = "auth"

# Import map for Deno URL imports
[functions]
deno_import_map = "./import_map.json"

Dev Server

[dev]
command = "npm start"       # Dev server command
port = 8888                 # Netlify Dev port
targetPort = 3000           # Your app's dev server port
framework = "#auto"         # "#auto", "#static", "#custom"

Plugins

[[plugins]]
package = "@netlify/plugin-lighthouse"
[plugins.inputs]
  audits = ["performance", "accessibility"]

Image CDN

[images]
remote_images = ["https://example\\.com/.*"]

See the netlify-image-cdn skill for full Image CDN usage.

Related skills

FAQ

Where should netlify.toml live in a monorepo?

netlify-config places netlify.toml at the repository root or at the monorepo base directory configured via [build] base, with publish and command paths relative to that base.

What netlify.toml sections does netlify-config cover?

netlify-config covers build settings, redirects with splats and conditions, custom headers, deploy contexts, environment variables, Netlify Functions config, and edge functions configuration.

DevOps & CI/CDdevopsintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.