Skip to main content
skill CX Codex

edgeone-makers-edge-functions — Claude Code skill for EdgeOne

This Claude Code skill covers EdgeOne Makers Edge Functions. The agent uses it when editing files under edge-functions/** or functions/**.

MIT 253 installs ★ 1,839 updated 2026-11-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add TencentEdgeOne/edgeone-makers-tools --skill edgeone-makers-edge-functions -a claude-code
Open on GitHub

What edgeone-makers-edge-functions does

The skill guides JavaScript code for EdgeOne Makers functions, including route setup, HTTP request and response handling, and environment variables. It explains method-specific handlers, dynamic routes, and the context object, which exposes request data, route parameters, environment values, and waitUntil.

These functions run on V8 rather than Node.js, so Node built-ins, require(), and npm packages are unavailable. The code package limit is 5 MB, request bodies are limited to 1 MB, and each invocation gets 200 ms of CPU time. KV Storage requires enabling it in the EdgeOne Makers console, creating a namespace, and binding it to the project; bound KV is a global variable, not a property of context.env.

What it helps with

  • write a GET or POST handler for an API
  • define a route with a dynamic parameter
  • catch requests that match no route
  • read and update values in KV Storage

Example prompts for the agent

  • Add a GET handler to edge-functions/api/users.js.
  • Set up edge-functions/api/users/[id].js to return the id parameter.
  • Update the view counter through KV Storage in edge-functions/api/counter.js.

How to install edgeone-makers-edge-functions

1Skills CLI (Vercel)

npx skills add TencentEdgeOne/edgeone-makers-tools --skill edgeone-makers-edge-functions -a claude-code

2Manually: put the files in place

~/.claude/skills/makers-edge-functions/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/makers-edge-functions/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about edgeone-makers-edge-functions

How do I install edgeone-makers-edge-functions in Claude Code?

Run npx skills add TencentEdgeOne/edgeone-makers-tools --skill edgeone-makers-edge-functions -a claude-code. The skill file is at ~/.claude/skills/makers-edge-functions/SKILL.md.

What does edgeone-makers-edge-functions do?

It guides EdgeOne Makers Edge Functions work, covering HTTP handlers, routing, environment variables, and KV Storage access.

What are the runtime limits for EdgeOne Makers Edge Functions?

They run on V8, not Node.js, and cannot use Node built-ins or npm packages. The code package limit is 5 MB, the request body limit is 1 MB, and CPU time per invocation is 200 ms.

Source text

SKILL.md · MIT
---
name: edgeone-makers-edge-functions
description: >-
  V8-based lightweight edge functions on EdgeOne Makers. Covers routing, KV storage access,
  request/response handling, and environment variables at the edge.
pathPatterns:
  - edge-functions/**
  - functions/**
validate:
  - pattern: "process\\.env"
    message: "Use context.env in EdgeOne Makers runtime code."
  - pattern: "new\\s+Headers\\s*\\("
    message: "Use plain object headers for this runtime surface."
  - pattern: "fs\\.writeFile"
    message: "Edge Functions do not support filesystem writes."
  - pattern: "Response\\.json\\s*\\("
    message: "Response.json() is not available in this V8 runtime — use new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } })."
metadata:
  author: edgeone
  version: "1.0.0"
---

# Edge Functions

V8-based lightweight functions running at the edge. Ideal for simple APIs, KV storage access, and ultra-low latency responses.

> **Runtime:** V8 (like Cloudflare Workers) — NOT Node.js. Do NOT use Node.js built-ins or npm packages.
>
> ⚠️ `Response.json()` is **NOT available** in this V8 runtime. Always use `new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } })` instead.

## Basic function

File: `edge-functions/api/hello.js`

```javascript
export default function onRequest(context) {
  return new Response('Hello from Edge Functions!');
}
```

Access: `GET /api/hello`

## HTTP method handlers

```javascript
// edge-functions/api/users.js

// Handle all methods
export function onRequest(context) {
  return new Response('Any method');
}

// Or use specific method handlers:
export function onRequestGet(context) {
  return new Response(JSON.stringify({ users: [] }), {
    headers: { 'Content-Type': 'application/json' },
  });
}

export async function onRequestPost(context) {
  const body = await context.request.json();
  return new Response(JSON.stringify({ created: true }), {
    status: 201,
    headers: { 'Content-Type': 'application/json' },
  });
}
```

## EventContext object

```javascript
export function onRequest(context) {
  const {
    request,    // Standard Request object
    params,     // Dynamic route params, e.g. { id: "123" }
    env,        // Environment variables from Makers console
    waitUntil,  // Extend function lifetime for async tasks
  } = context;

  // GEO info available via:
  const geo = context.request.eo;
  // geo.geo.countryName, geo.geo.cityName, geo.geo.latitude, etc.

  return new Response('OK');
}
```

## Dynamic routes

```javascript
// edge-functions/api/users/[id].js
// Matches: /api/users/123, /api/users/abc

export function onRequestGet(context) {
  const userId = context.params.id;
  return new Response(JSON.stringify({ userId }), {
    headers: { 'Content-Type': 'application/json' },
  });
}
```

```javascript
// edge-functions/api/[[default]].js
// Catches all unmatched routes under /api/

export function onRequest(context) {
  return new Response('Catch-all route', { status: 404 });
}
```

## KV Storage (Edge Functions only)

> Cross-reference: if your code uses `context.store` or KV APIs, also read `../makers-storage/SKILL.md`.

⚠️ **Prerequisites**: You must enable KV Storage in the EdgeOne Makers console, create a namespace, and bind it to your project before using KV. See [../makers-storage/references/kv.md](../makers-storage/references/kv.md) for full setup instructions.

The KV namespace is a **global variable** (name is set when binding in the console) — it is **NOT** on `context.env`.

```javascript
// edge-functions/api/counter.js

export async function onRequest(context) {
  // ⚠️ my_kv is a GLOBAL variable (name set when binding namespace in console)
  // Do NOT use context.env.KV ❌
  
  // Read
  const count = await my_kv.get('page_views') || '0';
  const newCount = parseInt(count) + 1;

  // Write
  await my_kv.put('page_views', String(newCount));

  return new Response(JSON.stringify({ views: newCount }), {
    headers: { 'Content-Type': 'application/json' },
  });
}
```

For full KV Storage API reference and usage guide, see: [../makers-storage/references/kv.md](../makers-storage/references/kv.md).

## Supported Runtime APIs

Edge Functions run on V8 and support these Web Standard APIs:
- **Fetch API** — `fetch()` for outbound HTTP requests
- **Cache API** — `caches.open()`, `cache.match()`, `cache.put()`
- **Headers / Request / Response** — standard Web API objects
- **Streams** — `ReadableStream`, `WritableStream`, `TransformStream`
- **Web Crypto** — `crypto.subtle` for encryption/signing
- **Encoding** — `TextEncoder`, `TextDecoder`
- **URL / URLSearchParams** — URL parsing

⚠️ **NOT available**: Node.js built-ins (`fs`, `path`, `http`, `crypto` from Node), `require()`, npm packages.

## Limits

| Resource | Limit |
|----------|-------|
| Code package size | 5 MB |
| Request body | 1 MB |
| CPU time per invocation | 200 ms |
| Language | JavaScript (ES2023+) only |

© edgeone · MIT · TencentEdgeOne/edgeone-makers-tools

Similar skills

SKILL.md skills catalog →

From the same set11

The whole set →
edgeone-makers-cli edgeone-makers-cli — a skill for Claude Code that automates EdgeOne CLI commands for development, build, deploy, and environment management. CX Codex +1 303installs edgeone-makers-cloud-functions edgeone-makers-cloud-functions — a skill for Claude Code and other platforms adds Node.js, Go, and Python runtimes for serverless functions. Runs when building backend logic, server-side APIs, or Express and Koa patterns. CX Codex +1 299installs edgeone-makers-deploy edgeone-makers-deploy — a skill for Claude Code deploys frontend and full-stack projects to Tencent EdgeOne Makers. Activates on release requests, preview deployments, or anonymous publishing without an account. CX Codex +1 285installs edgeone-makers-agents edgeone-makers-agents — a Claude Code skill for building and reviewing AI agent endpoints across five frameworks on EdgeOne Makers. Used when setting up LangGraph routes or configuring SSE streaming responses. CX Codex +1 260installs edgeone-makers-storage edgeone-makers-storage — a skill for Claude Code that configures storage on EdgeOne Makers. Sets up KV for Edge Functions and structures dynamic project data using Blob storage in Cloud Functions. CX Codex +1 250installs edgeone-makers-env-adaption The edgeone-makers-env-adaption Claude Code skill adapts EdgeOne Makers workflows to restricted environments. It activates in WorkBuddy or sandboxed IDEs where CLI prompts stall or network access goes through a proxy. CX Codex +1 249installs edgeone-makers-recipes edgeone-makers-recipes — a skill for Claude Code that generates project structures and templates for EdgeOne Makers apps. CX Codex +1 249installs edgeone-makers-middleware The edgeone-makers-middleware Claude Code skill helps build request middleware for EdgeOne Makers. It covers redirects, URL rewrites, access checks, and edge routing. CX Codex +1 248installs

Project sponsors

Companies that keep this analytics open