Agent skill

Vercel Edge Functions

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Build and deploy Vercel Edge Functions for ultra-low latency at the edge.

MITAuto-check passedBackend & APIs

Install Vercel Edge Functions

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill vercel-edge-functions -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace vercel-edge-functions --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/saas-packs/vercel-pack/skills/vercel-edge-functions .claude/skills/vercel-edge-functions && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
vercel-edge-functions
GitHub stars
2.8k
Token cost
~1.9k tokens
SKILL.md length
424 words
Files
1
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Build and deploy Vercel Edge Functions for ultra-low latency at the edge.

  • Works in 5 steps: Create an Edge Function → Edge Function with Geolocation → Edge Middleware (middleware.ts) → …
  • Creating API routes with minimal latency
  • SKILL.md covers Overview, Prerequisites, Instructions and Edge vs Serverless Comparison, plus 6 more sections
  • Calls npm

What it does

Vercel Edge Functions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build and deploy Vercel Edge Functions for ultra-low latency at the edge. Use when creating API routes with minimal latency, geolocation-based routing, A/B testing, or authentication at the edge. Trigger with phrases like "vercel edge function", "vercel edge runtime", "deploy edge function", "vercel middleware", "@vercel/edge".

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Designed for Claude Code

It sits in Backend & APIs, covering Serverless and A/B testing. It works with Vercel, npm and Node.js. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Creating API routes with minimal latency
  • Geolocation-based routing
  • Authentication at the edge
  • With phrases like vercel edge function

Example prompts

  • “vercel edge function”
  • “vercel edge runtime”
  • “deploy edge function”
  • “/vercel-edge-functions”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(vercel:*), Bash(npm:*), Grep

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Create an Edge Function
  2. Edge Function with Geolocation
  3. Edge Middleware (middleware.ts)
  4. Edge Function with Streaming
  5. Edge Config (Key-Value Store)

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(vercel:*)
    • Bash(npm:*)
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • vercel.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Vercel Edge Functions loads about 1.9k tokens when it runs. Until then it costs about 88 tokens; SKILL.md has 424 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 424 words, ~1,948 tokens.

Download SKILL.mdSave it as .claude/skills/vercel-edge-functions/SKILL.md (or your agent's skills folder).
name
vercel-edge-functions
description
Build and deploy Vercel Edge Functions for ultra-low latency at the edge. Use when creating API routes with minimal latency, geolocation-based routing, A/B testing, or authentication at the edge. Trigger with phrases like "vercel edge function", "vercel edge runtime", "deploy edge function", "vercel middleware", "@vercel/edge".
allowed-tools
Read, Write, Edit, Bash(vercel:*), Bash(npm:*), Grep
compatibility
Designed for Claude Code
version
1.18.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, vercel, edge, serverless, performance

Vercel Edge Functions

Overview

Edge Functions run on Vercel's Edge Network (V8 isolates) close to the user with no cold starts. They use Web Standard APIs (Request, Response, fetch) instead of Node.js APIs. Ideal for authentication, A/B testing, geolocation routing, and low-latency API responses.

Prerequisites

  • Completed vercel-install-auth setup
  • Familiarity with Web APIs (Request/Response)
  • Node.js 18+ for local development

Instructions

Step 1: Create an Edge Function
typescript
// api/edge-hello.ts
// Export `runtime = 'edge'` to run on the Edge Runtime
export const config = { runtime: 'edge' };

export default function handler(request: Request): Response {
  return new Response(
    JSON.stringify({
      message: 'Hello from the Edge!',
      region: request.headers.get('x-vercel-ip-city') ?? 'unknown',
      timestamp: Date.now(),
    }),
    {
      status: 200,
      headers: { 'Content-Type': 'application/json' },
    }
  );
}
Step 2: Edge Function with Geolocation

Vercel injects geolocation headers into every edge request:

typescript
// api/geo.ts
export const config = { runtime: 'edge' };

export default function handler(request: Request): Response {
  const city = request.headers.get('x-vercel-ip-city') ?? 'unknown';
  const country = request.headers.get('x-vercel-ip-country') ?? 'unknown';
  const region = request.headers.get('x-vercel-ip-country-region') ?? 'unknown';
  const latitude = request.headers.get('x-vercel-ip-latitude');
  const longitude = request.headers.get('x-vercel-ip-longitude');

  return Response.json({
    city: decodeURIComponent(city),
    country,
    region,
    coordinates: latitude && longitude ? { lat: latitude, lng: longitude } : null,
  });
}
Step 3: Edge Middleware (middleware.ts)

Middleware runs before every request and can rewrite, redirect, or add headers:

typescript
// middleware.ts (must be at project root or src/)
import { NextRequest, NextResponse } from 'next/server';

export function middleware(request: NextRequest) {
  // Example 1: Redirect based on country
  const country = request.geo?.country ?? 'US';
  if (country === 'DE') {
    return NextResponse.redirect(new URL('/de', request.url));
  }

  // Example 2: A/B testing with cookies
  const bucket = request.cookies.get('ab-bucket')?.value;
  if (!bucket) {
    const response = NextResponse.next();
    response.cookies.set('ab-bucket', Math.random() > 0.5 ? 'a' : 'b');
    return response;
  }

  // Example 3: Add security headers
  const response = NextResponse.next();
  response.headers.set('X-Frame-Options', 'DENY');
  response.headers.set('X-Content-Type-Options', 'nosniff');
  response.headers.set('Referrer-Policy', 'strict-origin-when-cross-origin');
  return response;
}

// Only run on specific paths — skip static assets
export const config = {
  matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'],
};
Step 4: Edge Function with Streaming
typescript
// api/stream.ts
export const config = { runtime: 'edge' };

export default function handler(): Response {
  const encoder = new TextEncoder();
  const stream = new ReadableStream({
    async start(controller) {
      for (let i = 0; i < 5; i++) {
        controller.enqueue(encoder.encode(`data: chunk ${i}\n\n`));
        await new Promise(r => setTimeout(r, 500));
      }
      controller.enqueue(encoder.encode('data: [DONE]\n\n'));
      controller.close();
    },
  });

  return new Response(stream, {
    headers: {
      'Content-Type': 'text/event-stream',
      'Cache-Control': 'no-cache',
      Connection: 'keep-alive',
    },
  });
}
Step 5: Edge Config (Key-Value Store)
typescript
// api/feature-flags.ts
import { get } from '@vercel/edge-config';

export const config = { runtime: 'edge' };

export default async function handler(): Promise<Response> {
  // Read from Edge Config — sub-millisecond reads at the edge
  const maintenanceMode = await get<boolean>('maintenance_mode');
  const featureFlags = await get<Record<string, boolean>>('feature_flags');

  if (maintenanceMode) {
    return Response.json({ status: 'maintenance' }, { status: 503 });
  }

  return Response.json({ features: featureFlags });
}

Install: npm install @vercel/edge-config

Edge vs Serverless Comparison

FeatureEdge RuntimeNode.js (Serverless)
Cold startNone (~0ms)250ms–1s+
Max duration30s (Hobby), 5min (Pro)10s (Hobby), 5min (Pro)
Max size1 MB (after gzip)250 MB (unzipped)
APIs availableWeb Standard APIsFull Node.js API
npm packagesLimited (no native modules)All npm packages
Global deploymentAutomaticSingle region default
Use caseAuth, routing, A/B, geoDatabase queries, heavy compute

Available Web APIs in Edge Runtime

fetch, Request, Response, Headers, URL, URLSearchParams, TextEncoder, TextDecoder, ReadableStream, WritableStream, TransformStream, crypto, atob, btoa, structuredClone, setTimeout, setInterval, AbortController

NOT available: fs, path, child_process, net, http, dns, native Node.js modules

Output

  • Edge Function deployed globally with zero cold starts
  • Geolocation-based routing using Vercel's injected headers
  • Middleware running authentication and A/B tests at the edge
  • Streaming responses for real-time data delivery
Show full SKILL.md (181 more words)Show less

Error Handling

ErrorCauseSolution
EDGE_FUNCTION_INVOCATION_FAILEDRuntime error in edge functionCheck logs — no try/catch around async code
Dynamic Code Evaluation not allowedUsing eval() or new Function()Refactor to avoid dynamic code evaluation
Module not foundnpm package uses Node.js APIsUse edge-compatible alternative or switch to Node.js runtime
FUNCTION_PAYLOAD_TOO_LARGEEdge function bundle > 1 MBTree-shake imports, split into smaller functions
TypeError: x is not a functionNode.js API used in edge runtimeReplace with Web Standard API equivalent

Examples

Roll out edge authorization middleware safely

Implement an allow-listed middleware matcher that excludes static assets and health checks, and validate its Web API-only dependencies with the Edge runtime in preview. Send synthetic signed and unsigned requests from at least two regions, verify that unauthorized requests receive the intended response without logging credentials, and measure added latency. Release behind a reversible configuration flag; if legitimate traffic is blocked, disable the flag or restore the previous deployment before changing the policy.

Resources

Next Steps

For common errors, see vercel-common-errors.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/saas-packs/vercel-pack/skills/vercel-edge-functions of jeremylongshore/tons-of-skills-marketplace.

Open the folder on GitHubat commit cfae287

Compare with similar skills

Vercel Edge Functions next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Vercel Edge Functions compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Vercel Edge Functions this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.9kAutomated safety check: PassMIT
Cloudflare Workers Migrationsecondsky/claude-skills227—~1.3kAutomated safety check: PassMIT
Bun Nextjssecondsky/claude-skills227—~1.9kAutomated safety check: NotesMIT
Compileapache/skywalking-nodejs180—~1.3kAutomated safety check: PassApache-2.0
AI Model NodejsTencentCloudBase/CloudBase-AI-Toolkit1.1k2 repos~5kAutomated safety check: PassMIT
Adobe App Builder Action Scaffolderadobe/skills197—~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Cloudflare Workers Migration

    secondsky/claude-skills

    Migrate to Cloudflare Workers from AWS Lambda, Vercel, Express, and Node.js.

    227 GitHub stars~1.3k tokensUpdated 13 days ago
    Backend & APIsAuto-check passed
  • Bun Nextjs

    secondsky/claude-skills

    This skill should be used when the user asks about "Next.js with Bun", "Bun and Next", "running Next.js on Bun", "Next.js development with Bun", "create-next-app with Bun", or building Next.js…

    227 GitHub stars~1.9k tokensUpdated 13 days ago
    DevOps & CloudAuto-check: notes
  • Compile

    apache/skywalking-nodejs

    Compile / build / type-check the skywalking-nodejs agent. An agent skill from apache/skywalking-nodejs.

    180 GitHub stars~1.3k tokensUpdated 25 days ago
    Backend & APIsAuto-check passed
  • AI Model Nodejs

    TencentCloudBase/CloudBase-AI-Toolkit

    A skill your agent uses for Node.js backend AI via @cloudbase/node-sdk (=3.16.0) — cloud functions, CloudRun, Express/Koa/NestJS, serverless APIs, scheduled jobs, LLM proxies, agent orchestration.

    1.1k GitHub starsUsed in 2 repos~5k tokens
    Backend & APIsAuto-check passed
  • Scaffolds, implements, deploys and debugs Adobe Runtime actions in App Builder projects, with templates for webhooks, events, database CRUD, sequences and Asset Compute workers.

    197 GitHub stars~3.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • starknet.js SDK Reference

    internet-court/internet-court-skill

    Reference for building Starknet apps with starknet.js v9: providers, accounts, contract calls, fee estimation, wallet integration and paymaster flows.

    6.6k GitHub starsUsed in 1 repo~3.5k tokens
    Backend & APIsAuto-check: notes

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Categories

Questions about Vercel Edge Functions

What does Vercel Edge Functions do?

Build and deploy Vercel Edge Functions for ultra-low latency at the edge. Vercel Edge Functions is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build and deploy Vercel Edge Functions for ultra-low latency at the edge.

When should I use Vercel Edge Functions?

Vercel Edge Functions fits situations like: creating API routes with minimal latency; geolocation-based routing; authentication at the edge; with phrases like vercel edge function.

How do I install Vercel Edge Functions in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill vercel-edge-functions -a claude-code`. Or copy the skill folder (plugins/saas-packs/vercel-pack/skills/vercel-edge-functions in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/vercel-edge-functions in your project. Claude Code loads it when a task matches its description.

How do I install Vercel Edge Functions in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill vercel-edge-functions -a codex`. Or copy the skill folder (plugins/saas-packs/vercel-pack/skills/vercel-edge-functions in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/vercel-edge-functions in your project. Codex loads it when a task matches its description.

Can I use Vercel Edge Functions in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill vercel-edge-functions -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/vercel-edge-functions, .gemini/skills/vercel-edge-functions, .github/skills/vercel-edge-functions and .opencode/skills/vercel-edge-functions in your project.

What does Vercel Edge Functions need to run?

Going by SKILL.md and its folder, Vercel Edge Functions needs the command-line tools its instructions call (npm). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(vercel:*), Bash(npm:*), Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Vercel Edge Functions access the network?

SKILL.md names 1 domain. As links in the text: vercel.com. This is read from the text; nothing was executed.

Is Vercel Edge Functions safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Vercel Edge Functions use?

Vercel Edge Functions is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Vercel Edge Functions use?

About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Vercel Edge Functions?

Skills that share tags, products or a category with Vercel Edge Functions: Cloudflare Workers Migration (secondsky/claude-skills, 227 stars), Bun Nextjs (secondsky/claude-skills, 227 stars), Compile (apache/skywalking-nodejs, 180 stars) and AI Model Nodejs (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Vercel Edge Functions?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.