| name | business-logic-audit |
| description | Reviews existing business code (billing, multi-tenancy, state machines, inventory, GL postings, audit logs, etc.) for missing real-world edge cases. Severity-graded findings — invariant violations, race conditions, missing idempotency, currency precision bugs, audit gaps, jurisdiction issues. |
/business-logic-audit
Audit a feature or module for the edge cases that break in production. Different from /review-pr (which reviews diffs) — this skill walks code that's already shipped and looks for the failure modes the original implementer missed.
When to use
- Before scaling a feature to higher traffic / bigger customers / new regions.
- After an incident touched a business invariant.
- Before a SOC 2 / PCI / HIPAA audit.
- When taking ownership of someone else's code that handles money or regulated data.
- When a competitor's incident shows a class of failure you haven't checked for.
Operating method
1. Lock down scope
Ask:
- What feature / module / domain? Be specific — "the checkout flow," "subscription billing," "inventory reservation," "multi-tenant search."
- What's the worst-case failure? Lost charge, double charge, leaked tenant data, audit fail, etc. We'll prioritize the audit around it.
- What's the deployment context? Dev / staging / prod. Some checks (rate limits, tax) only matter in prod.
2. Walk the relevant edge-case checklist
For each finding, classify by category and severity. Categories below — pick the ones that apply.
Money handling
State machines
Multi-tenancy
Idempotency
Concurrency
Audit & compliance
API contracts
Webhooks (outgoing)
Time
File handling
Sessions & auth
ERP-specific (skip if N/A)
Marketplace-specific (skip if N/A)
3. Verify, don't guess
For each item, read the code (or run a query, or check a config) before marking it. The no-hallucination rule applies — never claim "✅ this is implemented" without showing where.
For findings, cite the file and line range.
4. Severity grading
- Critical — invariant violation, money loss, data leak, regulatory breach. Fix before next release.
- High — likely incident under realistic load. Fix in current sprint.
- Medium — quality issue that compounds. Fix soon.
- Low — defense-in-depth. Track for later.
5. Compare to competitors (optional)
For categories where prior art is well-known (billing dunning, RBAC, search), include a one-line note: "Stripe handles failed payments via 4 retries / 15 days; we have 1 retry / immediate suspend, which is harsh for SMB customers."
If the user wants a deeper comparison, suggest running /competitive-analysis afterward.
Output format
## Scope
- Feature audited: <name>
- Worst-case failure considered: <description>
- Files reviewed: <list with line ranges>
## Findings (severity-ordered)
### Critical (N)
1. <category> — <issue>. <file:line>. **Fix:** <one-paragraph fix>.
2. …
### High (N)
…
### Medium (N)
…
### Low (N)
…
## What's good (specific, not generic)
- <thing 1>
- <thing 2>
## Comparison to prior art (if relevant)
- <our pattern> vs <competitor pattern> — for context only.
## Recommended next action
1. <highest-leverage critical fix — start here>
2. …
Boundaries
- Verify every claim with code, query, or config. Don't say "this is missing" without showing it's missing.
- Don't audit categories that don't apply. ERP-specific items on a SaaS app are noise.
- Don't recommend infinite complexity. Match recommendations to project stage (pre-launch, scaling, mature).
- Cite competitor patterns when borrowing recommendations. Don't say "industry standard is X" without naming who.
- Flag legal questions for the user, don't decide them. "Your retention period of 90 days may not meet US tax law's 7-year requirement — confirm with your accountant" is right; "you must use 7 years" is overreach.