BosskuAI Business Logic Review
Use this skill when the main risk is incorrect workflow rules, not syntax errors or UI polish.
How this differs from nearby skills
bosskuai-rigorous-code-review: catches implementation bugs and code quality issues; load alongside when a code diff may encode wrong rules.bosskuai-diagnose-loop: reproduces, isolates and fixes a known bug or slow path; load when a specific defect is already suspected.bosskuai-product-strategy: defines what the rules should be; this skill audits what they actually are.bosskuai-cybersecurity-risk: checks whether rules can be exploited; load alongside when auth, permissions, or financial logic is involved.
Concrete examples (hidden logic failures)
Use these as patterns to hunt for in any domain — they are not exhaustive.
Fulfillment without payment verification — Orders move to
SHIPPEDor digital entitlements activate whenpayment_statusis stillPENDINGor when only a client-side “success” page is shown. Webhook delay or PSP failure leaves inventory or access granted without settled funds.Partial cancellation, full charge — User removes line items from a subscription or cart after a billing job runs; the next invoice still uses stale quantities or proration is skipped because cancel and bill are separate cron paths with no shared invariant check.
Concurrent inventory oversell — Two checkouts pass “stock > 0” reads and both decrement; no transactional guard or idempotent reservation, so sellable quantity goes negative or orders are accepted when stock is zero.
Mindset
- A business logic bug is often silent — it produces wrong outcomes without throwing errors.
- Rules are only as safe as their invariants: what must always or never be true.
- State machines are the right mental model for most workflow logic.
- Cross-module side effects are the most dangerous — a rule change in one place silently breaks another.
Workflow
Map entities and lifecycle states — For each core entity (order, user, invoice, job, booking), list all possible states and the transitions between them. Ask: are there states the system can reach that it should not?
Define invariants — Ask what must always be true and what must never happen:
- "An order can only be fulfilled if payment is confirmed."
- "A user cannot approve their own request."
- "A balance cannot go negative without explicit overdraft permission." List these explicitly; they become the test of the review.
Trace the happy path and failure paths — Follow the full flow from trigger to terminal state. Then ask: what happens at each step if the expected precondition is false? Walk each scenario (engineering quality bar, section 3) until every one that can reach the change is tested or named untested. Hardest axes here: concurrent writers, retried or late webhooks, each role and tenant.
Check handoffs and ownership transitions — Who holds responsibility at each state? What happens if the handoff is missed? Who can undo or override?
Check approval, retry, and reversal logic:
- Can approvals be bypassed or skipped under any conditions?
- Does retry produce duplicates or unintended side effects?
- Can two users or jobs act on the same record at once (race conditions)?
- Is reversal (refund, cancel, undo) handled at every state where it is reachable?
Check time-based and threshold rules — Deadlines, expiry, rate limits, quota checks, SLA breaches. Ask: what happens exactly at the boundary?
Check cross-module side effects — When state changes in one module, what does it trigger elsewhere? Are all downstream consumers aware of every possible transition?
Check against production data — Run the rules against a production data copy (never production), with personal data and secrets masked and the copy kept out of git, logs and test fixtures: count the rows in each state, find rows the change would miss, break or move by surprise (nulls, legacy values, duplicates, orphans), and compare data types and structure with production (the number 0.01 in tests vs the string "0.01" in production). Check the effect on day-to-day operations and existing users. If there is no copy, ask the user to prepare one.
Finding workflows nobody wrote down
- Scan for entry points that imply a workflow: routes, queue workers, cron jobs, migrations (each implies a lifecycle), webhooks and infra config. A workflow in code with no spec gets edited without anyone knowing its shape.
- For each step, branch it: what if it fails, times out, returns nothing, or is retried? Write what cleans up after a failure at step N and who owns it.
- Write each handoff between services as a contract: payload, success, failure, timeout.
- List every timing assumption (step 4 slower than expected) and every unwritten assumption as an open question, with the code line that depends on it.
- Check the spec against the code, not against memory of the code.
Guardrails
- Do not confuse input validation with business rules — they are different concerns.
- Do not assume that because a rule is implemented it is the right rule.
- Do not skip edge states (empty, deleted, expired, locked) — most logic bugs live there. Also check bypass paths (admin tools, migrations, a second API version) and events that arrive out of order.
- Prefer state machine diagrams over prose when mapping transitions.
Output format
Entity map:
[entity] — states: [list] — transitions: [list]
Invariants:
[list of "must always / never" rules]
Violations found:
[entity/state/rule] — [what the code does] — [what it should do]
Dangerous assumptions:
[assumption] — [what breaks if false]
Edge cases:
[case] — [behavior] — [risk]
Recommended rule changes:
[change] — [reason] — [smallest safe fix]
References
../../references/checklists/business-logic-checklist.md../../references/pitfalls/business-logic-pitfalls.md../../references/checklists/engineering-quality-bar.md
Adapted from specialized/specialized-workflow-architect.md (agency-agents, MIT).