Install
$ agentstack add skill-andrewsrigom-agent-skills-fastify-best-practices ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →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
- Confirm whether the task is about app structure, a single route, a plugin, or runtime behavior.
- Keep the app split by plugin boundary, not by random file size.
- Define request and response schemas before handler logic when validation matters.
- Prefer decorators and plugins for shared behavior instead of utility imports passed everywhere.
- Use hooks intentionally:
onRequestfor auth and cheap request guardspreHandlerfor work that depends on parsed inputonSendonly when the response must be shaped late
- Keep handlers thin and move business logic behind a service boundary when the route starts doing orchestration.
- 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.
- Author: andrewsrigom
- Source: andrewsrigom/agent-skills
- License: MIT
- Homepage: https://andrewsrigom.github.io/agent-skills/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.