/ship-ready-skills:stripe-webhook-reviewfrom ship-ready-skills
Review Next.js Stripe webhook route handlers for missing signature verification, JSON parsed before verification, missing or non-status-aware idempotency on event.id (pending/completed), unsafe reprocessing of pending events, and billing periods read from items.data[0]. Use when the user asks to review a Stripe webhook, idempotency, duplicate events, or payments before launch.
Ships in ship-ready-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Read-only review. Don't edit files unless the user asks for the fixes afterwards.
Find the handlers: grep -rl "constructEvent\|stripe-signature\|webhooks" app/ src/ pages/ (route handlers under app/api/**/route.ts or pages/api/**). Read each one and the helpers it calls (claim/complete functions, sync functions).
For each finding, give file:line, the check id, severity, and the fix.
| Id | Severity | Look for | Fix |
|---|---|---|---|
| S1 | critical | No stripe.webhooks.constructEvent(...) (or constructEventAsync) before the event is trusted | Verify constructEvent(rawBody, signature, secret) first; return 400 on failure. |
| S2 | critical | await request.json() (or a parsed body) used before or instead of the raw body | const body = await request.text() and pass that string to constructEvent. |
| S3 | medium | event.id never recorded (no stripe_events/processed-events table) | Record event.id (unique) before processing; see the idempotency rule below. |
| S6 | medium | Dedupe without status: any already-seen event.id returns 200 (e.g. on 23505), or claim-then-delete | A first attempt that failed or crashed is lost forever. Use the pending/completed rule below. |
| S7 | low | Billing period read from subscription.items.data[0] | Since API 2025-03-31.basil, periods live on subscription items; items.data[0] is only right for single-item subscriptions. Use the item whose price grants the entitlement. |
Record event.id in stripe_events with status = 'pending'. On a unique violation (23505), read the row: if completed, return 200 and stop; if still pending, process it again. That is only safe when overlapping deliveries can't double-apply work: handlers must be idempotent upserts keyed on Stripe ids, or the row must be claimed atomically with a lease, for example:
update stripe_events set locked_until = now() + interval '5 minutes'
where id = $1 and status = 'pending' and (locked_until is null or locked_until < now());
-- skip if no row was claimed
so a crashed attempt can be reclaimed later. Give side effects such as emails or credit grants their own dedupe key. Set status = 'completed' only after processing (or enqueueing) succeeds. If processing fails, return 5xx so Stripe retries.
When you see pending events being reprocessed, check the handlers: flag it only if they do non-idempotent work (inserts without a unique key, emails, credit grants) with no lease and no dedupe key.
export const runtime = "edge" on the webhook route: prefer the Node.js runtime for the Stripe SDK.client_reference_id is fine when your server set it at checkout; a client-supplied user id is only a finding when the server doesn't verify it.These are heuristics: each finding is a prompt to review, not proof of a vulnerability.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub edtrackai/ship-ready-skills --plugin ship-ready-skills5 skills in this plugin
/launch-security-checkQuick pre-launch security check for Next.js + Supabase + Stripe apps. Finds public tables without row level security, service-role or secret keys reaching client code (NEXT_PUBLIC_ variables, 'use client' files), and Stripe webhook handlers without constructEvent signature verification. Use when the user asks for a launch, ship or go-live security check, or a quick security pass on a Supabase/Stripe app./supabase-grants-checkCheck Supabase migrations for the security side of the 30 Oct 2026 Data API grants change (Supabase's changelog schedules it) - GRANT ALL or write grants to anon, grants on tables with RLS off, policies whose role has no grant (42501), grants with no policy, SECURITY DEFINER functions anon can execute, default privileges that still auto-grant, and the local auto_expose_new_tables setting. Use when the user asks about Supabase grants, a 42501 permission-denied error, the 30 October change, or whether a GRANT fix is safe./supabase-rls-reviewReview Supabase SQL migrations for row level security gaps and missing or blanket Data API grants (tables without RLS, using (true) write policies, anon write policies, security definer functions without search_path, public tables with no explicit GRANT (Supabase's changelog schedules a grants change for 30 Oct 2026), blanket grants to anon/authenticated). Use when the user asks to review RLS, Supabase policies, grants, a 42501 error, or database security before launch./unthrottled-route-checkFind Next.js API routes that call OpenAI, Anthropic or the Vercel AI SDK, or create a Stripe Checkout Session, with no rate limiter. Use when the user asks about rate limiting, AI cost per user, surprise API bills, refresh loops at checkout, or abuse protection before launch.