Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

system-architecture

БесплатноБез исполняемых скриптовНе проверен

System design and architecture expert for creating scalable distributed systems. Covers system design interviews, architecture patterns, and real-world case…

yennanliuот yennanliu★ 141 звезда на GitHub19 установок в других каталогах

Об этом скилле

System Architecture Expert

When to use this Skill

Use this Skill when:

  • Designing distributed systems
  • Writing system design documentation
  • Preparing for system design interviews
  • Creating architecture diagrams
  • Analyzing trade-offs between design choices
  • Reviewing or improving existing system designs

System Design Framework

1. Requirements Gathering (5-10 minutes)

Functional Requirements:

  • What are the core features?
  • What actions can users perform?
  • What are the inputs and outputs?

Non-Functional Requirements:

  • Scale: How many users? How much data?
  • Performance: Latency requirements? (p50, p95, p99)
  • Availability: What uptime is needed? (99.9%, 99.99%)
  • Consistency: Strong or eventual consistency?

Constraints:

  • Budget limitations
  • Technology stack constraints
  • Team expertise
  • Timeline

Example Questions:

- How many daily active users?
- What's the read:write ratio?
- What's the average data size?
- What's the peak load vs average load?
- Do we need real-time updates?
- Can we have data loss?

2. Capacity Estimation (Back-of-the-envelope)

Calculate:

Traffic:
- DAU = 100M users
- Each user makes 10 requests/day
- QPS = 100M * 10 / 86400 ≈ 11,574 QPS
- Peak QPS = 2-3x average ≈ 30,000 QPS

Storage:
- 100M users * 1KB per user = 100GB
- With 3x replication = 300GB
- Growth: 300GB * 365 days = 109.5TB/year

Bandwidth:
- QPS * average request size
- 11,574 * 10KB = 115.74MB/s

Memory/Cache:

  • 80-20 rule: 20% of data gets 80% of traffic
  • Cache = 20% of total data for hot data

3. High-Level Design

Core Components:

  1. Client Layer (Web, Mobile, Desktop)
  2. API Gateway / Load Balancer
  3. Application Servers (Business logic)
  4. Cache Layer (Redis, Memcached)
  5. Database (SQL, NoSQL, or both)
  6. Message Queue (Kafka, RabbitMQ)
  7. Object Storage (S3, GCS)
  8. CDN (CloudFront, Akamai)

Draw Architecture:

[Clients] → [CDN]
            ↓
        [Load Balancer]
            ↓
    [Application Servers]
        ↙     ↓     ↘
   [Cache] [DB] [Queue] → [Workers]
                            ↓
                      [Object Storage]

4. Database Design

SQL vs NoSQL Decision:

Use SQL when:

  • ACID transactions required
  • Complex queries with JOINs
  • Structured data with relationships
  • Examples: PostgreSQL, MySQL

Use NoSQL when:

  • Massive scale (horizontal scaling)
  • Flexible schema
  • High write throughput
  • Examples: Cassandra, DynamoDB, MongoDB

Sharding Strategy:

  • Hash-based: user_id % num_shards
  • Range-based: Users 1-100M on shard 1
  • Geographic: US users on US shard
  • Consistent hashing: For even distribution

Schema Design:

-- Example: URL Shortener
CREATE TABLE urls (
    id BIGSERIAL PRIMARY KEY,
    short_url VARCHAR(10) UNIQUE NOT NULL,
    long_url TEXT NOT NULL,
    user_id BIGINT,
    created_at TIMESTAMP DEFAULT NOW(),
    expires_at TIMESTAMP,
    click_count INT DEFAULT 0,
    INDEX (short_url),
    INDEX (user_id)
);

5. Deep Dive Components

Caching Strategy:

  • Cache-Aside: App reads from cache, loads from DB on miss
  • Write-Through: Write to cache and DB together
  • Write-Behind: Write to cache, async write to DB

Eviction Policies:

  • LRU (Least Recently Used) - Most common
  • LFU (Least Frequently Used)
  • TTL (Time To Live)

Load Balancing:

  • Round Robin: Simple, equal distribution
  • Least Connections: Route to least busy server
  • Consistent Hashing: Minimize redistribution
  • Weighted: Based on server capacity

Message Queue Patterns:

  • Pub/Sub: One-to-many (notifications)
  • Work Queue: Task distribution (job processing)
  • Fan-out: Broadcast to multiple queues

6. Scalability Patterns

Horizontal Scaling:

  • Add more servers
  • Use load balancers
  • Stateless application servers
  • Session stored in cache/DB

Vertical Scaling:

  • Add more CPU/RAM to servers
  • Limited by hardware
  • Simpler but has limits

Microservices:

Monolith:
[Single App] → [DB]

Microservices:
[User Service] → [User DB]
[Post Service] → [Post DB]
[Feed Service] → [Feed DB]

Benefits:

  • Independent scaling
  • Technology flexibility
  • Fault isolation

Drawbacks:

  • Increased complexity
  • Network latency
  • Distributed transactions

7. Reliability & Availability

Replication:

  • Master-Slave: One writer, multiple readers
  • Master-Master: Multiple writers (conflict resolution needed)
  • Multi-region: Geographic redundancy

Failover:

  • Active-Passive: Standby server takes over
  • Active-Active: Both servers handle traffic

Rate Limiting:

  • Token bucket algorithm
  • Leaky bucket algorithm
  • Fixed window counter
  • Sliding window log

Circuit Breaker:

States:
Closed → Normal operation
Open → Reject requests immediately
Half-Open → Test if service recovered

8. Common System Design Patterns

Content Delivery:

  • Use CDN for static assets
  • Geo-distributed edge servers
  • Cache at
Полный SKILL.md на GitHub

Установить system-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Glob
Grep
Write

FAQ

Что делает скилл system-architecture?

System design and architecture expert for creating scalable distributed systems. Covers system design interviews, architecture patterns, and real-world case studies like Netflix, Twitter, Uber. Use when designing systems, writing architecture docs, or preparing for system design interviews.

Как установить скилл system-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл system-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить system-architecture с