netlify-edge-functions
Write, route, cache, and debug Netlify Edge Functions, the Deno-based TypeScript or JavaScript handlers in netlify/edge-functions that run at the network edge…
Skill by netlifyOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/netlify-netlify-edge-functions
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend, backend, testing, cloud
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/netlify-edge-functions
What's inside
- Skill name
netlify-edge-functions- Description
- Write, route, cache, and debug Netlify Edge Functions, the Deno-based TypeScript or JavaScript handlers in netlify/edge-functions that run at the network edge in front of static files and serverless functions. Activate this skill whenever someone wants to add auth middleware or a login gate, redirect or rewrite visitors by country or cookie, localize or personalize a page with geolocation, run A/B testing, transform or inject HTML into a response, stream server-side rendering at the edge, or cache an edge response. Also use it when an edge function silently does nothing, runs in the wrong order, ignores its Cache-Control headers, or cannot read an environment variable.
- License
- MIT
- Instructions
- 356 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# Netlify Edge Functions
## Use this form
```ts
// netlify/edge-functions/hello.ts
import type { Config, Context } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
return new Response(`Hello from ${context.geo.country?.name ?? "somewhere"}`);
};
export const config: Config = { path: "/hello" };
```
- One file = one function: a default-export handler plus a `config` export with the route. Alternatively, declare the route in `netlify.toml`.
- `Request` and `Response` are global. Import `Context` and `Config` types from `@netlify/edge-functions`.
- Read env vars with `Netlify.env.get()`. `process.env` works only for Next.js middleware.
**Avoid these:**
- A file with no `config.path` or `pattern` and no `[[edge_functions]]` entry. It deploys but never runs.
- Import maps in `deno.json`. They are unsupported. Use a separate file with `[functions] deno_import_map`.
- Variables set in `netlify.toml`. They are invisible to edge functions.
- `Netlify.env.set()` or `Netlify.env.delete()` as persistence. They affect only the current invocation.
- `fetch()` to the same site for the current path. Use `context.next()` instead.
## ⚠️ Footguns
- **No route = silent no-op.** Edge functions get no automatic URL.
- **`path: "/*"` runs on every request**, including assets. Narrow it, or add `excludedPath`.
- **Caching needs both parts:** `cache: "manual"` in config AND cache headers on the returned `Response`. With only one, nothing is cached.
- **Cached functions shadow static files.** A cached function on `/*` serves `/cat.png` instead of the file.
- **Returning a `Response` ends the chain.** Redirect rules for that path never run.
- **Same-site `fetch()` and `URL` rewrites start a new request chain.** Matching edge functions run again. Use `context.next()` to reach the static asset or serverless function at the same path.
- **The request body can be read once.** After `await req.json()`, pass `new Request(req, { body })` to `context.next()`.
- **Same-named `foo.ts` and `foo.js`:** the TS file is ignored and the JS file deploys.
- **50 ms CPU per request**, including `waitUntil` work.
- **Not executed** on sites with Split Testing enabled.
- **Custom Headers and basic-auth headers do not apply** to edge functions.
- **Not supported** on HIPAA-compliant hosting.
- **`netlify.app` is on the Public Suffix List.** Cross-subdomain cookies need a custom domain.
## Files
| What | Where |
|---|---|
| Functions | `<base>/netlify/edge-functions/*.{js,ts,jsx,tsx}` |
| Custom dir | `[build] edge_functions = "my-dir"` (relative to base dir; keep it outside the publish dir) |
| Name in toml | file name without extension (`auth.ts` → `function = "auth"`) |
| Import map | any JSON file, referenced by `[functions] deno_import_map = "./import_map.json"` |
## Return values
| Return | Effect |
|---|---|
| `Response` | sent to client; chain ends |
| `URL` | same-site rewrite, 200, address bar unchanged |
| `undefined` / `return;` | skip this function; chain continues |
### Endpoint
```ts
export default async () =>
new Response("Hello, World!", { headers: { "content-type": "text/html" } });
export const config = { path: "/api/hello" };
```
### Redirect / rewrite
```ts
import type { Context } from "@netlify/edge-functions";
export default async (req: Request, { cookies, geo }: Context) => {
if (geo.city === "Paris" && cookies.get("promo-code") === "15-for-followers") {
return Response.redirect(new URL("/subscriber-sale", req.url)); // redirect
// or: return new URL("/subscriber-sale", req.url); // rewrite (same-site only)
}
};
export const config = { path: "/sale" };
```
Rewrites must target the same site. To reach other sites, use `fetch`.
### Middleware (modify origin response)
```ts
import type { Context } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
if (new URL(request.url).searchParams.get("method") !== "transform") return;
const response = await context.next();
return new Response((await response.text()).toUpperCase(), response);
};
export const config = { path: "/blog/*" };
```
Call `context.next()` only when you need the response body. If you just return `undefined`, the chain continues on its own.
### Conditional requests
```ts
export default async (req: Request, { next }: Context) => {
const res = await next({ sendConditionalRequest: true });
if (res.status === 304) return res;
return new Response((await res.text()).toUpperCase(), res);
};
```
By default, `next()` strips conditional headers, so it always returns a full response.
### Read body, then continue
```ts
export default async (req: Request, context: Context) => {
const body = await req.json();
if (!isValid(body.access_token)) return new Response("forbidden", { status: 403 });
return context.next(new Request(req, { body: JSON.stringify(body) }));
};
```
### Netlify user gate (private / team-login-protected projects)
```ts
import type { Config, Context } from "@netlify/edge-functions";
export default async (req: Request, context: Context) => {
const user = context.user; // undefined: public project, password protection, netlify dev
if (!user) return new Response("Forbidden", { status: 403 });From netlify/context-and-tools, MIT.
More from netlify/context-and-tools
- 0.761score
netlify-database
netlifyOfficial
Zero-config Postgres for Netlify apps via @netlify/database — querying data from Functions/Edge Functions, writing schema migrations, setting up Drizzle ORM…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-frameworks
netlifyOfficial
Deploy and configure web frameworks on Netlify — build settings and SSR/edge adapters plus local platform emulation and env vars.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-access-control
netlifyOfficial
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user login (Netlify Identity)…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-mcp-servers
netlifyOfficial
Build, deploy, and secure Model Context Protocol (MCP) servers on Netlify.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-deploy
netlifyOfficial
Create, configure, and manage Netlify deploys from code — reach for this when setting up Git continuous deployment, running netlify deploy or netlify deploy…
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-agent-runner
netlifyOfficial
Run AI agent tasks remotely on Netlify using Claude, Codex, or Gemini.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-functions
netlifyOfficial
Write, configure, and deploy Netlify serverless functions in TypeScript, JavaScript, or Go.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-ai-gateway
netlifyOfficial
Use Netlify AI Gateway to call OpenAI, Anthropic Claude, Google Gemini, TypeSafe (Jev), or OpenRouter-hosted models (xAI/DeepSeek/Meta/Mistral/Qwen) from…
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-blobs
netlifyOfficial
Store and retrieve unstructured objects, files, and cache-like state on Netlify with the @netlify/blobs module.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-caching
netlifyOfficial
Cache dynamic and static responses on Netlify's CDN from Functions, Edge Functions, and proxies.
SkillAFreshness: A★ 43Claude Code +9 - 0.755score
netlify-config
netlifyOfficial
Configure Netlify builds and routing via netlify.toml, _redirects, and _headers.
SkillAFreshness: A★ 43Claude Code +9
Signals
- Stars
- 43
- Forks
- 13
- Open issues
- 3
- Last commit (this folder)
- Oct 22, 2026 (6 days ago)
- Last release
- Oct 8, 2026 (20 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/netlify/context-and-tools
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.394score
netlify-edge-functions
netlifyOfficial
Write, route, cache, and debug Netlify Edge Functions, the Deno-based TypeScript or JavaScript handlers in netlify/edge-functions that run at the network edge…
SkillAFreshness: A★ 43Claude Code +9 - 0.394score
netlify-edge-functions
netlifyOfficial
Write, route, cache, and debug Netlify Edge Functions, the Deno-based TypeScript or JavaScript handlers in netlify/edge-functions that run at the network edge…
SkillAFreshness: A★ 43Claude Code +9
More from netlify
- 0.761score
netlify-frameworks
netlifyOfficial
Deploy and configure web frameworks on Netlify — build settings and SSR/edge adapters plus local platform emulation and env vars.
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-identity
netlifyOfficial
Add user authentication to a Netlify site with @netlify/identity — signup/login/logout, Google/GitHub/GitLab/Bitbucket OAuth, server-side getUser() checks…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-access-control
netlifyOfficial
Picks the right Netlify site-protection layer and disambiguates the three unrelated "auth" concepts users conflate — app-user login (Netlify Identity)…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-deploy
netlifyOfficial
Create, configure, and manage Netlify deploys from code — reach for this when setting up Git continuous deployment, running netlify deploy or netlify deploy…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-database
netlifyOfficial
Zero-config Postgres for Netlify apps via @netlify/database — querying data from Functions/Edge Functions, writing schema migrations, setting up Drizzle ORM…
SkillAFreshness: A★ 43Claude Code +9 - 0.761score
netlify-mcp-servers
netlifyOfficial
Build, deploy, and secure Model Context Protocol (MCP) servers on Netlify.
SkillAFreshness: A★ 43Claude Code +9
Cite this page
netlify-edge-functions skill. Agent Mart. https://agentmart.dev/skills/netlify-netlify-edge-functions (last updated 2026-10-24)