home / skills / phrazzld / claude-config / stripe-audit

stripe-audit skill

/skills/stripe-audit

This skill performs a comprehensive Stripe integration audit, identifying misconfigurations, security gaps, and business-model mismatches to deliver actionable

npx playbooks add skill phrazzld/claude-config --skill stripe-audit

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.7 KB
---
name: stripe-audit
description: |
  Comprehensive audit of existing Stripe integration.
  Checks configuration, code patterns, security, and business model alignment.
---

# Stripe Audit

Deep analysis of an existing Stripe integration.

## Objective

Find everything that's wrong, suboptimal, or drifted. Produce actionable findings.

## Process

**1. Spawn the Auditor**

This is a deep analysis. Spawn the `stripe-auditor` subagent to do the heavy lifting in parallel. It has read-only access and preloaded Stripe knowledge.

**1.5. Check Environment**

Before any CLI operations, verify environment parity:
```bash
~/.claude/skills/stripe/scripts/detect-environment.sh
```

If mismatch detected, fix before proceeding. Resources created in wrong account won't be visible to app.

**2. Run Automated Checks**

Execute the audit script for quick wins:
```bash
~/.claude/skills/stripe/scripts/stripe_audit.sh
```

This catches:
- Hardcoded keys
- Missing env vars
- Webhook signature verification
- Mode-dependent parameter errors

**3. Deep Analysis Areas**

The auditor should examine:

**Configuration**
- Env vars set on all deployments?
- Cross-platform parity (Vercel ↔ Convex)?
- No trailing whitespace in secrets?
- Test keys in dev, live keys in prod?

**Local Development**
- Does `pnpm dev` auto-start `stripe listen`?
- If yes, is there a sync script that captures the ephemeral secret?
- Script uses `--print-secret` flag?
- Secret synced to correct target (Convex env or .env.local)?

**Webhook Health**
- Endpoints registered correctly?
- URL returns non-3xx on POST?
- Recent events delivered (pending_webhooks = 0)?
- Signature verification present and FIRST?

**Subscription Logic**
- Trial handling uses Stripe's `trial_end`?
- Access control checks subscription status correctly?
- Edge cases handled (cancel during trial, resubscribe, out-of-order webhooks)?
- Idempotency on webhook processing?

**Security**
- No hardcoded keys in source?
- Secrets not logged?
- Error responses don't leak internal details?

**Business Model**
- Single pricing tier?
- Trial completion honored on upgrade?
- No freemium/feature-gating logic?

**Subscription Management UX** (per `stripe-subscription-ux`)
- Settings page with subscription section?
- Current plan and status displayed?
- Next billing date shown?
- Payment method on file displayed?
- "Manage Subscription" button (Stripe Portal)?
- Billing history accessible?
- Appropriate messaging for all states?

**4. Validate with Thinktank**

For complex findings, run them through Thinktank for multi-expert validation. Billing bugs are expensive.

## Output

Structured findings report:

```
STRIPE AUDIT REPORT
==================

CONFIGURATION
✓ Env vars set on dev
✗ STRIPE_WEBHOOK_SECRET missing on prod
⚠ Webhook URL returns 307 redirect

WEBHOOK HEALTH
✓ Endpoints registered
✗ 3 events with pending_webhooks > 0

SUBSCRIPTION LOGIC
✓ Uses trial_end
⚠ Missing idempotency check

SECURITY
✓ No hardcoded keys
✓ Signature verification present

LOCAL DEVELOPMENT
✓ Auto-starts stripe listen
✗ No webhook secret auto-sync

BUSINESS MODEL
✓ Single tier
✗ Trial not passed on mid-trial upgrade

SUBSCRIPTION MANAGEMENT UX
✓ Settings page exists
✓ Plan name displayed
✗ No payment method shown
✗ No billing history
⚠ Portal button exists but return_url missing

---
SUMMARY: 8 pass, 3 warn, 5 fail

CRITICAL:
- Set STRIPE_WEBHOOK_SECRET on prod
- Fix webhook URL redirect

HIGH:
- Implement trial_end pass-through

MEDIUM:
- Add webhook idempotency
```

## Research First

Before auditing, check current Stripe best practices. What was correct last year might be deprecated now. Use Gemini to verify against current documentation.

Overview

This skill performs a comprehensive audit of an existing Stripe integration to surface configuration issues, security gaps, webhook problems, subscription logic bugs, and product/UX mismatches. It produces a structured, actionable report with prioritized remediation steps. The goal is to find anything wrong, suboptimal, or drifted and recommend concrete fixes.

How this skill works

The skill runs an automated checklist to detect obvious issues (hardcoded keys, missing env vars, webhook signature checks, mode-dependent parameters) and then performs deeper inspections of configuration, webhook health, subscription flows, local dev setup, security practices, and billing UX. For complex or high-risk findings it validates conclusions via a thinktank-style review. The output is a human-readable audit report with PASS/WARN/FAIL markers and prioritized recommendations.

When to use it

  • Before a major release that touches billing or customer access
  • When migrating environments or changing deployment platforms
  • After noticing missed webhooks, billing errors, or customer access regressions
  • When you lack confidence in subscription state handling or idempotency
  • As a periodic health check for production Stripe integrations

Best practices

  • Ensure environment parity: same vars present across dev, staging, and prod
  • Verify webhook signature verification is implemented and runs first
  • Avoid hardcoded API keys and never log secret values
  • Implement idempotent webhook handlers and robust retry handling
  • Sync ephemeral local webhook secrets into local env securely
  • Show billing state and payment method clearly in the app and link to Stripe Portal

Example use cases

  • Audit a startup’s Stripe integration before launching paid subscriptions
  • Validate webhooks and subscription logic after moving to a new hosting platform
  • Detect leaked keys, missing env vars, or webhook URL redirects causing failures
  • Review subscription UX to ensure customers can manage billing and see next invoice
  • Confirm trial handling and upgrade behavior to prevent revenue leakage

FAQ

Will the audit modify live resources or keys?

No. The audit runs read-only checks and automated scans; it only flags issues and recommends changes.

Can this detect ephemeral local webhook secrets?

Yes. The audit checks whether local dev sync scripts capture and persist ephemeral webhook secrets to the correct local targets.