webhook-handler-patterns

webhook-handler-patterns is a skill for Claude Code from martineserios/thebrana. It costs 52 tokens per session (677 once invoked), scanned A, original, MIT.

A guide for building webhook handlers, which are server endpoints that receive event messages from other services. It follows the order: verify the message, read its contents, then process it safely once.

In plain words
What is it for?
Use it when implementing webhook receivers with Express, Next.js, or FastAPI, including message verification, duplicate-event protection, error handling, and retry behavior.
Why use it?
It helps avoid accepting forged messages, processing the same event repeatedly, or mishandling failures and provider retries.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Part of the brana plugin — 53 skills, 4 commands, 14 agents shipped together

Good fit Use it when implementing webhook receivers with Express, Next.js, or FastAPI, including message verification, duplicate-event protection, error handling, and retry behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/martineserios/thebrana/webhook-handler-patterns
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 martineserios/thebrana --skill webhook-handler-patterns
Clone the repo
git clone --depth 1 https://github.com/martineserios/thebrana

Made for: Claude Code.

Or install brana, the plugin that ships this one along with the rest of its 53 skills, 4 commands, 14 agents.

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 webhook-handler-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/martineserios/thebrana/webhook-handler-patterns/github.svg)](https://agentmods.dev/skills/martineserios/thebrana/webhook-handler-patterns)
Your own site
<a href="https://agentmods.dev/skills/martineserios/thebrana/webhook-handler-patterns"><img src="https://agentmods.dev/badge/skills/martineserios/thebrana/webhook-handler-patterns/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 webhook-handler-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/martineserios/thebrana/webhook-handler-patterns"><img src="https://agentmods.dev/badge/skills/martineserios/thebrana/webhook-handler-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 677 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.00052 $0.00677
Opus 5.5 $0.00021 $0.00271
Sonnet 5.5 $0.00010 $0.00135
Haiku 4.5 $0.00005 $0.00068

Measured 1mo ago against content hash 07eb771a3753, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

webhook-handler-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 1mo 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.

system/skills/acquired/webhook-handler-patterns/SKILL.md · 69 lines

How it starts

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

Webhook Handler Patterns

When to Use This Skill

  • Following the correct webhook handler order (verify → parse → handle idempotently)
  • Implementing idempotent webhook handlers
  • Handling errors and configuring retry behavior
  • Understanding framework-specific gotchas (raw body, middleware order)
  • Building production-ready webhook infrastructure

Resources

Handler Sequence

  • references/handler-sequence.md (upstream references/handler-sequence.md, not installed locally) - Verify first, parse second, handle idempotently third

Best Practices

  • references/idempotency.md (upstream references/idempotency.md, not installed locally) - Prevent duplicate processing
  • references/error-handling.md (upstream references/error-handling.md, not installed locally) - Return codes, logging, dead letter queues
  • references/retry-logic.md (upstream references/retry-logic.md, not installed locally) - Provider retry schedules, backoff patterns

Framework Guides

  • references/frameworks/express.md (upstream references/frameworks/express.md, not installed locally) - Express.js patterns and gotchas
  • references/frameworks/nextjs.md (upstream references/frameworks/nextjs.md, not installed locally) - Next.js App Router patterns
  • references/frameworks/fastapi.md (upstream references/frameworks/fastapi.md, not installed locally) - FastAPI/Python patterns

Quick Reference

Handler Sequence

  1. Verify signature first — Use raw body; reject invalid requests with 4xx.
  2. Parse payload second — After verification, parse or construct the event.
  3. Handle idempotently third — Check event ID, then process; return 2xx for duplicates.

Response Codes

Code Meaning Provider Behavior
2xx Success No retry
4xx Client error Usually no retry (except 429)
5xx Server error Retry with backoff
429 Rate limited Retry after delay

Idempotency Checklist

  1. Extract unique event ID from payload
  2. Check if event was already processed
  3. Process event within transaction
  4. Store event ID after successful processing
  5. Return success for duplicate events

Read the full file on GitHub · 69 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. 1mo ago First seen · 69 lines · 52 tokens per session scan A 07eb771a3753

Subscribe to this mod's changes

webhook-handler-patterns is a skill published in the GitHub repository martineserios/thebrana (3 stars, last pushed yesterday), licensed MIT. It adds 52 tokens to every session and 677 once invoked, about $0.0002 per session on Opus 5.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.