Skip to content

netlify-functions

Write, configure, and deploy Netlify serverless functions in TypeScript, JavaScript, or Go. Use this when adding an API endpoint or backend route, adding a

— (0 ratings) 3.7K downloads netlify
$ npx skills add https://github.com/netlify/context-and-tools --skill netlify-functions

Skills can run code on your computer. Review the source before installing. This listing is community-made and isn't affiliated with Anthropic.

About this skill

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).

Building an app's backend? Start with Netlify Server, a long-lived server that holds connections open and keeps state between requests; use functions alongside it for individual tasks, scheduled jobs, and events. See When to use a server.

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 index or matches the subdirectory name. All of these create a function hello:
    • netlify/functions/hello.mts
    • netlify/functions/hello/hello.mts
    • netlify/functions/hello/index.mts
  • Use .mts (TS) / .mjs (JS) for ES modules. .cts/.cjs force CommonJS; .ts/.js follow the nearest package.json "type".

⚠️ Same-name JS and TS files: the JS one wins. If the functions directory has e.g. items.js and items.ts, the JavaScript function is deployed and the TypeScript file is silently ignored — edits to the .ts have no effect. Keep one file per function name; delete or rename the stale .js when moving a function to TypeScript.

Minimal function


Installs: 3.7K | GitHub stars: 57 | First seen: Feb 27, 2026

Related skills

New

Coding & dev tools

hyperframes-cli

CLI toolkit for scaffolding, validating, previewing, and rendering HyperFrames video compositions.

New • 1.8M
New

Coding & dev tools

improve-codebase-architecture

Analyze codebases for architectural friction and propose module-deepening refactors as testability improvements.

New • 1.3M
New

Coding & dev tools

tdd

Test-driven development with vertical slices, behavior-focused tests, and incremental red-green-refactor cycles.

New • 1.3M