webhook-handler-patterns
Best practices for webhook handlers. Use when implementing the handler sequence (verify first, parse second, handle idempotently), idempotency, error handling, retry logic, out-of-order or replayed events, or framework-specific issues with Express, Next.js, or FastAPI.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install hookdeck-webhook-handler-patternsManual setup by platform
Claude Code
~/.claude/skills/hookdeck-webhook-handler-patterns/SKILL.md
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Instructions
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
- Handling events that arrive out of order or are replayed after an outage
- Understanding framework-specific gotchas (raw body, middleware order)
- Building production-ready webhook infrastructure
Resources
Handler Sequence
- references/handler-sequence.md - Verify first, parse second, handle idempotently third
Best Practices
- references/idempotency.md - Prevent duplicate processing
- references/error-handling.md - Return codes, logging, dead letter queues
- references/retry-logic.md - Provider retry schedules, backoff patterns
- references/ordering.md - Handle out-of-order and replayed events safely
Framework Guides
- references/frameworks/express.md - Express.js patterns and gotchas
- references/frameworks/nextjs.md - Next.js App Router patterns
- references/frameworks/fastapi.md - FastAPI/Python patterns
Quick Reference
Handler Sequence
- Verify signature first — Use raw body; reject invalid requests with 4xx.
- Parse payload second — After verification, parse or construct the event.
- Handle idempotently third — Check event ID, then process; return 2xx for duplicates.
See references/handler-sequence.md for details and links to provider verification and idempotency patterns.
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
- Extract unique event ID from payload
- Check if event was already processed
- Process event within transaction
- Store event ID after successful processing
- Return success for duplicate events
Related Skills
- stripe-webhooks - Stripe payment webhook handling
- shopify-webhooks - Shopify e-commerce webhook handling
- github-webhooks - GitHub repository webhook handling
- resend-webhooks - Resend email webhook handling
- chargebee-webhooks - Chargebee billing webhook handling
- clerk-webhooks - Clerk auth webhook handling
- elevenlabs-webhooks - ElevenLabs webhook handling
- openai-webhooks - OpenAI webhook handling
- paddle-webhooks - Paddle billing webhook handling
- hookdeck-event-gateway - Webhook infrastructure that replaces your queue — guaranteed delivery, automatic retries, replay, rate limiting, and observability for your webhook handlers
Security
Reviews (0)
Related skills
Browse all →More from Hookdeck
View source →More Build skills
Browse category →Frequently asked questions about webhook-handler-patterns
What does the webhook-handler-patterns skill do?
Best practices for webhook handlers. Use when implementing the handler sequence (verify first, parse second, handle idempotently), idempotency, error handling, retry logic, out-of-order or replayed events, or framework-specific issues with Express, Next.js, or FastAPI. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the webhook-handler-patterns skill?
Run `npx @skills-hub-ai/cli install hookdeck-webhook-handler-patterns` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/hookdeck-webhook-handler-patterns/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does webhook-handler-patterns work with?
webhook-handler-patterns runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the webhook-handler-patterns skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use webhook-handler-patterns after installing it?
In Claude Code, type `/hookdeck-webhook-handler-patterns` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the webhook-handler-patterns skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.