AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Fastify Best Practices

skill-andrewsrigom-agent-skills-fastify-best-practices · by andrewsrigom

Use when building, organizing, or debugging Fastify applications. Covers plugins, routes, schemas, hooks, errors, auth boundaries, logging, testing, and deployment decisions for Fastify backends.

No reviews yet
0 installs
45 views
0.0% view→install

Install

$ agentstack add skill-andrewsrigom-agent-skills-fastify-best-practices

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-andrewsrigom-agent-skills-fastify-best-practices)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Fastify Best Practices? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Fastify Best Practices

Use this skill for Fastify-specific architecture and implementation choices.

Scope

  • app bootstrapping and plugin boundaries
  • route organization and schema-first handlers
  • request lifecycle hooks and decorators
  • auth, cookies, sessions, CORS, and security headers
  • testing with inject()
  • logging, performance, and deployment decisions

Default path

  1. Confirm whether the task is about app structure, a single route, a plugin, or runtime behavior.
  2. Keep the app split by plugin boundary, not by random file size.
  3. Define request and response schemas before handler logic when validation matters.
  4. Prefer decorators and plugins for shared behavior instead of utility imports passed everywhere.
  5. Use hooks intentionally:
  • onRequest for auth and cheap request guards
  • preHandler for work that depends on parsed input
  • onSend only when the response must be shaped late
  1. Keep handlers thin and move business logic behind a service boundary when the route starts doing orchestration.
  2. Test route behavior with fastify.inject() before introducing network-level tests.

When to deviate

  • Keep a route local and simple only when it truly has no reusable boundary.
  • Use heavier lifecycle hooks only when cheaper ones cannot express the requirement.
  • Move to auth skill when the main challenge becomes OAuth or token/session design.

Guardrails

  • Prefer Fastify plugins and encapsulation over global mutable state.
  • Treat schemas as part of the contract, not optional documentation.
  • Do not scatter auth logic across handlers if the same rule can live in a hook or plugin.
  • Keep logger usage structured. Do not rely on string-only logs for important events.
  • Register plugins in a deterministic order when one plugin depends on another.
  • Avoid doing expensive work in decorators or plugin registration if it can happen lazily at request time.

Avoid

  • using global mutable state instead of plugin encapsulation
  • pushing orchestration into handlers that should stay thin
  • scattering schemas away from the route contract
  • choosing hooks by habit instead of request-lifecycle cost

Verification checklist

  • plugin boundaries are intentional
  • schemas are part of the route contract
  • hook choice matches the lifecycle need
  • handlers stay thin
  • route behavior can be tested with inject()

Common Routing Cues

  • routes, handlers, fastify.register, plugin encapsulation, decorators, hooks, schemas, serializer, inject(), Pino, auth hooks, @fastify/*

Output Shape

When answering with this skill, prefer:

  • the recommended plugin or route shape
  • the right lifecycle hook for the job
  • where schemas belong
  • what should be tested
  • what should stay out of handlers

Official Docs

  • https://fastify.dev/docs/latest/
  • https://fastify.dev/docs/latest/Reference/Plugins/
  • https://fastify.dev/docs/latest/Reference/Routes/
  • https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/
  • https://fastify.dev/docs/latest/Guides/Testing/

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.