netlify-config
БесплатноБез исполняемых скриптовНе проверенConfigure Netlify projects via netlify.toml and the _headers/_redirects files — covering build settings and deploy contexts alongside environment…
от PracticalSwan★ 25 звёзд на GitHubОб этом скилле
Netlify configuration
Config lives in three files at the repo root (or the base/package directory for monorepos):
netlify.toml: build, contexts, plugins, functions, 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).
netlify.toml build + contexts
"$schema" = "https://open-api.netlify.com/netlify.schema.json"
[build]
base = "frontend"
publish = "dist"
command = "npm run build"
environment = { NODE_VERSION = "18" }
[context.production]
publish = "output/"
command = "make publish"
[context.deploy-preview]
publish = "dist/"
[context."feat/branch"] # quote names with special characters
command = "npm run preview"
[build] runs in Bash. Context-aware keys include [build] and plugins. They do NOT include redirects or headers, which are always global. Precedence, least→most specific: UI < toml < any-context property < [context.<name>] < [context.branchname].
Redirects and rewrites
_redirects rules are processed first, then netlify.toml. Within each, the first matching rule top-to-bottom wins, so list specific rules before general ones. Edge functions run before redirects.
SPA history-pushState fallback (required for clean URLs):
/* /index.html 200
redirects
from = "/*"
to = "/index.html"
status = 200
_redirects syntax is from to [status] [conditions]. Lines starting with # are comments, paths are case-sensitive, and special chars must be URL-encoded:
/home / 301
/my-redirect / 302
/ecommerce /store-closed 404 # custom 404 for a path
/pass-through /index.html 200 # rewrite
/best-pets/dogs /best-pets/cats.html 200! # force/shadow (! or force=true)
/news/* /blog/:splat # splat
/news/:month/:date/:year/:slug /blog/:year/:month/:date/:slug # placeholders
/store id=:id /blog/:id 301 # query params
/ /anz 302 Country=au,nz # no spaces in value list
/israel/* /israel/he/:splat 302 Language=he
/* /legacy/:splat 200 Cookie=is_legacy,my_other_cookie
redirects keywords:
from,tostatus(default301)force(defaultfalse; same as!/shadow)query(query = {path = ":path"})conditions({Language, Country, Role, Cookie})headers(proxy request headers)signed(env var name for signed proxies)
Gotchas:
- You cannot add or remove a trailing slash with a redirect. The CDN normalizes URLs first, so a
/x/ → /x 301!rule loops infinitely. Rely on Pretty URLs (default on). - Splat asterisks work only at the end of a segment (
/jobs/*), not mid-path (/jobs/*.htmlis invalid). Placeholders (:x) work only at the start of a segment. You can't mix a wildcard and a placeholder in one segment. - You can't exclude a path from a splat. Put a more specific rule first instead.
Countrytakes ISO 3166-1 alpha-2 codes. Language redirects match only the firstAccept-Languageentry.- Role-based redirects with external auth providers are Enterprise-only.
- For 10,000+ redirects, use wildcards/placeholders or Edge Functions. Oversized serialized output fails the deploy.
Proxies
/api/* https://api.example.com/:splat 200
/netlify-site/* https://my-other-site.netlify.app/:splat 200 # use .netlify.app, not custom domain
redirects # custom request headers + force
from = "/search"
to = "https://api.mysearch.com"
status = 200
force = true
headers = {X-From = "Netlify"}
Signed proxy rules:
signednames an env var scoped to Runtime.- The rule must live in
netlify.toml. - JWS signing works for external tar
Установить netlify-config в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл netlify-config?
Configure Netlify projects via netlify.toml and the _headers/_redirects files — covering build settings and deploy contexts alongside environment variables/scopes and the Secrets Controller plus redirect/rewrite/proxy and custom-header rules. Use when setting a build command or publish directory, adding redirect or rewrite or proxy rules, configuring custom headers or basic auth, setting or scoping environment variables and secrets, wiring up a monorepo or SPA fallback, or skipping unnecessary builds. Reach for this whenever you touch netlify.toml or ask "why is my env var undefined in a function" or "how do I redirect this path".
Как установить скилл netlify-config?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл netlify-config запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub