Skip to content
Agentmart
Submit a tool

netlify-typescript-api

Use when designing or implementing TypeScript backend APIs on Netlify, including handler structure, validation, typed contracts, error envelopes, and testable…

Skill by prachwal-archive

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/prachwal-archive-netlify-typescript-api

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when designing or implementing TypeScript backend APIs on Netlify, including handler structure, validation, typed contracts, error envelopes, and testable request/response flow.

Use cases: backend, cloud

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/netlify-typescript-api

What's inside

Skill name
netlify-typescript-api
Description
Use when designing or implementing TypeScript backend APIs on Netlify, including handler structure, validation, typed contracts, error envelopes, and testable request/response flow.
License
MIT
Instructions
58 lines in SKILL.md · view on GitHub

Files (4)

  • SKILL.md
  • contract-design.md · references/
  • handler-patterns.md · references/
  • testing.md · references/

SKILL.md (first lines)

# Netlify TypeScript API Skill

Use this skill when building a backend API in TypeScript for Netlify Functions or Netlify-compatible serverless routes after the execution primitive has already been chosen.

## Core goals

- Keep handlers small, deterministic, and easy to test.
- Separate transport concerns from business logic.
- Make request and response shapes explicit.
- Fail fast on invalid input and return consistent error payloads.
- Stay on the current Netlify Functions API instead of the older Lambda event object unless a legacy integration requires compatibility mode.

## Recommended structure

- `src/models/` for shared types, schemas, and domain rules.
- `src/services/` for database and external API adapters.
- `netlify/functions/` for the deployed function entrypoints.
- `src/lib/` for shared helpers such as parsing, errors, and logging.
- `src/contracts/` for route-level request and response types when the API surface is non-trivial.

## Platform facts that change implementation

- The current handler shape is `export default async (req: Request, context: Context) => Response`.
- Use `context.params` for path params, `new URL(req.url)` for query params, and `Netlify.env.get()` for runtime env values.
- Execution-model choices belong in `netlify-serverless`.

## Implementation rules

- Use TypeScript end-to-end and avoid `any`.
- Treat `req.json()` as untrusted input and validate it before it reaches services.
- Validate all untrusted input at the edge.
- Return stable JSON envelopes for success and failure.
- Keep framework-specific code out of business logic.
- Prefer small composable helpers over large monolithic handlers.
- Return `Response` objects directly and use `Response.json()` for JSON payloads.
- Use `context.waitUntil()` only for truly non-blocking work such as audit logs or metrics emission.
- Keep secret policy and storage choice in the dedicated database skills.

## Reference files

### [`references/handler-patterns.md`](references/handler-patterns.md)
**Handler structure and method guards** — Canonical handler with method guard → auth → GET/POST branches, path params via `context.params`, `apiSuccess`/`apiError` response envelope helpers, safe `req.json()` with `.catch(() => null)`, `requireAuth()` JWT helper pattern, rules for validation order and request ID inclusion.

### [`references/contract-design.md`](references/contract-design.md)
**API contracts and versioning** — Typed `ApiSuccess<T>`/`ApiCollection<T>`/`ApiError` envelopes, `ok()`/`collection()`/`err()` builders with `satisfies`, error code constants, path-based versioning with `Deprecation`/`Sunset` headers, idempotency key pattern for retryable writes, security response headers.

### [`references/testing.md`](references/testing.md)
**Unit and integration testing** — Full vitest handler test with `Request` constructor (GET list, GET by ID, POST create, validation failure, malformed JSON, 401, 405), `vi.mock` of service and auth layers, `vitest.config.ts` for Node environment, `curl`-based `netlify dev` smoke tests, test coverage target table.

## External references

- Pair with [../netlify-serverless/SKILL.md](../netlify-serverless/SKILL.md) for execution-model choices.
- Pair with [../netlify-database-security/SKILL.md](../netlify-database-security/SKILL.md) when the handler touches persistent data.
- [Get started with functions](https://docs.netlify.com/functions/get-started/)
- [Serverless Functions API reference](https://docs.netlify.com/build/functions/api/)
- [Environment variables and functions](https://docs.netlify.com/functions/environment-variables/)

From prachwal-archive/web-ui-skills, MIT.

More from prachwal-archive/web-ui-skills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Apr 9, 2026 (6 months ago)
Last release
Apr 23, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from prachwal-archive

Cite this page

netlify-typescript-api skill. Agent Mart. https://agentmart.dev/skills/prachwal-archive-netlify-typescript-api (last updated 2026-10-24)