function-dev

function-dev is a skill for Claude Code, Codex from butterbase-ai/butterbase-skills. It costs 37 tokens per session (2,889 once invoked), scanned B, original, MIT.

A guide for building, deploying, and troubleshooting Butterbase serverless functions. A serverless function is backend code that runs on demand without you managing a permanent server.

In plain words
What is it for?
Use it for webhooks, scheduled jobs, custom API endpoints, and other backend logic running on Butterbase's Deno environment.
Why use it?
It provides the required request-handling shape and covers common backend concerns such as database access, secrets, scheduled work, and safely retrying webhooks.

Skill for Claude CodeCodex

Part of the butterbase-skills plugin — 23 skills, 33 commands shipped together

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/butterbase-ai/butterbase-skills/function-dev
Any agent
npx skills add butterbase-ai/butterbase-skills --skill function-dev
Clone the repo
git clone --depth 1 https://github.com/butterbase-ai/butterbase-skills

Made for: Claude Code, Codex.

Or install butterbase-skills, the plugin that ships this one along with the rest of its 23 skills, 33 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for function-dev

README.md
[![agentmods](https://agentmods.dev/badge/skills/butterbase-ai/butterbase-skills/function-dev.svg)](https://agentmods.dev/skills/butterbase-ai/butterbase-skills/function-dev)
Your own site
<a href="https://agentmods.dev/skills/butterbase-ai/butterbase-skills/function-dev"><img src="https://agentmods.dev/badge/skills/butterbase-ai/butterbase-skills/function-dev.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,889 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00037 $0.02889
Opus 5 $0.00018 $0.01444
Sonnet 5 $0.00007 $0.00578
Haiku 4.5 $0.00004 $0.00289

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

Security

Grade B, and why

function-dev scanned grade B with 1 finding 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 4d 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.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

const response = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST",
skills/function-dev/SKILL.md · 439 lines

How it starts

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

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:

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:

return new Response(JSON.stringify({ message: "ok" }), {
  status: 200,
  headers: { "Content-Type": "application/json" }
});

Wrong (will fail):

return { status: 200, body: "ok" };  // NOT a Response object!

2. Trigger Types

HTTP Trigger

Invoke the function via an HTTP request.

{
  "trigger": {
    "type": "http",
    "config": { "method": "POST", "path": "/my-endpoint", "auth": "required" }
  }
}

Auth options:

  • "required" — request must include a valid JWT; ctx.user is always set
  • "optional" — JWT is parsed if present; ctx.user may be null
  • "none" — public endpoint; no auth needed; ctx.user is always null

Cron Trigger

Execute the function on a schedule.

{
  "trigger": {
    "type": "cron",
    "config": { "schedule": "0 9 * * *", "timezone": "UTC" }
  }
}

Read the full file on GitHub · 439 lines

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. 4d ago First seen · 439 lines · 37 tokens per session scan B 7370189b44d1

Subscribe to this mod's changes

function-dev is a skill published in the GitHub repository butterbase-ai/butterbase-skills (533 stars, last pushed 2mo ago), licensed MIT. It adds 37 tokens to every session and 2,889 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (sends data to an external url). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

butterbase

AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.

butterbase-ai/butterbase · 34 tokens

run402

Provision Postgres + REST API + auth + content-addressed storage + serverless functions + email — paid with x402 USDC on Base. Prototype tier is free on testnet. Use when the user asks to build a webapp, deploy a site, create a database, generate images, or mentions Run402.

kychee-com/run402 · 67 tokens

run402-buzz

Complete Run402 onboarding for a managed Buzz agent with a dedicated wallet/public identity link, report independent human-adoption and community-installation state, offer bounded per-agent enrollment before provisioning, and stop only at a real approval or repair boundary. Use when a managed Buzz user says "install…

kychee-com/run402 · 119 tokens

bugs

Automated bug triage and fix pipeline. Fetches open GitHub Issues, performs root cause analysis, writes failing tests, fixes bugs in isolated worktrees, and publishes. Use when the user says /bugs, "check for bugs", "triage bugs", or "fix reported issues".

kychee-com/run402 · 61 tokens

run402

Provision Postgres + REST API + auth + content-addressed storage + serverless functions + email — paid with x402 USDC on Base. Prototype tier is free on testnet.

kychee-com/run402 · 40 tokens

verification

Full catalog of this repo's verification, test, fuzz, bench, and operator commands, plus which test suites are gated behind Minio, credentials, Postgres, or Workerd. Use when a needed command is not in CLAUDE.md's resident table, when a test is skipping and the reason is unclear, or when running benches, mutation…

Gusto/baerly-storage · 87 tokens