Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reference document for monopoly patterns.
.claude/skills/lingxling-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 83% | 0% |
| case-10 | ✓→✗ | ▼ Worse | 63% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 84% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 63% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 73% | 0% |
What it is: Separate the read model (Query) from the write model (Command) into distinct services, databases, or code paths.
When to use:
Implementation:
Write Path: Client → Command API → Write DB (normalized, PostgreSQL)
Read Path: Client → Query API → Read DB (denormalized, Redis / Elasticsearch)
Sync: Write DB → CDC (Debezium) → Message Queue → Read DB updaterTrade-offs:
Real-world users: Amazon (order service), LinkedIn (feed)
What it is: Store state as a sequence of immutable events rather than current state. Rebuild current state by replaying events.
When to use:
Implementation:
Event Store: append-only log (Kafka, EventStoreDB)
Snapshots: periodic snapshots to speed up state rebuild
Projections: consumers build read models from eventsTrade-offs:
What it is: Manage distributed transactions across microservices via a sequence of local transactions, each publishing an event. If a step fails, compensating transactions undo previous steps.
Two variants:
When to use:
Choreography Example:
OrderService creates order →
[event: OrderCreated] →
PaymentService charges card →
[event: PaymentProcessed] →
InventoryService reserves stock →
[event: StockReserved] →
ShippingService books courierCompensating Transactions (on failure):
ShippingService fails →
[event: ShippingFailed] →
InventoryService releases stock →
PaymentService refunds card →
OrderService marks order failedTrade-offs:
What it is: A proxy that monitors calls to a service. If failure rate exceeds threshold, the circuit "opens" and calls fail fast instead of waiting for timeout.
States:
CLOSED → calls pass through; monitor failure rate
OPEN → calls fail immediately; no calls to downstream
HALF-OPEN → let a probe call through; if success, close; if fail, stay openWhen to use:
Implementation tools: Hystrix (deprecated), Resilience4j, Polly (.NET), Envoy proxy
Thresholds (starting point):
Trade-offs:
What it is: Isolate components so a failure in one doesn't consume resources of others. Named after the watertight compartments in ship hulls.
Types:
When to use:
Example:
Without bulkhead:
[Recommendation Service hangs] → fills shared thread pool → [Payment Service starves]
With bulkhead:
[Recommendation Service hangs] → fills its own thread pool (10 threads) → [Payment Service unaffected, has its own 50 threads]What it is: Incrementally replace a legacy monolith by routing new functionality to new microservices, while keeping the monolith alive for unchanged features.
Migration steps:
Phase 1: Deploy proxy in front of monolith (no user impact)
Phase 2: Route one feature to new microservice
Phase 3: Verify; deprecate that feature in monolith
Phase 4: Repeat for each feature
Phase 5: Monolith is empty; decommissionWhen to use:
Trade-offs:
What it is: Solve the dual-write problem (write to DB AND publish to queue atomically) by writing the event to an "outbox" table in the same DB transaction, then having a separate process relay it to the queue.
Problem it solves:
❌ WRONG (dual-write race):
BEGIN;
UPDATE orders SET status='paid';
COMMIT;
// Crash here → event never published, DB and queue are inconsistent
publish(PaymentProcessed);✅ CORRECT (outbox):
BEGIN;
UPDATE orders SET status='paid';
INSERT INTO outbox (event_type, payload) VALUES ('PaymentProcessed', {...});
COMMIT;
// Relay process reads outbox and publishes to Kafka
// At-least-once delivery guaranteed; make consumers idempotentRelay options: Debezium (CDC), polling relay, transaction log tailing
What it is: A hashing scheme where adding or removing nodes requires only K/N keys to be remapped (K = keys, N = nodes), instead of remapping all keys.
When to use:
Virtual nodes: Assign multiple positions per physical node on the hash ring to ensure even distribution even with few nodes.
What it is: A mechanism for consumers to signal producers to slow down when they can't keep up, preventing memory exhaustion and cascade failures.
Strategies:
When to use:
What it is: In a distributed system, elect a single node to perform a privileged task (e.g., writing to DB, sending scheduled jobs, coordinating work).
Algorithms:
When to use:
Tools: etcd, ZooKeeper, Consul, Redis (Redlock — use with caution)
What it is: A distributed algorithm that ensures all participants in a transaction either all commit or all abort.
Phases:
Phase 1 (Prepare): Coordinator asks all participants "can you commit?"
All say YES → proceed to Phase 2
Any says NO → abort
Phase 2 (Commit): Coordinator tells all participants to commitWhen to use (sparingly):
Why to avoid:
Read-Through:
Client → Cache (miss) → Cache fetches from DB → Returns to clientCache is always populated on miss. Simple for clients. Risk: cold start.
Write-Through:
Client → Cache → Cache writes to DB synchronously → ConfirmsStrong consistency. Higher write latency. Good for read-heavy with consistency need.
Write-Behind (Write-Back):
Client → Cache → Confirms immediately → Async flush to DBVery low write latency. Risk of data loss if cache fails before flush. Good for high-throughput counters, analytics.
Cache-Aside (Lazy Loading):
Client → Cache (miss) → Client fetches from DB → Client writes to CacheMost common. Application owns cache logic. Risk: thundering herd on cold start.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | pass→pass | 13,501 | 9,114 | -32% | 1 | 1 | 0% | 2,163 | 3,978 | +84% | 0 | 0 | — |
case-06 | pass→pass | 18,105 | 11,635 | -36% | 1 | 1 | 0% | 2,460 | 4,021 | +63% | 0 | 0 | — |
case-01 | fail→fail | 47,071 | 28,830 | -39% | 1 | 1 | 0% | 6,248 | 6,452 | +3% | 0 | 0 | — |
case-02 | fail→fail | 16,718 | 10,302 | -38% | 1 | 1 | 0% | 2,407 | 4,117 | +71% | 0 | 0 | — |
case-03 | fail→pass | 12,520 | 7,837 | -37% | 1 | 1 | 0% | 1,926 | 3,519 | +83% | 0 | 0 | — |
case-04 | pass→pass | 19,564 | 16,880 | -14% | 1 | 1 | 0% | 2,783 | 4,828 | +73% | 0 | 0 | — |
case-07 | pass→pass | 14,908 | 11,679 | -22% | 1 | 1 | 0% | 2,354 | 4,485 | +91% | 0 | 0 | — |
case-08 | pass→pass | 10,914 | 5,086 | -53% | 1 | 1 | 0% | 1,572 | 3,212 | +104% | 0 | 0 | — |
case-09 | pass→pass | 12,770 | 6,417 | -50% | 1 | 1 | 0% | 1,748 | 3,468 | +98% | 0 | 0 | — |
case-10 | pass→fail | 14,999 | 6,863 | -54% | 1 | 1 | 0% | 2,081 | 3,396 | +63% | 0 | 0 | — |
case-11 | pass→pass | 16,070 | 10,872 | -32% | 1 | 1 | 0% | 2,201 | 3,970 | +80% | 0 | 0 | — |
case-12 | pass→pass | 8,448 | 6,674 | -21% | 1 | 1 | 0% | 1,440 | 3,347 | +132% | 0 | 0 | — |
case-13 | pass→pass | 9,669 | 6,823 | -29% | 1 | 1 | 0% | 1,403 | 3,344 | +138% | 0 | 0 | — |
case-14 | pass→pass | 10,505 | 10,200 | -3% | 1 | 1 | 0% | 1,708 | 4,081 | +139% | 0 | 0 | — |
case-15 | pass→pass | 9,987 | 11,052 | +11% | 1 | 1 | 0% | 1,675 | 4,150 | +148% | 0 | 0 | — |
case-16 | pass→pass | 11,541 | 9,333 | -19% | 1 | 1 | 0% | 1,734 | 3,699 | +113% | 0 | 0 | — |
case-17 | pass→pass | 12,652 | 11,263 | -11% | 1 | 1 | 0% | 1,904 | 4,026 | +111% | 0 | 0 | — |
case-18 | pass→pass | 11,404 | 5,986 | -48% | 1 | 1 | 0% | 1,681 | 3,374 | +101% | 0 | 0 | — |
case-19 | fail→fail | 12,664 | 4,193 | -67% | 1 | 1 | 0% | 1,787 | 3,123 | +75% | 0 | 0 | — |
case-20 | pass→pass | 13,524 | 9,842 | -27% | 1 | 1 | 0% | 1,981 | 4,112 | +108% | 0 | 0 | — |
case-21 | pass→pass | 16,325 | 16,209 | -1% | 1 | 1 | 0% | 2,653 | 4,989 | +88% | 0 | 0 | — |
case-22 | pass→pass | 15,257 | 12,631 | -17% | 1 | 1 | 0% | 2,545 | 4,269 | +68% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of 0 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.