supabase-edge-functions
Deploy and manage Supabase Edge Functions. Use for invoking serverless functions, deploying new functions, and managing function deployments.
What this skill does
# Supabase Edge Functions
## Overview
This skill provides operations for working with Supabase Edge Functions - serverless TypeScript/JavaScript functions that run on Deno Deploy. Use for invoking functions, deploying code, and managing function lifecycles.
## Prerequisites
**Required environment variables:**
```bash
export SUPABASE_URL="https://your-project.supabase.co"
export SUPABASE_KEY="your-anon-or-service-role-key"
```
**Required tools:**
- Supabase CLI (`supabase` command)
- Deno (for local development)
**Install Supabase CLI:**
```bash
# macOS
brew install supabase/tap/supabase
# Linux
curl -fsSL https://github.com/supabase/cli/releases/latest/download/supabase_linux_amd64.tar.gz | tar -xz
sudo mv supabase /usr/local/bin/
# Windows (PowerShell)
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase
```
**Helper script:**
This skill uses the shared Supabase API helper for invoking functions:
```bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
```
## Invoke Edge Functions
### Basic Invocation
**Invoke a function with POST:**
```bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
FUNCTION_NAME="hello-world"
supabase_post "/functions/v1/${FUNCTION_NAME}" '{
"name": "Alice"
}'
```
**Invoke with GET:**
```bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
FUNCTION_NAME="get-data"
supabase_get "/functions/v1/${FUNCTION_NAME}?id=123"
```
### Invoke with Headers
**Pass custom headers:**
```bash
FUNCTION_NAME="authenticated-function"
USER_TOKEN="user-access-token"
curl -s -X POST \
"${SUPABASE_URL}/functions/v1/${FUNCTION_NAME}" \
-H "apikey: ${SUPABASE_KEY}" \
-H "Authorization: Bearer ${USER_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"action": "process"}'
```
### Invoke with Authentication
**Invoke function as authenticated user:**
```bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
FUNCTION_NAME="user-profile"
ACCESS_TOKEN="user-jwt-token"
curl -s -X POST \
"${SUPABASE_URL}/functions/v1/${FUNCTION_NAME}" \
-H "apikey: ${SUPABASE_KEY}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{}'
```
## Function Management (CLI)
### Initialize Function
**Create a new edge function:**
```bash
# Navigate to your Supabase project directory
cd /path/to/project
# Create new function
supabase functions new my-function
# This creates: supabase/functions/my-function/index.ts
```
### Function Template
**Basic function structure:**
```typescript
// supabase/functions/my-function/index.ts
import { serve } from "https://deno.land/[email protected]/http/server.ts"
serve(async (req) => {
const { name } = await req.json()
const data = {
message: `Hello ${name}!`,
}
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
})
```
**Function with authentication:**
```typescript
import { serve } from "https://deno.land/[email protected]/http/server.ts"
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
serve(async (req) => {
// Get JWT from Authorization header
const authHeader = req.headers.get('Authorization')!
const token = authHeader.replace('Bearer ', '')
// Create Supabase client with user's token
const supabase = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
{ global: { headers: { Authorization: authHeader } } }
)
// Get authenticated user
const { data: { user }, error } = await supabase.auth.getUser(token)
if (error || !user) {
return new Response('Unauthorized', { status: 401 })
}
return new Response(
JSON.stringify({ message: `Hello ${user.email}!` }),
{ headers: { "Content-Type": "application/json" } },
)
})
```
### Deploy Function
**Deploy a function to Supabase:**
```bash
# Login to Supabase (first time only)
supabase login
# Link to your project (first time only)
supabase link --project-ref your-project-ref
# Deploy specific function
supabase functions deploy my-function
# Deploy with custom environment variables
supabase functions deploy my-function \
--env-file ./supabase/.env.local
# Deploy all functions
supabase functions deploy
```
### Set Environment Variables
**Set secrets for edge functions:**
```bash
# Set individual secret
supabase secrets set MY_SECRET_KEY=value123
# Set multiple secrets from file
# Create .env file:
# API_KEY=abc123
# DATABASE_URL=postgres://...
supabase secrets set --env-file .env
# List secrets (names only, not values)
supabase secrets list
# Unset secret
supabase secrets unset MY_SECRET_KEY
```
### Local Development
**Run functions locally:**
```bash
# Start local Supabase (includes edge functions)
supabase start
# Serve functions locally
supabase functions serve
# Serve specific function
supabase functions serve my-function --env-file ./supabase/.env.local
# Invoke local function
curl http://localhost:54321/functions/v1/my-function \
-H "Authorization: Bearer ${SUPABASE_KEY}" \
-d '{"name": "test"}'
```
### Delete Function
**Remove a deployed function:**
```bash
# Delete function from Supabase dashboard or using SQL
# Note: No direct CLI command to delete, must use dashboard
# Remove local function file
rm -rf supabase/functions/my-function
```
## Common Patterns
### Invoke and Process Response
```bash
#!/bin/bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
FUNCTION_NAME="process-data"
response=$(supabase_post "/functions/v1/${FUNCTION_NAME}" '{
"action": "calculate",
"values": [1, 2, 3, 4, 5]
}')
if [[ $? -eq 0 ]]; then
result=$(echo "$response" | jq -r '.result')
echo "Function result: $result"
else
echo "Function invocation failed"
exit 1
fi
```
### Batch Function Invocations
```bash
#!/bin/bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
FUNCTION_NAME="send-email"
RECIPIENTS=("[email protected]" "[email protected]" "[email protected]")
for email in "${RECIPIENTS[@]}"; do
echo "Processing $email..."
supabase_post "/functions/v1/${FUNCTION_NAME}" '{
"to": "'"$email"'",
"subject": "Hello",
"body": "Test message"
}'
echo "✓ Sent to $email"
done
```
### Function with Retry Logic
```bash
#!/bin/bash
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/supabase-api.sh"
invoke_with_retry() {
local function_name="$1"
local payload="$2"
local max_retries=3
local retry_count=0
while [[ $retry_count -lt $max_retries ]]; do
if response=$(supabase_post "/functions/v1/${function_name}" "$payload" 2>&1); then
echo "$response"
return 0
else
retry_count=$((retry_count + 1))
echo "Retry $retry_count/$max_retries..." >&2
sleep 2
fi
done
echo "Function failed after $max_retries retries" >&2
return 1
}
# Use it
invoke_with_retry "my-function" '{"action": "process"}'
```
### Deploy Function Script
```bash
#!/bin/bash
# deploy-function.sh
FUNCTION_NAME="${1:-my-function}"
echo "Deploying function: $FUNCTION_NAME"
# Validate function exists
if [[ ! -d "supabase/functions/$FUNCTION_NAME" ]]; then
echo "Error: Function $FUNCTION_NAME not found"
exit 1
fi
# Deploy
if supabase functions deploy "$FUNCTION_NAME"; then
echo "✓ Deployed successfully"
# Test invocation
echo "Testing function..."
response=$(curl -s -X POST \
"${SUPABASE_URL}/functions/v1/${FUNCTION_NAME}" \
-H "apikey: ${SUPABASE_KEY}" \
-H "Content-Type: application/json" \
-d '{}')
echo "Test response: $response"
else
echo "✗ Deployment failed"
exit 1
fi
```
### Monitor Function Logs
```bash
# View function logs (requires Supabase CLI)
supabase functions logs my-function
# Follow logs in real-time
supabase functions logs my-fRelated in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.