Skip to content
Development
Skill

/designing-distributed-systems

When designing distributed systems for scalability, reliability, and consistency. Covers CAP/PACELC theorems, consistency models (strong, eventual, causal), replication patterns (leader-follower, multi-leader, leaderless), partitioning strategies (hash, range, geographic),

From plugin
ai-design-components
53376 skills

Claude Code

$ npx -y skills add ancoleman/ai-design-components --skill designing-distributed-systems --agent claude-code

SKILL.md

designing-distributed-systems.SKILL.md
name: designing-distributed-systems
description: When designing distributed systems for scalability, reliability, and consistency. Covers CAP/PACELC theorems, consistency models (strong, eventual, causal), replication patterns (leader-follower, multi-leader, leaderless), partitioning strategies (hash, range, geographic), transaction patterns (saga, event sourcing, CQRS), resilience patterns (circuit breaker, bulkhead), service discovery, and caching strategies for building fault-tolerant distributed architectures.

Designing Distributed Systems

Design scalable, reliable, and fault-tolerant distributed systems using proven patterns and consistency models.

Purpose

Distributed systems are the foundation of modern cloud-native applications. Understanding fundamental trade-offs (CAP theorem, PACELC), consistency models, replication patterns, and resilience strategies is essential for building systems that scale globally while maintaining correctness and availability.

When to Use This Skill

Apply when:

  • Designing microservices architectures with multiple services
  • Building systems that must scale across multiple datacenters or regions
  • Choosing between consistency vs availability during network partitions
  • Selecting replication strategies (single-leader, multi-leader, leaderless)
  • Implementing distributed transactions (saga pattern, event sourcing, CQRS)
  • Designing partition-tolerant systems with proper consistency guarantees
  • Building resilient services with circuit breakers, bulkheads, retries
  • Implementing service discovery and inter-service communication

Core Concepts

CAP Theorem Fundamentals

**CAP Theorem:** In a distributed system experiencing a network partition, choose between Consistency (C) or Availability (A). Partition tolerance (P) is mandatory.

Network partitions WILL occur → Always design for P

During partition:
├─ CP (Consistency + Partition Tolerance)
│  Use when: Financial transactions, inventory, seat booking
│  Trade-off: System unavailable during partition
│  Examples: HBase, MongoDB (default), etcd
│
└─ AP (Availability + Partition Tolerance)
   Use when: Social media, caching, analytics, shopping carts
   Trade-off: Stale reads possible, conflicts need resolution
   Examples: Cassandra, DynamoDB, Riak

**PACELC:** Extends CAP to consider normal operations (no partition).

  • **If Partition:** Choose Availability (A) or Consistency (C)
  • **Else (normal):** Choose Latency (L) or Consistency (C)

Consistency Models Spectrum

Strong Consistency ◄─────────────────────► Eventual Consistency
      │                    │                      │
  Linearizable      Causal Consistency     Convergent
  (Slowest,         (Middle Ground,        (Fastest,
   Most Consistent)  Causally Ordered)     Eventually Consistent)

**Strong Consistency (Linearizability):**

  • All operations appear atomically in sequential order
  • Reads always return most recent write
  • Use for: Bank balances, inventory stock, seat booking
  • Trade-off: Higher latency, reduced availability

**Eventual Consistency:**

  • If no new updates, all replicas eventually converge
  • Use for: Social feeds, product catalogs, user profiles, DNS
  • Trade-off: Stale reads possible, conflict resolution needed

**Causal Consistency:**

  • Causally related operations seen in same order by all nodes
  • Use for: Chat apps, collaborative editing, comment threads
  • Trade-off: More complex than eventual, requires causality tracking

**Bounded Staleness:**

  • Staleness bounded by time or version count
  • Use for: Real-time dashboards, leaderboards, monitoring
  • Trade-off: Must monitor lag, more complex than eventual

Replication Patterns

**1. Leader-Follower (Single-Leader):**

  • All writes to leader, replicated to followers
  • Followers handle reads (load distribution)
  • **Synchronous:** Wait for follower ACK (strong consistency, higher latency)
  • **Asynchronous:** Don't wait (eventual consistency, possible data loss)
  • Use for: Most common pattern, strong consistency with sync replication

**2. Multi-Leader:**

  • Multiple leaders accept writes in different datacenters
  • Leaders replicate to each other
  • **Conflict resolution required:** Last-Write-Wins, application merge, vector clocks
  • Use for: Multi-datacenter, low write latency, geo-distributed users
  • Trade-off: Conflict resolution complexity

**3. Leaderless (Dynamo-style):**

  • No single leader, quorum-based reads/writes
  • **Quorum rule:** W + R > N (W=write quorum, R=read quorum, N=replicas)
  • Example: N=5, W=3, R=2 → Strong consistency (overlap guaranteed)
  • Use for: Maximum availability, partition tolerance
  • Trade-off: Complexity, read repair needed

Partitioning Strategies

**Hash Partitioning (Consistent Hashing):**

  • Key → Hash(Key) → Partition assignment
  • Even distribution, minimal rebalancing when nodes added/removed
  • Use for: Point queries by ID, even distribution critical
  • Examples: Cassandra, DynamoDB, Redis Cluster

**Range Partitioning:**

  • Key ranges assigned to partitions (A-F, G-M, N-S, T-Z)
  • Enables range queries, ordered data
  • Risk: Hot spots if data skewed
  • Use for: Time-series data, leaderboards, range scans
  • Examples: HBase, Bigtable

**Geographic Partitioning:**

  • Partition by location (US-East, EU-West, APAC)
  • Use for: Data locality, GDPR compliance, low latency
  • Examples: Spanner, Cosmos DB

Resilience Patterns

**Circuit Breaker:**

[Closed] → Normal operation
   │ (failures exceed threshold)
   ▼
[Open] → Fail fast (don't call failing service)
   │ (timeout expires)
   ▼
[Half-Open] → Try single request
   │ success → [Closed]
   │ failure → [Open]
  • Prevents cascading failures
  • Fast-fail instead of waiting for timeout
  • See references/resilience-patterns.md

**Bulkhead Isolation:**

  • Isolate resources (thread pools, connection pools)
  • Failure in one partition doesn't affect others
  • Like ship compartments preventing total flooding

**Timeout and Retry:**

  • **Timeout:** Set dea
Read more
@ancoleman
Ships withai-design-components

Comprehensive UI/UX and Backend component design skills for AI-assisted development with Claude

Stars on GitHub

Momentum

stars in total
533
Star history of ancoleman/ai-design-components on GitHub, a chart by star-history.com

Other skills on ai-design-components.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about designing-distributed-systems.

Which coding agents can use designing-distributed-systems?
designing-distributed-systems installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.