Skills

System Design Building Blocks

Select infrastructure components by the constraint each removes: load balancers, caches...

Install

npx skills add HoangNguyen0403/agent-skills-standard --skill system-design-building-blocks -g -a claude-code -y
Category
Data and ML
Updated
3d ago
License
MIT
Context cost
Lightabout 1,140 tokens
Runs scripts
No, instructions only

What it does

Select infrastructure components by the constraint each removes: load balancers, caches and invalidation, queues and pub/sub, CDN, API gateway, rate limiting, consistent hashing. Use when choosing cache, queue, replica, or edge layers; defer engine tuning to the database category.

System Building Blocks

Priority: P1 (HIGH)

Add a component only to remove a named constraint. Every component adds failure modes and cost.

Selection Table

Constraint observedComponentCost accepted
One instance saturates CPU or connectionsHorizontal scaling behind a load balancerStatelessness required; session moves to a store
Read QPS exceeds store ceiling; data tolerates stalenessRead-through cacheStale reads up to TTL; invalidation complexity
Write spikes exceed sustainable store throughputQueue plus async workerEventual completion; needs idempotent consumers
Slow non-critical work blocks the request pathBackground job or eventExtra delivery guarantees to reason about
Static or media bytes dominate egressCDNCache purge lag; origin still needed for misses
Cross-cutting authn, quota, routing repeated per serviceAPI gatewayCentral chokepoint; fails closed and needs its own failure capacity
One tenant or key can exhaust capacityRate limiter or admission controlRejections need clear client contracts
Cache or shard nodes change count during scalingConsistent hashingRebalancing logic; hot-key skew persists

Caching Rules

  • Default to cache-aside for read-heavy paths; use write-through only when read-after-write must be exact.
  • Set TTL from tolerable staleness, not from convenience. Every cached key needs a stated TTL and an invalidation trigger.
  • Guard the miss path: single-flight or request coalescing prevents a stampede when a hot key expires.
  • Never cache what you cannot invalidate. Never cache per-user data under a shared key.

Queue Rules

Read the whole SKILL.md on GitHub

More in Data and ML