Agent skill

Webhooks

by ericrisco in ericrisco/rsc-harness

A skill your agent uses when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min…

MITAuto-check passedBackend & APIs

Install Webhooks

skills CLI
$ npx skills add ericrisco/rsc-harness --skill webhooks -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ericrisco/rsc-harness webhooks --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/webhooks .claude/skills/webhooks && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
webhooks
GitHub stars
156
Token cost
~3.1k tokens
SKILL.md length
1,281 words
Files
6 (incl. scripts, references)
Skills in repo
229
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min…

  • ~5-min replay window
  • SKILL.md covers The pipeline, Verify the signature, Timestamp & replay and Idempotency, plus 4 more sections
  • Runs Shell scripts from its folder; calls stripe; needs WEBHOOK_SECRET
  • Idempotency on the event id

What it does

Webhooks is an agent skill from ericrisco/rsc-harness. Use when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min replay window, idempotency on the event id, fast-ack-then-queue. NOT the Stripe-Signature scheme (that is stripe), NOT outbound clients you call (that is api-connector-builder).

Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `evals/README.md`, `evals/cases.yaml` and `references/framework-raw-body.md`).

It sits in Backend & APIs, covering Webhooks. It works with Stripe. The repository describes itself as: Your agent invents things because it has no memory, and can't touch your database because it has no arms. rsc is the meta-harness that gives it both, plus the trade to know the… The licence is MIT.

When your agent uses it

  • ~5-min replay window
  • Idempotency on the event id
  • Fast-ack-then-queue

Example prompts

  • “/webhooks”

Requirements

  • Python 3
  • A Bash shell
  • A credential in WEBHOOK_SECRET

What it can do on your machine

Read from SKILL.md and the folder at commit 92fde8f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • stripe

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • WEBHOOK_SECRET

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Webhooks loads about 3.1k tokens when it runs, and up to ~4.9k if it reads all its reference files. Until then it costs about 90 tokens; SKILL.md has 1,281 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from ericrisco/rsc-harness at commit 92fde8f, republished under its MIT licence (© ericrisco). 1,281 words, ~3,060 tokens.

Download SKILL.mdSave it as .claude/skills/webhooks/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
webhooks
description
Use when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min replay window, idempotency on the event id, fast-ack-then-queue. NOT the Stripe-Signature scheme (that is stripe), NOT outbound clients you call (that is api-connector-builder).
tags
webhooks, inbound-webhooks, hmac-verification, idempotency, signature-verification, queue, connectors
recommends
stripe, email-connector, api-connector-builder, automation-flows, redis, secure-coding
origin
risco

Webhooks — the inbound front door that survives retries and forgeries

You are building the side of a webhook that receives. Some external system pushes an HTTP POST at your endpoint; your job is to prove it is real, refuse to act on it twice, and answer fast. That is the whole mandate.

This skill is provider-agnostic — it teaches the mechanics every webhook source shares, not any one vendor's event catalog — and it ends at "enqueued." What happens to the event afterward is a different job:

  • The Stripe-specific scheme (Stripe-Signature, t=,v1=, stripe listen, the event model) → ../stripe/SKILL.md.
  • Email bounce/complaint webhooks where the point is suppression state → ../email-connector/SKILL.md.
  • The outbound client that calls someone else's API → api-connector-builder.
  • Multi-step orchestration after the event lands → automation-flows.
  • Broker/queue tuning (BullMQ concurrency, DLQ ops) → redis.
  • Constant-time compare, secret handling, supply-chain hygiene → ../secure-coding/SKILL.md.

The pipeline

These five stages run in exactly this order. Each one exists to protect the one after it; reorder them and you either trust forged data or waste work.

#StageWhy it precedes the next
1Read the raw bodyParsing first destroys the bytes the signature was computed over. Capture the raw buffer before any JSON parse.
2Verify the signatureUntil this passes, every field in the body is attacker-controlled. Verify before you read anything.
3Check the timestamp windowA cheap reject of replayed-but-valid payloads, before you touch a datastore.
4Dedupe on the event idAt-least-once delivery means duplicates are normal. Mark it seen before doing work, not after.
5Persist/enqueue → 2xxHand the event to durable storage, then ack. The ack means "I own this now."

Delivery is at-least-once, never exactly-once. Every major provider retries on non-2xx or timeout, so duplicate deliveries are normal traffic and idempotency is required, not a nice-to-have.

Verify the signature

Verify over the raw bytes, never over re-serialized JSON. Re-serializing a parsed object reorders keys and normalizes whitespace, so the HMAC you compute no longer matches the one the sender computed. This is the single most common cause of "signature fails even though the secret is right."

js
// Bad — body was parsed, so the bytes are gone. HMAC will never match.
app.post("/webhooks", express.json(), (req, res) => {
  const expected = sign(JSON.stringify(req.body)); // reordered, re-spaced
});

// Good — keep the raw buffer for the HMAC; parse only after verifying.
app.post("/webhooks", express.raw({ type: "*/*" }), (req, res) => {
  const raw = req.body; // a Buffer, the exact bytes received
  if (!verify(raw, req.headers)) return res.sendStatus(400);
  const event = JSON.parse(raw.toString("utf8"));
});

Compare signatures in constant time. A normal ===/== short-circuits on the first differing byte, which leaks how much of the signature an attacker guessed correctly. Use crypto.timingSafeEqual (Node) or hmac.compare_digest (Python). The buffers must be equal length, so guard that first.

The cross-vendor Standard Webhooks spec (adopted by Svix, Clerk, Resend, Brex and others) defines the scheme this skill defaults to: headers webhook-id, webhook-timestamp, webhook-signature; the signature is base64(HMAC-SHA256(secret, "{id}.{timestamp}.{body}")), version-prefixed as v1,<sig>, and the header may carry space-separated signatures so a secret can be rotated without dropped deliveries — accept the request if any match.

js
import crypto from "node:crypto";

function verify(raw, headers) {
  const id = headers["webhook-id"];
  const ts = headers["webhook-timestamp"];
  const secret = process.env.WEBHOOK_SECRET; // never a literal
  const signed = `${id}.${ts}.${raw.toString("utf8")}`;
  const expected = crypto
    .createHmac("sha256", Buffer.from(secret, "base64"))
    .update(signed)
    .digest("base64");
  // header is "v1,<sig> v1,<sig2>"; accept if any matches (secret rotation)
  return String(headers["webhook-signature"] || "")
    .split(" ")
    .map((part) => part.split(",")[1])
    .some((sig) => sameLength(sig, expected) &&
      crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)));
}
const sameLength = (a = "", b = "") => a.length === b.length;
python
import hmac, hashlib, base64, os

def verify(raw: bytes, headers) -> bool:
    secret = base64.b64decode(os.environ["WEBHOOK_SECRET"])  # never a literal
    signed = f'{headers["webhook-id"]}.{headers["webhook-timestamp"]}.'.encode() + raw
    expected = base64.b64encode(hmac.new(secret, signed, hashlib.sha256).digest()).decode()
    sent = headers.get("webhook-signature", "")
    for part in sent.split(" "):          # space-separated for rotation
        sig = part.split(",", 1)[-1]
        if hmac.compare_digest(sig, expected):  # constant time
            return True
    return False

Per-provider header formats (Stripe t=,v1=, GitHub X-Hub-Signature-256, Shopify base64 HMAC, Slack v0=, Svix) all map onto the same primitive — mapping table and per-language verify primitives in references/signature-schemes.md.

Timestamp & replay

A valid signature does not stop a replay: an attacker who captures one delivery can re-send the exact bytes, signature intact. Bound it with a timestamp.

Reject any event whose webhook-timestamp is more than ~5 minutes from now. That five-minute window is the de-facto industry value (Benchling and others recommend it). The Standard Webhooks spec mandates that you perform a tolerance check but does not fix the number — pick a small one.

js
const skewSeconds = Math.abs(Date.now() / 1000 - Number(ts));
if (skewSeconds > 300) return res.sendStatus(400); // outside the 5-min window

The timestamp window bounds how long a captured payload is replayable; the idempotency check (next section) stops exact replays that arrive inside the window. You need both — neither alone is enough.

Idempotency

The idempotency key is the provider's stable event id (webhook-id, or for Stripe event.id) — never a hash of the body or your own generated id. Mark it seen before doing the work, so a retry that arrives mid-processing is caught.

Two stores, same idea:

StoreMechanismTTL / lifetime
Relational DBINSERT the event id into a table with a UNIQUE constraint; a duplicate insert throws → skipKeep the row at least as long as the retry window
RedisSET key val NX EX <ttl> — SETNX returns false if already present → skipTTL ≥ the provider's retry window (hours to days)

The dedupe TTL must outlive the provider's entire retry schedule. Retries are exponential and capped — a provider may redeliver hours or days later. If your key expires first, that late retry looks brand-new and you process twice.

js
// Insert-then-process: the UNIQUE insert is the gate. Do work only if we won it.
try {
  await db.query("INSERT INTO seen_events (id) VALUES ($1)", [id]);
} catch (e) {
  if (e.code === "23505") return res.sendStatus(200); // already seen → ack, skip
  throw e;
}
await queue.add("process", { id, event });
res.sendStatus(200);

Prefer insert-then-process over process-then-mark. Marking after the work leaves a window where two concurrent deliveries both pass the "have I seen it?" check and both run. Let the UNIQUE constraint (or NX) be the lock.

Show full SKILL.md (539 more words)Show less

Fast-ack & queue

Heavy synchronous work inside the handler causes provider timeouts and a storm of retries. Return 2xx as soon as the event is durably stored or enqueued, then do the real work in a background worker. The status code is a contract with the sender:

You returnMeaning to the providerUse it when
2xx"I own this now"After enqueue/persist — even if downstream processing later fails. Recover failures from your own queue, not by asking for a redelivery.
4xxPermanent reject, do not retryBad/forged signature (400/401), or a payload you will never accept. A retry of a forged request is still forged.
5xx / timeout"Try again"A genuine transient failure before you took ownership (e.g. the queue itself is down).

Once work is in the queue, handle failures there: bounded retries with backoff, then route exhausted jobs to a dead-letter queue / poison shelf for manual inspection. Do not let a poison event loop forever or block the queue head. Queue/broker tuning itself (concurrency, DLQ wiring) is redis's job.

Framework raw-body recipes

Capturing the raw body is framework-specific and is the usual culprit behind "mismatch though the secret is correct." One line each; full recipes in references/framework-raw-body.md:

  • Express — mount express.raw({ type: "*/*" }) on the webhook route only; do not let a global express.json() consume it first.
  • Next.js App Router — read await req.text() (or req.arrayBuffer()) in the route handler; the App Router does not auto-parse, but await req.json() discards the raw bytes, so verify off the text.
  • FastAPI / Starlette — await request.body() for the raw bytes; do not type the handler param as a Pydantic model (that parses for you).
  • Hono — await c.req.text() before any c.req.json().
  • Serverless (Lambda/Vercel/Cloudflare) — disable body parsing / read the raw stream; base64-decode if the platform wraps the body.

Anti-patterns

Anti-patternWhy it bitesDo instead
HMAC over parsed/re-serialized JSONKey reorder + whitespace break the signature ("works with the right secret but still fails")Verify over the raw bytes captured before parsing
=== / == on the signatureTiming side-channel leaks the secret byte by bytecrypto.timingSafeEqual / hmac.compare_digest
Heavy synchronous work in the handlerProvider times out → retry storm → duplicate processingFast-ack: verify → dedupe → enqueue → 2xx, work in a worker
Ack before persisting/enqueueing2xx means "I own it"; if you crash now the event is lost forever (provider won't retry a 2xx)Persist or enqueue first, then return 2xx
No dedupe / dedupe on a body hashAt-least-once delivery double-processes; body hashes drift across redeliveriesUNIQUE-constraint or SETNX on the provider's stable event id
Dedupe TTL shorter than the retry windowA late retry looks new and runs againTTL ≥ the provider's full retry schedule (hours–days)
Signing secret hard-coded in sourceLeaks in git history; can't rotateRead from env; accept space-separated sigs for rotation
Returning 200 on a bad signatureSilently swallows forged traffic and masks misconfig400/401 on signature failure
Skipping the timestamp checkValid-but-replayed payloads sail throughReject outside the ~5-min window

Verify your handler

scripts/verify.sh is a read-only heuristic linter. Run it from the root of the project that contains your handler; it scans candidate files and prints PASS/WARN/FAIL per invariant (raw-body verify, constant-time compare, timestamp check, secret-from-env, dedupe-on-event-id). A WARN means "I could not find evidence," which on a clean tree is expected and exits 0.

© ericrisco, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in skills/webhooks of ericrisco/rsc-harness.

  • SKILL.md
  • evals/README.md
  • evals/cases.yaml
  • references/framework-raw-body.md
  • references/signature-schemes.md
  • scripts/verify.sh

Open the folder on GitHubat commit 92fde8f

Compare with similar skills

Webhooks next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Webhooks compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Webhooks this skillericrisco/rsc-harness156—~3.1kAutomated safety check: PassMIT
Stripe Appsfossasia/eventyay1.7k1 repos~3.6kAutomated safety check: PassApache-2.0
Stripe Best Practiceskanchengw/cnllm1753 repos~925Automated safety check: PassApache-2.0
Cashier Stripe Developmentluadotsh/lua3421 repos~1.2kAutomated safety check: PassMIT
Stripe Best Practicesfossasia/eventyay1.7k1 repos~1.7kAutomated safety check: PassApache-2.0
Stripe Integrationwshobson/agents40k9 repos~1kAutomated safety check: PassMIT

Similar skills

  • Stripe Apps

    fossasia/eventyay

    A skill your agent uses when building, modifying, or reviewing a Stripe App — or when the user describes something that implies one (e.g.

    1.7k GitHub starsUsed in 1 repo~3.6k tokens
    Backend & APIsAuto-check passed
  • Stripe Best Practices

    kanchengw/cnllm

    Guides Stripe integration decisions — API selection (Checkout Sessions vs PaymentIntents), Connect platform setup (Accounts v2, controller properties), billing/subscriptions, Treasury financial…

    175 GitHub starsUsed in 3 repos~925 tokens
    Backend & APIsAuto-check passed
  • Handles Laravel Cashier Stripe integration including subscriptions, webhooks, Stripe Checkout, invoices, charges, refunds, trials, coupons, metered billing, and payment failure handling.

    342 GitHub starsUsed in 1 repo~1.2k tokens
    Backend & APIsAuto-check passed
  • Stripe Best Practices

    fossasia/eventyay

    Guides Stripe integration decisions across development and test environment planning (separate sandboxes vs the shared test mode sandbox), API selection (Checkout Sessions vs PaymentIntents)…

    1.7k GitHub starsUsed in 1 repo~1.7k tokens
    Backend & APIsAuto-check passed
  • Stripe Integration

    wshobson/agents

    Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks.

    40k GitHub starsUsed in 9 repos~1k tokens
    Backend & APIsAuto-check passed
  • Convex HTTP Actions

    waynesutton/builder-skills

    Adds HTTP endpoints in convex/http.ts: webhook receivers with signature checks, REST style routes, CORS, auth headers, streaming responses, and file uploads over HTTP.

    404 GitHub stars~2.6k tokensUpdated 9 days ago
    Backend & APIsAuto-check passed

More from ericrisco/rsc-harness

All 229 skills in this repo
  • Ab Testing

    ericrisco/rsc-harness

    A skill your agent uses when designing or analyzing a controlled experiment — falsifiable hypothesis, sample size from an MDE, reading significance/CI/power, CUPED, or rescuing tests that won't go…

    156 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Accessibility

    ericrisco/rsc-harness

    A skill your agent uses when making a web UI conform to WCAG 2.2 Level AA — axe-core or Lighthouse a11y violations, keyboard operability, focus management, ARIA roles/names/live regions, contrast…

    156 GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Ads

    ericrisco/rsc-harness

    A skill your agent uses when running or fixing paid acquisition on Google or Meta — campaign structure (Performance Max, Demand Gen, Search, Advantage+), platform-fit creative, budget/scaling rules…

    156 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Agent Eval

    ericrisco/rsc-harness

    A skill your agent uses when measuring whether an LLM or agent system actually got better and gating merges on it: golden sets, fixing an inflated LLM-as-judge, scoring RAG (faithfulness, contextual…

    156 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • AI Media

    ericrisco/rsc-harness

    A skill your agent uses when a creative goal must become a finished media file: pick and order generative-media models per modality — AI voiceover, image-to-video clips, score — then glue them with…

    156 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Analytics

    ericrisco/rsc-harness

    A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.

    156 GitHub stars~2.8k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Webhooks

What does Webhooks do?

A skill your agent uses when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min…. Webhooks is an agent skill from ericrisco/rsc-harness. Use when building the receiving end of a webhook — a provider-agnostic endpoint that proves pushed events are authentic and never processes one twice: raw-body HMAC, ~5-min replay window, idempotency on the event id, fast-ack-then-queue.

When should I use Webhooks?

Webhooks fits situations like: ~5-min replay window; idempotency on the event id; fast-ack-then-queue.

How do I install Webhooks in Claude Code?

Run `npx skills add ericrisco/rsc-harness --skill webhooks -a claude-code`. Or copy the skill folder (skills/webhooks in ericrisco/rsc-harness) into .claude/skills/webhooks in your project. Claude Code loads it when a task matches its description.

How do I install Webhooks in Codex?

Run `npx skills add ericrisco/rsc-harness --skill webhooks -a codex`. Or copy the skill folder (skills/webhooks in ericrisco/rsc-harness) into .agents/skills/webhooks in your project. Codex loads it when a task matches its description.

Can I use Webhooks in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ericrisco/rsc-harness --skill webhooks -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/webhooks, .gemini/skills/webhooks, .github/skills/webhooks and .opencode/skills/webhooks in your project.

What does Webhooks need to run?

Going by SKILL.md and its folder, Webhooks needs a shell for the scripts in its folder, the command-line tools its instructions call (stripe) and credentials named WEBHOOK_SECRET. Our summary lists: Python 3; A Bash shell; A credential in WEBHOOK_SECRET.

Does Webhooks access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Webhooks safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Webhooks use?

Webhooks is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Webhooks use?

About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.8k tokens, read only when the agent opens those files.

What are the alternatives to Webhooks?

Skills that share tags, products or a category with Webhooks: Stripe Apps (fossasia/eventyay, 1.7k stars), Stripe Best Practices (kanchengw/cnllm, 175 stars), Cashier Stripe Development (luadotsh/lua, 342 stars) and Stripe Best Practices (fossasia/eventyay, 1.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Webhooks?

ericrisco (a GitHub user) maintains it in ericrisco/rsc-harness, which has 156 GitHub stars. The repository holds 229 skills in this directory. The repository was last updated on October 6, 2026.

Source: ericrisco/rsc-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.