Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问clear审计通过

system-architecture系统架构

Agent Skill

system-architecture 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,711

周安装

72

GitHub Stars

133

下载量

599
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:system-architecture(系统架构)
来源仓库:https://github.com/yennanliu/cs_basics
仓库路径:skills/system-architecture
安装命令:
npx skills add https://github.com/yennanliu/cs_basics --skill system-architecture
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/yennanliu/cs_basics --skill system-architecture

简介

system-architecture 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 适用于系统架构分析与协作流程管理,可结合原始 README 验证功能细节。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需确认权限范围和维护状态。
  • 安装前建议确认是否会触发联网、命令执行或文件读写等操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

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 edge locations

Data Consistency:

  • Strong Consistency: Read reflects latest write (ACID)
  • Eventual Consistency: Reads eventually reflect write (BASE)
  • CAP Theorem: Choose 2 of 3: Consistency, Availability, Partition Tolerance

API Design:

RESTful:
GET    /api/users/{id}
POST   /api/users
PUT    /api/users/{id}
DELETE /api/users/{id}

GraphQL:
query {
  user(id: "123") {
    name
    posts {
      title
    }
  }
}

9. System Design Template

Use this structure (based on system_design/00_template.md):

# {System Name}

## 1. Requirements
### Functional
- [List core features]

### Non-Functional
- Scale: [Users, QPS, Data]
- Performance: [Latency requirements]
- Availability: [Uptime target]

## 2. Capacity Estimation
- Traffic: [QPS calculations]
- Storage: [Data size, growth]
- Bandwidth: [Network requirements]

## 3. API Design

[endpoint] - [description]

## 4. High-Level Architecture
[Diagram]

## 5. Database Schema
[Tables and relationships]

## 6. Detailed Design
### Component 1
[Deep dive]

### Component 2
[Deep dive]

## 7. Scalability
[How to scale each component]

## 8. Trade-offs
[Decisions and alternatives]

10. Real-World Examples

Reference case studies in system_design/:

  • Netflix: Video streaming, recommendation
  • Twitter: Timeline, tweet storage, trending
  • Uber: Real-time matching, location tracking
  • Instagram: Image storage, feed generation
  • WhatsApp: Message delivery, presence

Common Patterns:

  • News Feed: Fan-out on write vs fan-out on read
  • Rate Limiter: Token bucket with Redis
  • URL Shortener: Base62 encoding, hash collision
  • Chat System: WebSocket, message queue
  • Notification: Push notification service, APNs/FCM

Interview Tips

Time Management:

  • Requirements: 10%
  • High-level design: 25%
  • Deep dive: 50%
  • Wrap up: 15%

Communication:

  • Think out loud
  • Ask clarifying questions
  • Discuss trade-offs
  • Acknowledge limitations

What interviewers look for:

  • Problem-solving approach
  • Technical depth
  • Trade-off analysis
  • Scale awareness
  • Communication skills

Common Mistakes to Avoid

  • Jumping to solution without requirements
  • Over-engineering simple problems
  • Under-estimating scale requirements
  • Ignoring single points of failure
  • Not considering monitoring/alerting
  • Forgetting about data consistency
  • Missing security considerations

Project Context

  • Templates in system_design/00_template.md
  • Case studies in system_design/*.md
  • Reference materials in doc/system_design/
  • Follow the established documentation pattern

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

27.49%
按下载量换算165

Claude Code

24.63%
按下载量换算148

windsurf

16.77%
按下载量换算100

Codex

12.19%
按下载量换算73

github-copilot

8.5%
按下载量换算51

Antigravity

3.74%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills