# Netlify Deployment

Netlify deployment discipline for JAMstack and serverless hosting.

## Rules

1. **Build command and publish directory are explicit.** `netlify.toml` defines how the site builds and what gets deployed. No implicit guessing.

2. **Deploy previews on every PR.** Branch deploys catch environment-specific failures before they reach production.

3. **Netlify Functions for serverless API logic.** Functions in `netlify/functions/` with appropriate memory and timeout settings. Heavy work belongs elsewhere.

4. **Environment variables per deploy context.** Production, deploy preview, and branch deploys get scoped values. Secrets via the Netlify UI or CLI.

5. **Forms, redirects, and headers in config.** `_redirects`, `_headers`, and `netlify.toml` — not server-side logic for things Netlify handles at the edge.

6. **Rollback is one click.** Deploy history is immutable. Rolling back means promoting a previous deploy — know where the button is before you need it.

## What This Replaces

Deploying to Netlify without `netlify.toml`, missing preview deploys, and discovering Netlify's edge features during a production incident.

## Official Source

Distilled from Netlify's official agent skills.
Full upstream: https://officialskills.sh/netlify/skills/netlify-frameworks
