← ClaudeAtlas

vibe.commerce-patternslisted

E-commerce domain patterns — cart management, payment processing (Toss/Stripe/PG), inventory tracking, and order state machines with transaction safety. Use when implementing any shopping cart, checkout flow, payment integration, stock management, or order lifecycle. Covers idempotency keys, double-charge prevention, stock reservation, and refund flows. Must use this skill when the codebase involves e-commerce — even for seemingly simple 'add to cart' features.
su-record/vibe · ★ 0 · AI & Automation · score 78
Install: claude install-skill su-record/vibe
# Commerce Patterns ## Pre-check (K1) > Is this an e-commerce transaction flow? If building simple CRUD without payment/stock management, this skill is not needed. ## Gotchas & Traps These are the non-obvious failure modes LLMs typically miss: ### Payment | Trap | Consequence | Prevention | |------|-------------|------------| | No idempotency key | User double-clicks → charged twice | `idempotencyKey: order_${orderId}_${timestamp}` on every payment request | | Webhook not idempotent | Retry delivers duplicate events | Check `eventId` before processing, store processed events | | Missing webhook signature verification | Attacker forges payment confirmation | Always verify HMAC signature before processing | | No payment state machine | Order stuck in limbo | `PENDING → PROCESSING → AUTHORIZED → CAPTURED → COMPLETED` (+ FAILED, CANCELED, REFUNDED) | ### Inventory | Trap | Consequence | Prevention | |------|-------------|------------| | Non-atomic stock decrement | Race condition → negative stock | `UPDATE SET stock = stock - $1 WHERE stock >= $1` (atomic with check) | | No reservation TTL | Stock locked forever on abandoned checkout | 15-min reservation + scheduled cleanup job | | Commit without reservation | Stock sold twice | Two-phase: RESERVE (checkout start) → COMMIT (payment success) / RELEASE (failure) | | Optimistic lock without retry | Fails silently under contention | Use `version` column or `FOR UPDATE` for high-contention products | ### Cart & Pricing | Tra