netlify-functions

Write Netlify serverless functions using modern default export and Config syntax.

1|Updated May 13, 2026
One-click install
npx skills add https://github.com/SyedArmanAli2003/AgroNaV --skill netlify-functions-syedarmanali2003
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netlify-functions
Source: https://github.com/SyedArmanAli2003/AgroNaV/tree/main/.agents/skills/netlify-functions
Command: npx skills add https://github.com/SyedArmanAli2003/AgroNaV --skill netlify-functions-syedarmanali2003

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @netlify/functions.

What problem does it solve? Writing serverless functions on Netlify involves many syntax variants, routing options, and configuration choices, and outdated patterns like the legacy exports.handler still circulate widely. This Skill provides authoritative guidance for building Netlify Functions with the current recommended patterns, avoiding deprecated syntax and misconfiguration. ## Core Features & Use Cases - Modern Function Syntax: Enforces the default export plus Config pattern with TypeScript, covering path routing, method routing, and path parameters via context.params. - Specialized Function Types: Covers background functions (15-minute tasks), scheduled cron functions, streaming responses, and platform event handlers for deploy and identity lifecycles. - Configuration Guardrails: Provides opinionated defaults for region, memory, and vCPU settings so resources are only overridden when justified. - Use Case: A developer building a Vite + React SPA needs a backend API endpoint and a nightly data-sync job. This Skill guides creation of a routed API function at /api/items/:id and a scheduled function running @daily, both using correct modern syntax. ## Quick Start Write a Netlify serverless function in TypeScript that handles GET and POST requests at the path /api/items using the modern default export and Config pattern.

Frequently Asked Questions about netlify-functions

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

FAQPage Schema
How do I write a Netlify serverless function in TypeScript?

Export a default async function receiving a standard Request and Netlify Context, and export a Config object for routing. Place the file in netlify/functions/ with a .ts extension and return a standard Response object.

How do I create a scheduled cron function on Netlify?

Set the schedule property in the exported Config object using a shortcut like @daily or a cron expression such as "0 * * * *". Scheduled functions run in UTC, have a 30-second timeout, and only execute on published deploys.

What is the difference between Netlify background functions and regular functions?

Background functions run up to 15 minutes and return an immediate 202 response to the client, while synchronous functions time out at 60 seconds. Enable background mode by setting background: true in the config export.

Should I use exports.handler or default export for Netlify Functions?

Use the modern default export with a Config object; the legacy exports.handler pattern is deprecated. The default export receives a Web API Request and returns a Response, with routing defined via the config export.

When should I write raw Netlify Functions instead of framework routes?

Write raw Netlify Functions for client-side-only frameworks like Vite + React SPAs, for background or scheduled tasks, or for standalone API endpoints. Frameworks like Next.js or Astro generate their own functions via adapters.

What are the resource limits for Netlify Functions?

Synchronous functions time out at 60 seconds, background functions at 15 minutes, and scheduled functions at 30 seconds. Memory defaults to 1024 MB (configurable up to 4096 MB), with 6 MB buffered and 20 MB streamed payload limits.