원클릭으로
deployment-netlify-deployment
Deploying static sites, JAMstack apps, or frontend frameworks to Netlify
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Deploying static sites, JAMstack apps, or frontend frameworks to Netlify
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | deployment-netlify-deployment |
| description | Deploying static sites, JAMstack apps, or frontend frameworks to Netlify |
Scope: Netlify site deployment, build settings, continuous deployment, and configuration Lines: ~320 Last Updated: 2025-10-18
Activate this skill when:
Git-based deployment:
Deploy contexts:
Three ways to configure:
Build settings hierarchy:
Required settings:
Framework detection:
# netlify.toml - Basic configuration
[build]
# Base directory for monorepos
base = "apps/web"
# Build command
command = "npm run build"
# Publish directory (relative to base)
publish = "dist"
# Functions directory
functions = "netlify/functions"
# Environment variables (non-sensitive only)
[build.environment]
NODE_VERSION = "20"
NPM_FLAGS = "--legacy-peer-deps"
# Production context
[context.production]
command = "npm run build:prod"
[context.production.environment]
NEXT_PUBLIC_API_URL = "https://api.example.com"
# Deploy preview context (PRs)
[context.deploy-preview]
command = "npm run build:preview"
[context.deploy-preview.environment]
NEXT_PUBLIC_API_URL = "https://preview-api.example.com"
# Branch deploy context
[context.branch-deploy]
command = "npm run build:dev"
When to use:
# Next.js App Router
[build]
command = "npm run build"
publish = ".next"
[build.environment]
NODE_VERSION = "20"
NEXT_PRIVATE_TARGET = "server"
# Astro
[build]
command = "npm run build"
publish = "dist"
# SvelteKit
[build]
command = "npm run build"
publish = "build"
[build.environment]
NODE_VERSION = "20"
# Vite + React
[build]
command = "npm run build"
publish = "dist"
# Nuxt 3
[build]
command = "npm run build"
publish = ".output/public"
Framework-specific gotchas:
.next for publish dir, Netlify handles server renderingoutput: 'static' or 'hybrid' in astro.config@sveltejs/adapter-netlifynuxt build with Nitro preset# netlify.toml redirects
[[redirects]]
from = "/old-path/*"
to = "/new-path/:splat"
status = 301
force = true
[[redirects]]
from = "/api/*"
to = "https://api.example.com/:splat"
status = 200
force = true
[[redirects]]
from = "/blog/:slug"
to = "/articles/:slug"
status = 301
# SPA fallback (catch-all)
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
# Redirect with query params
[[redirects]]
from = "/search"
to = "/search-results?q=:query"
query = {query = ":query"}
status = 301
# Proxy API requests (no CORS)
[[redirects]]
from = "/api-proxy/*"
to = "https://external-api.com/:splat"
status = 200
headers = {X-Custom-Header = "value"}
Alternative: _redirects file:
# public/_redirects
/old-path/* /new-path/:splat 301
/api/* https://api.example.com/:splat 200
/* /index.html 200
When to use:
# netlify.toml headers
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
Permissions-Policy = "camera=(), microphone=(), geolocation=()"
[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/*.js"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/*.css"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/api/*"
[headers.values]
Access-Control-Allow-Origin = "https://example.com"
Access-Control-Allow-Methods = "GET, POST, PUT, DELETE"
Access-Control-Allow-Headers = "Content-Type, Authorization"
[[headers]]
for = "/index.html"
[headers.values]
Cache-Control = "public, max-age=0, must-revalidate"
When to use:
# Install Netlify CLI
npm install -g netlify-cli
# Login to Netlify
netlify login
# Initialize new site
netlify init
# Link existing site
netlify link
# Deploy to draft URL (preview)
netlify deploy
# Deploy to production
netlify deploy --prod
# Deploy specific directory
netlify deploy --dir=dist --prod
# Open site in browser
netlify open
# View deployment status
netlify status
# Stream build logs
netlify watch
# Run dev server with Netlify features
netlify dev
When to use:
# Set via CLI
netlify env:set API_KEY "secret-key"
netlify env:set API_URL "https://api.example.com" --context production
netlify env:set DEBUG_MODE "true" --context deploy-preview
# List environment variables
netlify env:list
# Import from .env file
netlify env:import .env.production
# Remove environment variable
netlify env:unset API_KEY
In netlify.toml (non-sensitive only):
[build.environment]
NODE_VERSION = "20"
NEXT_PUBLIC_APP_NAME = "My App"
[context.production.environment]
NEXT_PUBLIC_API_URL = "https://api.example.com"
[context.deploy-preview.environment]
NEXT_PUBLIC_API_URL = "https://preview-api.example.com"
Best practices:
NEXT_PUBLIC_, VITE_, PUBLIC_ (framework-specific)# netlify.toml in repo root
[build]
base = "apps/marketing"
command = "npm run build"
publish = "dist"
# Ignore builds if app didn't change
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF apps/marketing"
Multiple sites from one repo:
# Site 1: apps/marketing/netlify.toml
[build]
base = "apps/marketing"
command = "npm run build"
publish = "dist"
# Site 2: apps/docs/netlify.toml
[build]
base = "apps/docs"
command = "npm run build"
publish = "dist"
When to use:
Framework | Build Command | Publish Directory
----------------|-------------------------|------------------
Next.js | npm run build | .next
Astro | npm run build | dist
SvelteKit | npm run build | build
Vite | npm run build | dist
Nuxt 3 | npm run build | .output/public
Gatsby | npm run build | public
Remix | npm run build | build/client
Eleventy | npx @11ty/eleventy | _site
Hugo | hugo | public
Jekyll | jekyll build | _site
Context | Trigger | Use Case
-----------------|------------------------|---------------------------
production | Push to main branch | Live site
deploy-preview | Open pull request | PR previews
branch-deploy | Push to other branch | Feature branch testing
File | Purpose
-------------------|------------------------------------------
netlify.toml | Build config, redirects, headers
_redirects | Redirects (alternative to toml)
_headers | Headers (alternative to toml)
.nvmrc | Node version specification
package.json | Dependencies, build scripts
✅ Build command configured
✅ Publish directory set correctly
✅ Environment variables added (production + preview)
✅ Redirects configured (especially SPA fallback)
✅ Security headers added
✅ Cache headers for static assets
✅ Node version specified (.nvmrc or netlify.toml)
✅ Git LFS configured (if using large files)
✅ Custom domain configured (if applicable)
✅ HTTPS enforced
❌ Wrong publish directory: Build succeeds but site shows 404
✅ Check framework's output directory (.next, dist, build, etc.)
❌ Missing SPA fallback redirect: Direct routes 404 in SPAs
✅ Add /* /index.html 200 redirect for client-side routing
❌ Hardcoded environment variables: API URLs in source code ✅ Use environment variables, different per deploy context
❌ No cache headers: Static assets re-downloaded on every visit
✅ Set Cache-Control: public, max-age=31536000, immutable for hashed assets
❌ Sensitive keys in netlify.toml: API secrets committed to Git ✅ Use Netlify UI or CLI for sensitive environment variables
❌ Build command missing dependencies: Build fails after npm install
✅ Ensure all dependencies in package.json, test locally with netlify dev
❌ Deploying build artifacts: Committing dist/ or .next/ to Git
✅ Add to .gitignore, let Netlify build on deploy
❌ No base directory in monorepo: Builds entire repo
✅ Set base = "apps/your-app" in netlify.toml
netlify-functions.md - Serverless functions, Edge Functions, API endpointsnetlify-optimization.md - Performance, caching, build optimizationnextjs-app-router.md - Next.js specific deployment patternsastro-deployment.md - Astro SSR and hybrid deploymentgithub-actions-workflows.md - Custom CI/CD before Netlify deploycloudflare-workers.md - Alternative edge deployment platformLast Updated: 2025-10-18 Format Version: 1.0 (Atomic)
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
Comprehensive guide to GNU Debugger (GDB) for debugging C/C++/Rust programs. Covers breakpoints, stack traces, variable inspection, TUI mode, .gdbinit customization, Python scripting, remote debugging, and core file analysis.
Paxos consensus algorithm including Basic Paxos, Multi-Paxos, roles, phases, and practical implementations
Gossip protocols for disseminating information, failure detection, and eventual consistency in large-scale distributed systems