netlify-access-control
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user…
Write, configure, and deploy Netlify serverless functions in TypeScript, JavaScript, or Go. Use this when adding an API endpoint or backend route, adding a contact form handler, wiring auth or Identity signup/login hooks, identifying which Netlify user is calling a private or
Claude Code
$ npx -y skills add netlify/context-and-tools --skill netlify-functions --agent claude-code
Codex
$ npx skills add netlify/context-and-tools --skill netlify-functions -a codex -y
Cursor
$ npx skills add netlify/context-and-tools --skill netlify-functions -a cursor -y
Gemini CLI
$ npx skills add netlify/context-and-tools --skill netlify-functions -a gemini-cli -y
GitHub Copilot
$ npx skills add netlify/context-and-tools --skill netlify-functions -a github-copilot -y
OpenCode
$ npx skills add netlify/context-and-tools --skill netlify-functions -a opencode -y
Windsurf
$ npx skills add netlify/context-and-tools --skill netlify-functions -a windsurf -y
name: netlify-functions description: Write, configure, and deploy Netlify serverless functions in TypeScript, JavaScript, or Go. Use this when adding an API endpoint or backend route, adding a contact form handler, wiring auth or Identity signup/login hooks, identifying which Netlify user is calling a private or team-login-protected app, building streaming or AI-proxy responses, scheduling cron jobs, running long background jobs (batch processing/scraping), reacting to deploy or form events, setting up rate limiting or region/memory config, or reading environment variables and secrets inside a function. Covers file locations, the Request/Context/Response handler shape, path routing, config options, and local testing with netlify dev.
Reach for the modern default-handler API (`.mts` TypeScript). Export a default async handler taking a web `Request` and a Netlify `Context`, returning a web `Response`. Avoid the legacy AWS Lambda handler shape unless writing Go or migrating old code (see Legacy at the end).
⚠️ **Same-name JS and TS files: the JS one wins.** If the functions directory has e.g. `items.js` and `items.ts`, the JavaScript function is deployed and the TypeScript file is silently ignored — edits to the `.ts` have no effect. Keep one file per function name; delete or rename the stale `.js` when moving a function to TypeScript.
No `config` export. Serves at `/.netlify/functions/hello`.
import type { Context } from "@netlify/functions"
export default async (req: Request, context: Context) => {
return new Response("Hello, world!")
}Install types: `npm install @netlify/functions` (required for TS types; optional for JS).
Read env vars and secrets with `Netlify.env.get()`:
const apiKey = Netlify.env.get("STRIPE_SECRET_KEY")Never hardcode secrets. For the variable to exist at runtime its scope must include **Functions**. Variables set in `netlify.toml` are NOT available to functions. Values are frozen per deploy — change them and redeploy to apply.
**Response headers are set in code** on the returned `Response`. `[[headers]]` in `netlify.toml`, `_headers`, and redirect header rules apply ONLY to static CDN responses, not function responses. Do not add CORS headers unless explicitly requested.
Set `config.path` to route to custom URLs. When set, the function serves ONLY at that path — not at `/.netlify/functions/<name>`.
import type { Config, Context } from "@netlify/functions"
export default async (req: Request, context: Context) => {
const { city, country } = context.params
return new Response(`You're visiting ${city} in ${country}!`)
}
export const config: Config = {
path: "/travel-guide/:city/:country",
}Equivalent to the default function; carries `config` inline and lets you add event handlers.
import type { NetlifyFunction } from "@netlify/functions"
export default {
fetch: (req, context) => new Response("Hello, world!"),
config: { path: "/hello" },
} satisfies NetlifyFunctionSecond handler argument (or `getContext()` from `@netlify/functions` when out of handler scope — throws outside a request; wrap in try/catch).
⚠️ `context.geo`/`context.ip` are **mocked** under `netlify dev` — test with `netlify dev --geo=mock --country=DE`.
⚠️ `context.user` is often `undefined`: public projects, basic password protection, local `netlify dev`, and functions deployed before October 5, 2026 (redeploy to enable). Always handle it; key records on `id` (`email` may be `undefined`).
import type { Config, Context } from "@netlify/functions"
export default async (req: Request, context: Context) => {
if (!context.user) {
// Public project, basic password protection, local CLI, oPublic Netlify skills for AI coding agents. Each skill is a focused, factual reference for a Netlify platform primitive — designed to help agents build correctly on Netlify without needing to search docs.
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user…
Run AI agent tasks remotely on Netlify using Claude, Codex, or Gemini. Use when the user wants to run an AI agent on their site,…
Use Netlify AI Gateway to call OpenAI, Anthropic Claude, Google Gemini, TypeSafe (Jev), or OpenRouter-hosted models…
Store and retrieve unstructured objects, files, and cache-like state on Netlify with the @netlify/blobs module. Use when…
Cache dynamic and static responses on Netlify's CDN from Functions, Edge Functions, and proxies. Use when you add caching or…
Configure Netlify builds and routing via netlify.toml, _redirects, and _headers. Use when setting a build command or publish…
Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing…
Use when launching cloud VMs, Kubernetes pods, or Slurm jobs for GPU/TPU/CPU workloads, training or fine-tuning models on cloud…
Use this skill when the user mentions "pinme", or needs to upload files, store to IPFS, create/publish/deploy websites or…