fastify-backend-patterns

fastify-backend-patterns is a skill for Claude Code, Codex from lukasrepublic/agentic-foundry. It costs 0 tokens per session (1,684 once invoked), scanned A, original, MIT.

A set of patterns for building Fastify backends, where Fastify is a Node.js framework for web servers and APIs.

In plain words
What is it for?
Use it when adding API routes, validation schemas, Fastify plugins, database migrations, or queue dispatch from route handlers.
Why use it?
It gives backend changes a consistent structure and requires routes to validate incoming requests and outgoing responses.

Skill for Claude CodeCodex

Part of the foundry plugin — 47 skills, 8 agents, 8 hooks, 1 MCP server shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lukasrepublic/agentic-foundry/fastify-backend-patterns
Any agent
npx skills add lukasrepublic/agentic-foundry --skill fastify-backend-patterns
Clone the repo
git clone --depth 1 https://github.com/lukasrepublic/agentic-foundry

Made for: Claude Code, Codex.

Or install foundry, the plugin that ships this one along with the rest of its 47 skills, 8 agents, 8 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastify-backend-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/lukasrepublic/agentic-foundry/fastify-backend-patterns.svg)](https://agentmods.dev/skills/lukasrepublic/agentic-foundry/fastify-backend-patterns)
Your own site
<a href="https://agentmods.dev/skills/lukasrepublic/agentic-foundry/fastify-backend-patterns"><img src="https://agentmods.dev/badge/skills/lukasrepublic/agentic-foundry/fastify-backend-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,684 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01684
Opus 5 $0.00000 $0.00842
Sonnet 5 $0.00000 $0.00337
Haiku 4.5 $0.00000 $0.00168

Measured 3d ago against content hash c90a87ac9845, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fastify-backend-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packs/stack-profiles/node-web/blueprints/fastify-backend-patterns/SKILL.md · 82 lines

How it starts

The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When to trigger

  • Implementing a spec that names api work in the backend package.
  • Authoring a new route handler (GET/POST/PUT/PATCH/DELETE) for a resource.
  • Adding or modifying schema validation (request body, query params, response shape).
  • Writing a new Fastify plugin (encapsulating a service, middleware, or feature module).
  • Authoring a DB migration in the api migrations directory.
  • Wiring a queue producer-side dispatch from a route handler.

Procedure

  1. Place the route file under src/routes/<resource>/<verb>.ts per the package convention. Register the route via a Fastify plugin encapsulated in src/routes/<resource>/index.ts (or per the existing folder structure — read src/routes/ before adding new files).

  2. Declare request and response schemas using Fastify's schema-validator integration (Zod or TypeBox per the project convention). Attach schemas to the route options object: { schema: { body: BodySchema, response: { 200: SuccessSchema, 4xx: ErrorSchema } } }. No unvalidated routes.

  3. Register route via Fastify plugin: wrap route registrations in fastify.register(async function(instance) { instance.get(...) }). Plugin scope ensures encapsulation of prefix, decorators, and hooks.

  4. Error handler: return a structured { error: string, code: string } (or the project's error shape) rather than throwing untyped errors. Use fastify.setErrorHandler at the plugin level for domain-specific error mappings. Never throw a raw JS Error from a route handler — map it to an HTTP status code with a structured body.

  5. DB migration: place the migration file in migrations/<timestamp>-<slug>.sql (or the migration-tool format the project uses). Migrations are append-only and reversible — include a down migration or add a -- no-op down: <reason> comment. Never edit a landed migration.

  6. Queue producer dispatch: follow the bullmq-jobs skill's producer pattern. Add a // dispatched-to: <queue-name> comment at each queue.add() call site so the consumer is traceable from the producer.

Read the full file on GitHub · 82 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 82 lines · 0 tokens per session scan A c90a87ac9845

Subscribe to this mod's changes

fastify-backend-patterns is a skill published in the GitHub repository lukasrepublic/agentic-foundry (1 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,684 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.