Community코딩 & 개발github.com

logical-test

Business-logic testing across backend, frontend, mobile, admin and database - verifies business rules, calculations (money, tax, discounts, rounding), state machines and allowed transitions, role and permission rules, time-based rules (expiry windows, time zones), invariants (totals never negative, stock never oversold), idempotency and concurrency of business operations, and consistency between layers. Reports logic flaws by severity into testcase.md. Use when asked for "logic test", "business rule test", "check the calculations", "state machine", "can this be abused", "race condition", or "is the workflow correct".

logical-test란 무엇인가요?

logical-test is a Claude Code agent skill that business-logic testing across backend, frontend, mobile, admin and database - verifies business rules, calculations (money, tax, discounts, rounding), state machines and allowed transitions, role and permission rules, time-based rules (expiry windows, time zones), invariants (totals never negative, stock never oversold), idempotency and concurrency of business operations, and consistency between layers. Reports logic flaws by severity into testcase.md. Use when asked for "logic test", "business rule test", "check the calculations", "state machine", "can this be abused", "race condition", or "is the workflow correct".

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/joshijignesh/faultline/tree/HEAD/skills/logical-test

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

logical-test은(는) 무엇을 하나요?

Goal: prove the system does the right thing, not just a thing. Logic flaws pass every input-validation check and still lose money or break promises.

Follow references/core-rules.md, references/automation-workflow.md, references/severity-model.md. Write the report in the format of references/testcase-template.md. Prefix IDs with LOG-. For every detected language, also apply references/languages/<language>.md (index: references/languages/README.md), especially its Logic and negative traps section.

Procedure

  1. Extract the rules. From requirements, docs, tickets, code comments, and tests, list every business rule as a testable statement: "A coupon can be used once per customer", "Order total ≥ 0", "Refund only when status = paid". If no written requirement exists, infer the rule from the code and mark it (inferred).
  2. Find where each rule is enforced. Server, client, DB constraint, or nowhere. A rule enforced only on the client is a finding.
  3. Model the state machine for each core entity (order, payment, subscription, account, booking). List the states and the allowed transitions. Then check that every disallowed transition is rejected on the server.
  4. Write invariants: properties that must always hold. Test them with examples and, where the project supports it, property-based tests (Hypothesis, fast-check, jqwik, rapid, PropEr, RSpec + rantly, RapidCheck for C++).
  5. Probe concurrency on every rule that reads state, decides, then writes.
  6. Classify by severity. Money, data, or privilege impact is at least High.

Rule categories to check

CategoryQuestionsTypical flaw
CalculationsWho computes price, tax, discount, shipping? Which rounding mode? In which currency unit?Client-supplied price trusted; float rounding; discount applied after tax instead of before; percentage over 100%
LimitsMin/max quantity, per-user limits, quotas, credit limits, free-tier capsLimit checked on create but not on update; limit per request instead of per user
One-time actionsCoupons, referrals, trials, sign-up bonuses, votes, OTPsReusable through replay, a parallel request, account recreation, or case variants (WELCOME10 vs welcome10)
State transitionsCan you cancel after shipping? Refund twice? Pay a cancelled order? Re-open a closed ticket?Missing current-state guard; transitions allowed from any state
Time rulesExpiry windows, "within 30 minutes", cut-offs, schedules, trial endsClient clock trusted; time zone or DST shifts; boundary off-by-one (< vs <=); window not enforced at all
Ownership and rolesWho may do X to whose Y? Delegation, teams, shared resourcesRole checked but not ownership; demoted user keeps an active session with old rights
Ordering and sequencingMust step A happen before B (verify email → purchase, KYC → withdraw)?Steps skippable by calling the later endpoint directly
Aggregates and consistencyDo totals, counters, balances, and inventory match their line items?Counter updated in one service but not another; cached totals stale after a refund
IdempotencyDoes repeating the same business operation change the result?Duplicate charge, double stock decrement, two welcome emails
ReversalIs every operation correctly undone (refund, cancel, delete, rollback)?Refund marks the order without returning stock or reversing loyalty points

Checklist by layer

Backend / API (BE)

  • Every business rule from step 1 is enforced on the server in the service layer, not only in the controller or UI.
  • Prices, discounts, and totals are recomputed on the server from catalogue data. Client-sent amounts are ignored or only compared.
  • State-transition guards exist: if order.status != PAID: reject before refund, ship, or cancel.
  • Read-decide-write sequences use a transaction with row locks, atomic updates (UPDATE … SET stock = stock - 1 WHERE stock > 0), or optimistic locking.
  • One-time resources are consumed atomically, with a unique constraint on (coupon_id, user_id).
  • Time rules use server time in UTC. Boundaries are tested at exactly the limit, 1 s before, and 1 s after.
  • Side effects (emails, webhooks, ledger entries) fire once, after commit.

Frontend web (FE)

  • The displayed total equals the server-calculated total. Show the server value; don't recompute it.
  • Hidden or disabled UI is not the only enforcement of a rule (e.g. the "Cancel" button is hidden after 30 min, but the API still accepts the cancel).
  • Optimistic UI updates roll back correctly when the server rejects the action.
  • Multi-step wizards can't be completed out of order via URL changes or the back button.

Mobile (MOB)

  • Offline-queued actions are re-validated by the server when they sync. A queued "redeem coupon" from yesterday must still obey today's rules.
  • The device clock is never trusted for expiry or time windows.
  • In-app purchase and entitlement state is verified on the server with receipts, not just from a local flag.

Admin panel (ADM)

  • Admin overrides (manual refund, price change, status change) follow the same state machine, or are explicitly audited as overrides.
  • Bulk actions apply per-row rules. They don't skip validation because the caller is an admin.
  • Role hierarchy rules hold: support can't grant themselves admin, and admins can't remove the last super-admin.
  • Financial reports reconcile: sum of orders − refunds = recorded revenue.

Database (DB)

  • Invariants are backed by constraints where possible: CHECK (total >= 0), CHECK (stock >= 0), UNIQUE (coupon_id, user_id), FKs, enum/check on status.
  • Money is stored as integer minor units or DECIMAL(p,s) with a defined rounding policy.
  • Derived columns (totals, counters) have a single owner, and a reconciliation query exists.
  • Soft-deleted rows can't still satisfy or block business rules unintentionally.

Concurrency probes (local or staging only)

Send N identical requests in parallel, e.g. a short script or xargs -P 10 curl … against your own local server. Then check:

  • coupon used once
  • stock never below 0
  • balance never double-debited
  • exactly one order created per idempotency key

Scope, prerequisites, and missing tools

Don't use it for malformed input (negative-test), dependency outages (fallback-test), or missing features versus the spec (product-test). This skill checks whether the implemented rules are correct.

Prerequisites: read access to the repository. Requirements docs help but aren't required; inferred rules are marked (inferred). Optional: a property-based testing library in the project's language.

If something is missing: if there are no requirements, the app can't run, or the parallel-request probe is blocked, record NOT RUN: <reason>, analyse the code paths statically, and still write the report.

Example finding row

IDLayerTypeFindingLocation / EvidenceFailure scenarioFixStatus
LOG-BE-002BELOGICCoupon reusable; total can go negativeorders.service.ts:57 subtracts coupon.amount with no redemption record and no max(0, …)Same coupon applied to 5 orders; a 9.99 order with a 10.00 coupon totals −0.01UNIQUE(coupon_id,user_id) redemption row in the same transaction; clamp total at 0Open

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

관련 스킬