
Netlify Functions
If you're writing serverless functions on Netlify, this walks you through the modern default export pattern (not the old exports.handler), path routing, background jobs, scheduled tasks, and streaming responses. It's most useful when you're building standalone APIs or adding background processing to static sites. If you're using a framework like Next.js or SvelteKit, you probably won't need this since those generate their own functions through adapters. The coverage of the Context object and environment variable handling (Netlify.env, not process.env) is solid. Good reference for timeout limits and when to use the background function suffix pattern.
- skills.sh installs
- 3.5K
- GitHub stars
- 51
- last updated
- Aug 21, 2026
Install
$ npx -y skills add netlify/context-and-tools --skill netlify-functions --agent claude-codeInstalls into .claude/skills of the current project.
Files
Netlify Functions
Reach for the modern default-handler API (.mts TypeScript). Export a default async handler taking a web Request and a Netlify Context, returning a web Response. Avoid the legacy AWS Lambda handler shape unless writing Go or migrating old code (see Legacy at the end).
File locations
- Default directory:
netlify/functions/(relative to base directory). Keep it outside your publish directory or source files ship as static assets. - A function is one file or a subdirectory whose entry file is named
indexor matches the subdirectory name. All of these create a functionhello:netlify/functions/hello.mtsnetlify/functions/hello/hello.mtsnetlify/functions/hello/index.mts
- Use
.mts(TS) /.mjs(JS) for ES modules..cts/.cjsforce CommonJS;.ts/.jsfollow the nearestpackage.json"type".
Sponsors
Details
- Repository
- github.com/netlify/context-and-tools
- Categories
- Backend & APIs, Documentation, Cloud & Infrastructure
- First seen
- Jun 3, 2026