function-dev
Use when developing, deploying, or debugging Butterbase serverless functions, or when the user needs to add backend logic like webhooks, scheduled jobs, or custom API endpoints
npx skills add butterbase-ai/butterbase-skills --skill function-dev --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Serverless Function Development on Butterbase Guide for developing and deploying serverless functions on Butterbase's Deno runtime. Covers handler signatures, trigger types, database access, environment variables, and testing. --- ## 1. Handler Signature Every function exports a single `handler` function with this signature: ```typescript export async function handler( request: Request, context: { db: PostgresClient, // RLS-aware DB client env: Record<string, string>, // env vars set on the function user: { id: string } | null, // present for HTTP+auth:required; null for cron waitUntil: (p: Promise<unknown>) => void, // background work after Response (≤30s) idempotency: { claim: (key: string, opts?: { scope?: string; ttlSeconds?: number }) => Promise<boolean> } // atomic dedup for webhook retries } ): Promise<Response> ``` **CRITICAL**: The handler MUST return `new Response()` (Web API standard). Do NOT return plain objects. **Correct:** ```typescript return new Response(JSON.stringify({ message: "ok" }), { status: 200, headers: { "Content-Type": "application/json" } }); ``` **Wrong (will fail):** ```typescript return { status: 200, body: "ok" }; // NOT a Response object! ``` ---
- 1. Handler Signature
- 2. Trigger Types
- HTTP Trigger
- Cron Trigger
- WebSocket Trigger
- S3 Upload Trigger (placeholder — not yet implemented)
- 3. Database Access
- SELECT
- INSERT
- UPDATE
- RLS Behavior by Invocation Type
- 4. Environment Variables
- 5. Complete Working Examples
- Example 1 — Protected API Endpoint (auth: required)
What does the function-dev skill do?
Use when developing, deploying, or debugging Butterbase serverless functions, or when the user needs to add backend logic like webhooks, scheduled jobs, or custom API endpoints
How do I install it?
Run `npx skills add butterbase-ai/butterbase-skills --skill function-dev --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From butterbase-ai/butterbase-skills, a repository with 532 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.