edge-functions

A guide for building Supabase Edge Functions, which are server-side programs that run in the Deno runtime and communicate with outside services.

In plain words
What is it for?
Creating or debugging webhooks, third-party API calls, service-to-service requests, scheduled jobs, and MCP servers or tools exposed by an app.
Why use it?
It clarifies where outbound requests belong and how to handle webhooks, retries, errors, secrets, and scheduled work. It keeps external communication out of database code.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/tomaspozo/agentlink/edge-functions
Any agent
npx skills add tomaspozo/agentlink --skill edge-functions
Clone the repo
git clone --depth 1 https://github.com/tomaspozo/agentlink

Made for: Claude Code, Codex.

Per session 133 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,243 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00133 $0.03243
Opus 5 $0.00067 $0.01622
Sonnet 5 $0.00027 $0.00649
Haiku 4.5 $0.00013 $0.00324

Measured 2d ago against content hash 573fdcb72c29, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

edge-functions scanned grade A with 0 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/edge-functions/SKILL.md · 213 lines

How it starts

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

Edge Functions

Edge Functions handle everything that needs to talk to the outside world — webhooks, third-party APIs, scheduled triggers, service-to-service calls. They are not for CRUD or business logic (that belongs in database functions via RPCs).

Outbound HTTP always runs in an edge function — this is not a choice

Any request to a URL outside Postgres — pinging a monitored endpoint, calling a third-party API, hitting an LLM, sending a webhook — runs in an edge function, driven by cron + a queue. Never make the outbound request from in-database pg_net. This is settled architecture: don't surface it as a decision to the user, don't ask "edge function worker vs. in-database pg_net" — the answer is always the edge function.

  • pg_net (net.http_post) is only the trigger transport: pg_cronpublic._internal_admin_call_edge_function(...) makes one HTTP call to wake an edge function. That is its entire sanctioned role. It is never the HTTP client for business logic — no per-row fetches, no fan-out to third parties, no response handling in SQL.
  • Why the edge function wins every time: it gets timeouts, retries, redirect handling, secrets, real error handling, observability, and the Deno ecosystem. pg_net is fire-and-forget from inside a transaction with none of that — N outbound calls from SQL tie up the database and silently drop failures.

Canonical flow for "do work against the outside world on a schedule":

pg_cron (e.g. every 1m)
  └─ public._internal_admin_call_edge_function('internal-<worker>')   ← pg_net's ONLY job: one call to wake the worker
       └─ edge fn: RPC to fetch the due set (api._admin_… reads the queue / due rows)
       └─ edge fn: fetch each external URL (timeout, redirects, retries)
       └─ edge fn: RPC to write results back

For bursty or per-item work, enqueue into PGMQ (api.agentlink_tasks) and let internal-queue-worker drain it — cron just wakes the worker. See the database cron + queue conventions, and recipes.md for full worked examples (scheduled URL pinger, queued email, periodic sync). For sending app-driven (non-auth) email specifically, use the notifications skill — it rides this same queue via api._admin_send_emailinternal-send-email.

Read the full file on GitHub · 213 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 213 lines · 133 tokens per session scan A 573fdcb72c29

Subscribe to this mod's changes

edge-functions is a skill published in the GitHub repository tomaspozo/agentlink (6 stars, last pushed 1mo ago), licensed MIT. It adds 133 tokens to every session and 3,243 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

kagent-dev

Development guide for kagent's v1alpha3 Harness and AgentTemplate CRDs, AgentInstance gRPC control plane, upstream A2A integration, Substrate runtime provisioning, tests, generation, and PR workflow. Use for any implementation, debugging, review, or CI task in the kagent repository.

kagent-dev/kagent · 65 tokens

timoni

Use when deploying applications to Kubernetes with Timoni. Covers installing and upgrading module instances from OCI registries, composing multi-app deployments with bundles, injecting values from clusters or CI with runtimes, targeting multiple clusters, and authoring, testing, signing and publishing modules with CUE.

stefanprodan/timoni · 59 tokens

azmon-mirroredcatalogs-operations-cli

Brings Azure Monitor, Application Insights, and Log Analytics telemetry into Fabric as Eventhouse external delta tables and correlates it with business data. Use to onboard observability data, judge whether latency or availability affected revenue, or build a Real-Time dashboard and Operations Agent over it.

microsoft/skills-for-fabric · 66 tokens

durable-objects

Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases…

cloudflare/skills · 76 tokens

ship-web-games

Package, deploy, and verify a playable Three.js or web game. Use for release builds, asset delivery, private/public deployment, production smoke tests, browser proof, release notes, rollback readiness, and cleanup of temporary QA resources.

MengTo/Skills · 50 tokens

terraform-search-import

Discover existing cloud resources using Terraform Search queries and bulk import them into Terraform management. Use when bringing unmanaged infrastructure under Terraform control, auditing cloud resources, or migrating to IaC.

hashicorp/agent-skills · 39 tokens