fastify-hooks-lifecycle

fastify-hooks-lifecycle is a skill for Claude Code from RadOrigin-LLC/RAD-Claude-Skills. It costs 85 tokens per session (3,280 once invoked), scanned A, original, Apache-2.0.

A reference for Fastify hooks, functions that run at specific points while the framework processes a request or starts and stops an application.

In plain words
What is it for?
It helps add authentication and other request processing, choose the right hook, and understand hook order and scope.
Why use it?
It reduces lifecycle bugs such as handlers running twice, lost framework context, or responses being sent more than once.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the rad-fastify plugin — 8 skills, 1 agent shipped together

Good fit It helps add authentication and other request processing, choose the right hook, and understand hook order and scope.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle
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.

Any agent
npx skills add RadOrigin-LLC/RAD-Claude-Skills --skill fastify-hooks-lifecycle
Clone the repo
git clone --depth 1 https://github.com/RadOrigin-LLC/RAD-Claude-Skills

Made for: Claude Code.

Or install rad-fastify, the plugin that ships this one along with the rest of its 8 skills, 1 agent.

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-hooks-lifecycle

README.md
[![agentmods](https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle/github.svg)](https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle)
Your own site
<a href="https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle"><img src="https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fastify-hooks-lifecycle

Your own site · 80×15
<a href="https://agentmods.dev/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle"><img src="https://agentmods.dev/badge/skills/radorigin-llc/rad-claude-skills/fastify-hooks-lifecycle.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,280 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00085 $0.03280
Opus 5 $0.00043 $0.01640
Sonnet 5 $0.00017 $0.00656
Haiku 4.5 $0.00009 $0.00328

Measured 10d ago against content hash 5ef19e364946, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

fastify-hooks-lifecycle 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 10d 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.

archive/plugins/rad-fastify/skills/fastify-hooks-lifecycle/SKILL.md · 218 lines

How it starts

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

Fastify Hook Lifecycle Reference

You are working with Fastify's hook system. Follow every rule in this document precisely. Violations of the critical rules below cause silent double executions, lost context, and runtime exceptions that are difficult to trace.

General Hook Rules (CRITICAL)

Obey these rules in every hook you write. There are no exceptions.

  • NEVER mix async/await with the done callback. If the hook function is declared async, do not accept or call done. If the hook uses done, do not use async or return a Promise. Mixing the two causes double execution of downstream hooks and handlers.
  • NEVER use arrow functions as hook handlers. Arrow functions do not bind this, which means you lose access to the Fastify instance context (this is the encapsulating Fastify server). Always use function declarations or expressions.
  • When you need to short-circuit the request lifecycle from an async hook, call reply.send() and then return reply. If you forget return reply, Fastify continues executing the remaining lifecycle, resulting in double execution and potential "Reply already sent" errors.
  • Hooks can be either global or encapsulated. A hook registered inside a plugin that uses fastify-plugin (which breaks encapsulation) becomes global. A hook registered inside a normal plugin is scoped to that plugin and its children only. Be intentional about which you need.
  • Every hook that accepts a done callback MUST call it. Failing to call done hangs the request indefinitely.
  • Do not perform heavy synchronous work inside hooks. Fastify is single-threaded; blocking the event loop in a hook blocks all concurrent requests.

Request/Reply Hooks (Execution Order)

These hooks execute in the order listed below for every incoming request. Understand exactly where in the lifecycle each hook fires and what data is available at that point.

1. onRequest

This is the first hook that fires, before any parsing occurs.

  • Signature: function (request, reply, done) (or async function (request, reply))
  • request.body is UNDEFINED at this point. The request body has not been parsed yet. Do not attempt to read it.
  • request.params, request.query, and request.headers ARE available.
  • Use this hook for: early authentication checks (e.g., verifying a JWT before doing any work), request logging, IP-based rate limiting, early redirects, and attaching request-scoped metadata.
  • To deny a request, call reply.code(401).send({ error: 'Unauthorized' }) and return reply (in async hooks) or call done(error) (in callback hooks).

Read the full file on GitHub · 218 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. 10d ago First seen · 218 lines · 85 tokens per session scan A 5ef19e364946

Subscribe to this mod's changes

fastify-hooks-lifecycle is a skill published in the GitHub repository RadOrigin-LLC/RAD-Claude-Skills (5 stars, last pushed 24d ago), licensed Apache-2.0. It adds 85 tokens to every session and 3,280 once invoked, about $0.0004 per session on Opus 5. 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.

Related

Other skills, from other repositories

draper-decorators

This skill should be used when the user asks to "create a decorator", "write a decorator", "move logic into decorator", "clean logic out of the view", "isn't it decorator logic", "test a decorator", or mentions Draper, keeping views clean, or representation logic in decorators. Should also be used when editing…

hoblin/claude-ruby-marketplace · 131 tokens

rudder-mcp-workflow

Connects AI agents to RudderStack via MCP tool calls for catalog, sources, destinations, transformations, and live events. Use when connecting an AI agent to RudderStack's MCP server, driving RudderStack via MCP, or mentions of mcp.rudderstack.com.

rudderlabs/rudder-agent-skills · 63 tokens

helius

Skill "helius" from helius-labs/core-ai, covering helius — build on solana, prerequisites, 1. helius mcp server, 2. mcp router surface and 3. api key.

helius-labs/core-ai · 0 tokens

dependency-management

Python dependency and environment management for multi-service or monorepo python backends. Use when: (1) adding, upgrading, or removing a Python package, (2) responding to Dependabot or security vulnerability alerts (GHSA/CVE), (3) creating a new service that needs its own requirements files, (4) debugging pip…

richfrem/agent-plugins-skills · 114 tokens

vibe-domain-extractor

Extracts pure, framework-free, IO-free domain models and deterministic business rules from a rapid prototype with strict preservation vs replacement classification and purity audit enforcement.

richfrem/agent-plugins-skills · 36 tokens

api-contracts

API design and contract engineering — REST resource modelling, error envelopes, pagination, filtering, idempotency, versioning and deprecation, rate limiting, webhooks, OpenAPI, GraphQL schema and N+1 defence, and contract testing. Use when designing, reviewing or documenting an endpoint or integration; when the user…

Kin9Zeus/senior-engineer-skills · 148 tokens