
Edge Runtime
Build or refactor Vercel Edge Functions and Middleware without importing Node-only APIs that break at the edge.
Overview
edge-runtime is an agent skill most often used in Build (also Ship launch) that guides Vercel Edge Runtime APIs and blocks Node-incompatible patterns in edge functions and middleware.
Install
npx skills add https://github.com/vercel-labs/vercel-plugin --skill edge-runtimeWhat is this skill?
- Expert guidance for Vercel Edge Runtime on Edge Functions and Middleware.
- Auto-triggers on `edge-runtime.config.*`, `edge-runtime` / `@edge-runtime/*` imports, and package install bash patterns.
- Built-in validators flag `fs`, `child_process`, `net`/`dns`, `require()`, and `eval()` as Edge-incompatible.
- Recommends fetch and KV-style patterns instead of Node filesystem APIs.
- Metadata priority 4 for path, import, and install pattern matching in the Vercel plugin.
- Five built-in validate rules target fs, child_process, net/dns, require(), and eval().
- Plugin metadata priority 4 for edge-runtime path, import, and install detection.
Adoption & trust: 2 installs on skills.sh; 187 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You copied Node serverless code into an edge route and only discover missing modules or runtime errors after deploy.
Who is it for?
Solo builders deploying on Vercel who want middleware, edge APIs, or geo-aware logic without reading the entire Edge Runtime docs first.
Skip if: Long-running Node-only workloads, heavy native dependencies, or teams not hosting on Vercel’s edge platform.
When should I use this skill?
Building or configuring Vercel Edge Functions, edge middleware, edge-runtime.config files, or installing edge-runtime / @edge-runtime packages.
What do I get? / Deliverables
Edge entrypoints use supported ESM imports and storage patterns, with agent-side validators catching disallowed Node APIs before merge.
- Edge-compatible import and API usage guidance
- Severity-ranked validation messages on disallowed Node patterns
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Edge handlers are authored during backend build; the skill’s validators fire as you edit edge entrypoints and dependencies. Backend subphase covers runtime choice, imports, and Edge Runtime packages—not SEO launch or post-deploy monitoring.
Where it fits
You scaffold an edge auth middleware and the skill blocks a stray `node:fs` import before commit.
You wire a third-party SDK and validators flag `require()` so you switch to ESM-compatible entrypoints.
Pre-deploy review runs import checks on `@edge-runtime/*` usage across new routes.
You keep logic at the edge for TTFB and confirm no Node-only DNS calls slip into hot paths.
How it compares
Vercel-specific edge runtime guardrails—not a generic Next.js app router tutorial or a full DevOps deploy pipeline skill.
Common Questions / FAQ
Who is edge-runtime for?
Indie developers and small teams writing Vercel Edge Functions or Middleware in JavaScript/TypeScript who want agent help that enforces runtime limits.
When should I use edge-runtime?
During Build when adding edge routes or middleware, and during Ship launch/perf passes when reviewing imports before production deploy on Vercel.
Is edge-runtime safe to install?
It is documentation and static validation patterns from the Vercel plugin; confirm trust via the Security Audits panel on this page before enabling in your agent plugin set.
SKILL.md
READMESKILL.md - Edge Runtime
# Edge Runtime — Vercel's Edge JavaScript Runtime You are an expert in Vercel's Edge Runtime (v4.0+), the lightweight JavaScript runtime based on V8 isolates. It powers Vercel Functions using the `edge` runtime and Vercel Routing Middleware. ## Overview The Edge Runtime is designed for: - **Vercel Functions (edge runtime)** — functions that run on V8 isolates at the network edge - **Vercel Routing Middleware** — intercept and transform requests before cache - **Local development** — test edge behavior locally with the same runtime **Important**: The standalone "Edge Functions" and "Edge Middleware" products are **deprecated** and unified under **Vercel Functions** (powered by Fluid Compute). Edge Middleware is now **Vercel Routing Middleware**. Edge Functions are now **Vercel Functions using the `edge` runtime**. Vercel recommends **migrating to the Node.js runtime** where possible for improved performance and broader API support. **Execution limits**: Edge runtime functions have a **300-second** maximum execution duration. Streaming responses must begin within **25 seconds** to maintain streaming capabilities. ## Packages | Package | Description | |---|---| | `edge-runtime` | Core runtime for local development and testing | | `@edge-runtime/primitives` | Web API primitives (Request, Response, fetch, etc.) | | `@edge-runtime/cookies` | Cookie parsing and serialization | | `@edge-runtime/format` | Pretty-print Edge Runtime values | | `@edge-runtime/vm` | VM-based Edge Runtime sandbox | ## Installation ```bash npm install edge-runtime # Individual packages npm install @edge-runtime/cookies npm install @edge-runtime/primitives ``` ## Local Development with Edge Runtime ```ts import { EdgeRuntime } from 'edge-runtime' const runtime = new EdgeRuntime() const result = await runtime.evaluate(` const response = new Response('Hello from the edge!') response.text() `) console.log(result) // "Hello from the edge!" ``` ## Available Web APIs The Edge Runtime provides a subset of standard Web APIs: - **Fetch API**: `fetch`, `Request`, `Response`, `Headers` - **Streams**: `ReadableStream`, `WritableStream`, `TransformStream` - **Encoding**: `TextEncoder`, `TextDecoder` - **URL**: `URL`, `URLSearchParams`, `