agentleFS
jamestorrevillasjamestorrevillas/dev-skills/.github/skills/system-design/SKILL.md

system-design

Skill4 starsChanged 9 months agoMITView on GitHub

Use this skill when designing large-scale systems, choosing between architectural patterns, evaluating trade-offs, designing for scalability and reliability, or preparing for system design interviews. Trigger on keywords: system design, architecture, scalability, microservices, monolith, distributed system, design trade-offs, high availability, load balancing, caching strategy, database selection.

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use data-pipelines, caching and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jayavibhavnkSkill

    data-pipelines

    Build ETL/data pipelines - extract, transform, load with proper error handling and monitoring.

    Also in 4 projects that use this

  • wpankSkill

    caching

    Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.

    Also in 4 projects that use this

  • travisjneumanSkill

    data-engineering

    ETL/ELT pipelines, data warehousing (BigQuery, Snowflake, Redshift), stream processing (Kafka, Spark Streaming), orchestration (Airflow, Dagster, Prefect), dbt transformations, and data lake architecture. Use when building data pipelines, designing warehouse schemas, or implementing real-time data processing.

    Also in 4 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 13 projects that use this

  • mmondoraSkill

    infrastructure-as-code

    Infrastructure as Code with Terraform and Pulumi. State management, modularity, drift detection, secrets handling. Use when provisioning cloud resources, writing Terraform/Pulumi modules, or managing infrastructure configuration.

    Also in 3 projects that use this

  • mjunaidcaSkill

    kubernetes

    Production-grade Kubernetes manifests and debugging for containerized applications. This skill should be used when users ask to deploy to Kubernetes, create K8s manifests, containerize for K8s, set up Deployments/Services/Jobs/StatefulSets/CronJobs, create namespaces with resource quotas, set up multi-team isolation, configure ResourceQuota/ LimitRange, secure with RBAC (ServiceAccount, Role, RoleBinding), configure init containers (model download, db wait, migrations), set up sidecars (logging, metrics), or debug pods (CrashLoopBackOff, logs, exec, describe, events). Auto-detects from Dockerfile/code, generates hardened manifests with educational comments. CKAD-aligned.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 57 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before designing anything, answer:

    line 22
  2. Distinctive:

    Read/Write ratio: Read-heavy? Write-heavy? Mixed?

    line 29
  3. Distinctive:

    Rule: Start monolith, extract services when you feel the pain.

    line 103
  4. Distinctive:

    Don't use your primary DB for full-text search

    line 140

“Common” is measured: kept by at least 6 in 10 of the 57 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

System Design

Design Process (Always Follow This Order)

  1. Clarify requirements — functional AND non-functional
  2. Estimate scale — users, requests/sec, data volume, read/write ratio
  3. Define the API — what does the system expose?
  4. Design the data model — what data, how stored, how accessed?
  5. High-level architecture — major components and their relationships
  6. Deep dive — zoom into the hardest or most critical parts
  7. Identify bottlenecks — and how to address them

Requirements Clarification

Before designing anything, answer:

Functional: What does the system do? Scale: How many users? Requests/sec? Data volume? Growth rate? Availability: What's the acceptable downtime? (99.9% = 8.7h/yr, 99.99% = 52m/yr) Latency: What's the acceptable response time? (p99) Consistency: Strong vs eventual consistency? (CAP theorem) Read/Write ratio: Read-heavy? Write-heavy? Mixed? Geography: Single region? Global? Data sovereignty requirements?


Scalability Patterns

Horizontal vs Vertical Scaling

VerticalHorizontal
MethodBigger machineMore machines
LimitHardware ceilingTheoretically unlimited
CostExpensiveMore cost-efficient
DowntimeRequiredZero downtime possible
ComplexitySimpleRequires load balancing, distributed design

Default: design for horizontal scaling from the start.

Load Balancing

  • Round Robin — equal distribution, simple, doesn't account for load
  • Least Connections — routes to server with fewest active connections
  • Consistent Hashing — for distributed caches, minimizes redistribution on scaling

Caching Strategy

LayerToolWhat to Cache
CDNCloudflare, CloudFrontStatic assets, public API responses
ApplicationRedis, MemcachedSession data, computed results, DB query results
DatabaseQuery cache, materialized viewsExpensive aggregations

Cache Invalidation Strategies:

  • TTL (Time-to-Live) — expire after N seconds. Simple, may serve stale data.
  • Write-through — update cache on every write. Strong consistency, slower writes.
  • Write-behind — async cache update after write. Fast writes, eventual consistency.
  • Cache-aside — app manages cache explicitly. Most flexible.

Data Architecture

SQL vs NoSQL Decision

Use SQL WhenUse NoSQL When
Data is relationalData is unstructured or variable schema
ACID transactions requiredHorizontal scaling is priority
Complex queries and joinsHigh write throughput needed
Data integrity is criticalEventual consistency is acceptable

Database Sharding

Partition data across multiple databases:

  • Horizontal sharding — split rows (e.g., users A-M on DB1, N-Z on DB2)
  • Vertical sharding — split tables by feature (users DB, orders DB, payments DB)
  • Hash-based — shard key hashed to determine partition

Read Replicas

  • Primary handles writes
  • Replicas handle reads
  • Good for read-heavy workloads (social feeds, analytics)
  • Trade-off: replication lag = eventual consistency

Architecture Patterns

Monolith vs Microservices

MonolithMicroservices
ComplexityLow (operational), High (code over time)High (operational), Lower (per service)
DeploymentSimple, all-or-nothingComplex, independent per service
ScalingScale everything togetherScale services independently
Team sizeSmall teams, early stageLarger teams, mature product
Start with✓ YesOnly when monolith pain is real

Rule: Start monolith, extract services when you feel the pain. Premature microservices is a common mistake.

Event-Driven Architecture

Use when:

  • Services need to be decoupled
  • High throughput, async processing
  • Audit trail / event sourcing needed

Tools: Kafka (high throughput), RabbitMQ (complex routing), AWS SQS (simple, managed)

CQRS (Command Query Responsibility Segregation)

Separate read and write models:

  • Write model — optimized for consistency and transactions
  • Read model — optimized for query performance (denormalized, pre-computed)

Good for: high read/write ratio disparity, complex domain logic


Common System Design Components

API Gateway

  • Single entry point for all clients
  • Handles auth, rate limiting, SSL termination, routing
  • Tools: AWS API Gateway, Kong, Nginx

Message Queue

  • Decouples producers from consumers
  • Enables async processing, load leveling
  • Provides buffer for traffic spikes

CDN (Content Delivery Network)

  • Serve static assets from edge locations close to users
  • Reduce latency, reduce origin server load
  • Cache invalidation is the hard part

Search

  • Don't use your primary DB for full-text search
  • Elasticsearch / OpenSearch for complex text search
  • Typesense for simpler, faster search

Non-Functional Requirements Cheatsheet

RequirementPattern
High AvailabilityRedundancy, failover, multi-region
Low LatencyCDN, caching, read replicas, edge computing
High ThroughputHorizontal scaling, async processing, queues
ConsistencyACID transactions, consensus protocols (Raft, Paxos)
DurabilityReplication, backups, write-ahead logs
SecurityAuth, encryption at rest + transit, least privilege

Trade-Off Framework

For every design decision, explicitly state the trade-off:

Decision: [what you chose]
Why: [what problem it solves]
Trade-off: [what you give up]
Alternative: [what you considered]
When to reconsider: [conditions that would change this decision]

Back-of-Envelope Estimation

Useful numbers:

  • 1M users × 10 req/day = ~120 requests/second
  • 1KB × 1M requests/day = ~1GB/day of data
  • SSD read: ~0.1ms | Network: ~1ms | HDD: ~10ms
  • Single server handles ~10K-50K requests/sec (depends on complexity)
  • RAM: 1 server ≈ 64-256GB | Typical process ≈ 100MB-1GB

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.