How this skill is triggered — by the user, by Claude, or both
Slash command
/netlify-functions:netlify-functionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
---
Scaffold and implement production-ready Netlify Functions with built-in security, error handling, and TypeScript support. From quick prototypes to production APIs.
A Netlify Function is a small piece of server code that runs when someone visits a specific URL. Think of it as a "mini server" that:
Example: A contact form that sends an email. Without a function, the frontend would need to expose an email API key. With a function, the key stays on the server, hidden from users.
Step 1 — Create the file:
netlify/functions/hello.ts
Step 2 — Write the handler:
// Netlify Functions v2 — Web API standard (recommended)
export default async (req: Request) => {
const name = new URL(req.url).searchParams.get("name") || "World";
return new Response(
JSON.stringify({ message: `Hello, ${name}!` }),
{ headers: { "Content-Type": "application/json" } }
);
};
Step 3 — Add a clean URL in netlify.toml:
[[redirects]]
from = "/api/hello"
to = "/.netlify/functions/hello"
status = 200
Now accessible at: https://your-site.netlify.app/api/hello?name=Claude
npx netlify dev
# → http://localhost:8888/api/hello?name=Claude
| Type | Use Case | Trigger | Example |
|---|---|---|---|
| API endpoint | REST operations | HTTP request | User CRUD, search |
| Webhook | External service callback | External POST | Stripe payment, GitHub push |
| Scheduled | Periodic background task | Cron schedule | Daily cleanup, cache refresh |
| Background | Long-running async work | HTTP (returns immediately) | Image processing, email batch |
To create a new production-ready function:
[Step 1] Determine Type
- API / Webhook / Scheduled / Background
- HTTP methods needed (GET, POST, etc.)
- Authentication required?
[Step 2] Generate Handler
- Create file in netlify/functions/
- Apply handler template (see Patterns below)
- Add TypeScript types for request/response
[Step 3] Configure Routing
- Add redirect in netlify.toml
- Set allowed methods
- Configure cache headers
[Step 4] Add Security
- CORS configuration
- Input validation
- Auth middleware (if protected)
- Environment variable checks
[Step 5] Register
- Update .netlify-fn/registry.json (if exists)
- Document the endpoint
Reusable wrapper handling CORS, method checking, body parsing, and error responses. See references/handler-patterns.md for full implementation.
Signature-verified webhook receiver for Stripe, GitHub, Apple, Slack. See references/handler-patterns.md.
Background tasks with @netlify/functions Config export. See references/handler-patterns.md.
Token verification middleware for Supabase, Firebase, Auth0, Clerk, JWT. See references/handler-patterns.md.
Consistent error response utility. See references/handler-patterns.md.
For netlify.toml routing, TypeScript setup, and environment variable management, see references/configuration.md.
This skill learns project-specific patterns over time.
netlify/functions/ for patternsnetlify.toml.netlify-fn/ directory with:
registry.json: inventory of all functions (name, type, route, auth requirement)patterns.json: detected conventions (middleware stack, error codes, auth provider).netlify-fn/patterns.json to match project styleIf multiple functions share boilerplate, suggest extraction:
Detected: 4 functions manually checking auth headers
Suggestion: Extract to netlify/functions/lib/auth.ts
Detected: 3 functions with identical CORS setup
Suggestion: Use createHandler() wrapper from lib/handler.ts
Detected: Inconsistent error response format across functions
Suggestion: Adopt errorResponse() from lib/errors.ts
Before deploying any function:
* for authenticated endpoints* CORS for authenticated endpoints: Whitelist specific originsnetlify/functions/lib/netlify dev before deploying to productionreferences/handler-patterns.md: Full implementation code for the createHandler wrapper, error response utility, webhook signature verification (Stripe, GitHub, generic HMAC), scheduled function (cron), and auth middleware by provider (Supabase, Firebase, Custom JWT). Copy-paste ready TypeScript.references/configuration.md: netlify.toml routing examples, TypeScript configuration, and environment variable management.security-best-practices: General web security patterns (complements function security)supabase-automation: Database operations often called from Netlify Functionsapi-design: REST API design principles for function endpointsnpx claudepluginhub jhyeok5/claude-plugin-marketplace --plugin netlify-functionsGuide for writing Netlify serverless functions: API endpoints, background processing, scheduled tasks, streaming, and method routing with modern syntax and TypeScript.
Validates build configuration, redirects, environment variables, and deployment readiness for deploying static sites or serverless functions to Netlify.
Deploys sites to Netlify using netlify-cli in GitHub Actions workflows. Covers monorepo errors, pnpm workspaces, netlify.toml inheritance, and deploy URL capture.