Skilllibrary webhooks-events
Design inbound webhook handling and event delivery flows with signature verification, quick acknowledgement, idempotency, and replay-safe processing. Use this when working on webhook receivers, event envelopes, queue fanout, or provider callback behavior. Do not use for generic REST endpoints that do not receive external event delivery.
git clone https://github.com/merceralex397-collab/skilllibrary
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/09-backend-api-and-data/webhooks-events" ~/.claude/skills/merceralex397-collab-skilllibrary-webhooks-events && rm -rf "$T"
09-backend-api-and-data/webhooks-events/SKILL.mdPurpose
Use this skill to keep webhook handling safe under duplicate delivery, slow downstream processing, and unverifiable payloads.
When to use this skill
Use this skill when:
- implementing or reviewing inbound webhook receivers from third-party providers
- designing internal event envelopes, replay flow, dead-letter handling, or queue fanout after receipt
- debugging duplicate events, signature mismatches, delayed acknowledgements, or missing replay safety
Do not use this skill when
- the task is a normal synchronous REST endpoint with no external event delivery semantics
- the main issue is only retry tuning or telemetry, not event receipt and processing flow
- a narrower active skill already owns a different transport, such as websocket session state
Operating procedure
-
Define the inbound contract. Identify provider event types, signature headers, timestamp fields, unique delivery IDs, and acknowledgement expectations before touching handler code.
-
Verify before trust. Validate signatures and basic envelope shape before mutating internal state. Treat unverifiable or malformed events as hostile input. Example: Stripe webhooks use
header with HMAC-SHA256 of the raw body. GitHub usesStripe-Signature
.X-Hub-Signature-256 -
Acknowledge quickly, process asynchronously. Keep the public receiver small. Persist or enqueue work, return the provider-required acknowledgement, then perform slower business logic off the critical path where possible.
-
Make duplicate delivery safe. Use provider delivery IDs or application-level idempotency keys so retries and replay tooling do not create duplicate side effects.
-
Preserve replay and triage paths. Capture enough metadata to re-run a delivery, inspect failures, and reconcile missing downstream effects without asking the provider to guess what happened.
Decision rules
- Signature verification and delivery ID handling are part of correctness, not optional hardening.
- Prefer durable enqueue or persistence before expensive downstream calls when provider timeouts are tight.
- Keep event envelopes versionable and explicit; do not let random payload blobs become the only contract.
- If a provider retries aggressively, assume your receiver will see duplicates and out-of-order arrivals.
Output requirements
Inbound ContractAck and Processing FlowSignature and Replay ControlsVerification
Scripts
: sign or verify webhook payloads with HMAC-SHA256 for local test fixtures and receiver checks.scripts/webhook_signature.py
References
Read these only when relevant:
references/inbound-signature-verification.mdreferences/delivery-and-idempotency.mdreferences/replay-debugging-checklist.md
Related skills
rate-limits-retriesobservability-loggingbackground-jobs-queues
Anti-patterns
- Processing webhook payload before verifying the signature.
- Blocking on slow business logic before returning
to the provider.200 - Storing webhook body in application logs instead of a durable queue.
- Trusting webhook source IP without signature verification.
- No dead-letter or replay mechanism for failed processing.
Failure handling
- If the provider documentation is incomplete, say exactly which assumptions are inferred and keep the receiver conservative.
- If the current design performs business logic before verification or acknowledgement, call that out as a delivery risk immediately.
- If the real issue is retry budget or telemetry, hand off to the adjacent skill after preserving the webhook-specific constraints.