supabase-edge-functions

Develop Supabase Edge Functions with TypeScript and Deno runtime constraints.

55|5|Updated Feb 1, 2024
One-click install
npx skills add https://github.com/MakePrisms/agicash --skill supabase-edge-functions-makeprisms
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: supabase-edge-functions
Source: https://github.com/MakePrisms/agicash/tree/main/.claude/skills/supabase-edge-functions
Command: npx skills add https://github.com/MakePrisms/agicash --skill supabase-edge-functions-makeprisms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Supabase Edge Functions guidelines help developers write secure, efficient, and maintainable edge function code for Supabase projects.

Core Features & Use Cases

  • Use Web APIs and Deno core APIs instead of external dependencies to keep functions lean.
  • Centralize shared utilities under supabase/functions/_shared and import via relative paths to minimize cross-dependencies.
  • Use explicit versioned imports (npm: or jsr:) for external dependencies and avoid bare specifiers.
  • Prefer npm: and jsr: for external imports; minimize deno.land/x usage.
  • Use Node built-ins with node: specifiers when needed for compatibility.
  • Do not rely on deno.land/std http server; use Deno.serve and a simple router if needed.
  • Supabase pre-populates essential environment variables; manage others with supabase secrets.
  • Route design: prefix routes with /function-name to ensure correct routing.
  • File writes are restricted to /tmp and long-running tasks should use EdgeRuntime.waitUntil.
  • Example templates show common edge function structures and patterns.

Quick Start

Create a new edge function under supabase/functions and implement at least one route following the guidelines.

Frequently Asked Questions about supabase-edge-functions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure imports in Supabase Edge Functions?▼

Structure Supabase Edge Functions imports by using explicit versioned npm: or jsr: specifiers for external dependencies and relative paths for shared utilities. Avoid bare specifiers and minimize deno.land/x usage to keep functions lean and maintainable.

What is the best way to handle routing for Supabase Edge Functions?▼

The best way to handle routing in Supabase Edge Functions is to prefix routes with /function-name to ensure correct routing. Use Deno.serve and a simple router instead of relying on the deno.land/std http server.

Can I use Node built-ins and Web APIs in Deno Edge Functions on Supabase?▼

Yes, you can use Node built-ins in Supabase Edge Functions by importing them with node: specifiers. Prefer Web APIs and Deno core APIs instead of external dependencies to keep your functions lightweight.

Where can I write files during long-running Supabase Edge Function tasks?▼

File writes in Supabase Edge Functions are restricted to the /tmp directory. For long-running background tasks, use EdgeRuntime.waitUntil to manage them effectively without blocking the function execution.

How do I manage environment variables for Supabase Edge Functions?▼

Manage environment variables for Supabase Edge Functions using supabase secrets. Supabase automatically pre-populates essential environment variables, while custom secrets must be configured explicitly through the CLI.