netlify-edge-functions

netlify-edge-functions is a skill for Claude Code from netlify/context-and-tools. It costs 141 tokens per session (4,489 once invoked), scanned D, original, MIT.

A guide for writing, configuring and deploying Netlify Edge Functions, which run TypeScript or JavaScript near users on Netlify's network. It covers request handling at the network edge, including authentication middleware, redirects, A/B tests and localization.

In plain words
What is it for?
Use it when adding Netlify edge code for request or response changes, redirects and rewrites, server-side rendering, geolocation, personalization or content localization.
Why use it?
It helps avoid configuration mistakes, such as missing routes, unsupported import-map setup and conflicts with framework-generated functions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the netlify-skills plugin — 16 skills, 1 MCP server shipped together

Good fit Use it when adding Netlify edge code for request or response changes, redirects and rewrites, server-side rendering, geolocation, personalization or content localization.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/netlify/context-and-tools/netlify-edge-functions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add netlify/context-and-tools --skill netlify-edge-functions
Clone the repo
git clone --depth 1 https://github.com/netlify/context-and-tools

Made for: Claude Code.

Or install netlify-skills, the plugin that ships this one along with the rest of its 16 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for netlify-edge-functions

README.md
[![agentmods](https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-edge-functions/github.svg)](https://agentmods.dev/skills/netlify/context-and-tools/netlify-edge-functions)
Your own site
<a href="https://agentmods.dev/skills/netlify/context-and-tools/netlify-edge-functions"><img src="https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-edge-functions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for netlify-edge-functions

Your own site · 80×15
<a href="https://agentmods.dev/skills/netlify/context-and-tools/netlify-edge-functions"><img src="https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-edge-functions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 141 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,489 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 22 Oct 2026
  • Snyk pass 3 Nov 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00141 $0.04489
Opus 5.5 $0.00056 $0.01796
Sonnet 5.5 $0.00028 $0.00898
Haiku 4.5 $0.00014 $0.00449

Measured 1mo ago against content hash c152ffea3ed7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

netlify-edge-functions scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- system: agent-context/edge-functions/system.md — human-owned, merged by ctx-gen; edit system.md, not this section -->

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

context.waitUntil(fetch("https://analytics.example.com/event", { method: "POST" }));

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

async fetch(request: Request, context: Context) {
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

agent-plugin/skills/netlify-edge-functions/SKILL.md · 370 lines

How it starts

The opening of the file, as written. The whole thing — 370 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Netlify Edge Functions

Use this form

// 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 named config export with the route. Alternatively, declare the route in netlify.toml.
  • The default export can also be a Fetchable module: an object with a fetch method. Netlify calls fetch with the same (request, context) arguments and uses its return value the same way; inside fetch, this is the exported object. Use it to share one handler with other platforms that accept Fetchable modules.
    export default {
      async fetch(request: Request, context: Context) {
        return new Response("Hello");
      },
    };
    export const config: Config = { path: "/hello" }; // still a named export
    
  • 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.

Read the full file on GitHub · 370 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +10 lines c152ffea3ed7
  2. 1mo ago Changed · +28 lines · -25 tokens per session scan C → D 15073a0c9cb1
  3. 1mo ago Changed 54bf0da188a1
  4. 2mo ago Changed · +65 lines · +43 tokens per session fbbf95129c20
  5. 2mo ago Changed · +7 lines a8a272c06568
  6. 3mo ago First seen · 260 lines · 123 tokens per session scan C a030e99b80ee

Subscribe to this mod's changes

netlify-edge-functions is a skill published in the GitHub repository netlify/context-and-tools (58 stars, last pushed yesterday), licensed MIT. It adds 141 tokens to every session and 4,489 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it D with 3 findings (hidden instructions, sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

netlify-edge-functions compared with skills from other repositories

netlify-edge-functions next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
netlify-edge-functionsnetlify/context-and-toolsSkill58yesterdayMITD141Claude Code
stripe-projectse2b-dev/E2BSkill15ktodayApache-2.0A51Claude Code, Codex
nestjs-expertJeffallan/claude-skillsSkill13ktodayMITA107Claude Code
nestjsericrisco/rsc-harnessSkill707yesterdayMITA81Claude Code, Codex
azure-web-pubsub-tsbenjaminasterA/antigravity-awesome-skillsSkill527yesterdayMITA51Claude Code, Codex
better-authsecondsky/claude-skillsSkill2573d agoMITA53Claude Code
hono-routingsecondsky/claude-skillsSkill2573d agoMITA41Claude Code