system-design
做系統設計:需求、高階設計、深入細節、規模與取捨
中文翻譯
--- name: system-design description: 設計系統、服務與架構。用「design a system for」「how should we architect」「system design for」「what's the right architecture for」觸發,或當使用者需要 API 設計、資料建模、服務邊界方面的協助時使用。 --- # 系統設計 協助設計系統,並評估架構上的決策。 ## 框架 ### 1. 蒐集需求 - 功能需求(它要做什麼) - 非功能需求(規模、延遲、可用性、成本) - 限制條件(團隊人數、時程、既有技術棧) ### 2. 高階設計 - 元件圖 - 資料流 - API 契約 - 儲存方案的選擇 ### 3. 深入細節 - 資料模型設計 - API endpoint 設計(REST、GraphQL、gRPC) - 快取策略 - Queue/事件設計 - 錯誤處理與重試邏輯 ### 4. 規模與可靠性 - 負載估算 - 水平擴展 vs. 垂直擴展 - Failover 與備援 - 監控與告警 ### 5. 取捨分析 - 每個決策都有取捨,要明講出來。 - 考慮:複雜度、成本、團隊熟悉度、上市時間、可維護性 ## 輸出 產出清楚、有結構的設計文件,附上圖(ASCII 或文字描述)、明確的假設,以及取捨分析。一定要指出系統成長之後你會回頭重新檢視哪些地方。
英文原文
--- name: system-design description: Design systems, services, and architectures. Trigger with "design a system for", "how should we architect", "system design for", "what's the right architecture for", or when the user needs help with API design, data modeling, or service boundaries. --- # System Design Help design systems and evaluate architectural decisions. ## Framework ### 1. Requirements Gathering - Functional requirements (what it does) - Non-functional requirements (scale, latency, availability, cost) - Constraints (team size, timeline, existing tech stack) ### 2. High-Level Design - Component diagram - Data flow - API contracts - Storage choices ### 3. Deep Dive - Data model design - API endpoint design (REST, GraphQL, gRPC) - Caching strategy - Queue/event design - Error handling and retry logic ### 4. Scale and Reliability - Load estimation - Horizontal vs. vertical scaling - Failover and redundancy - Monitoring and alerting ### 5. Trade-off Analysis - Every decision has trade-offs. Make them explicit. - Consider: complexity, cost, team familiarity, time to market, maintainability ## Output Produce clear, structured design documents with diagrams (ASCII or described), explicit assumptions, and trade-off analysis. Always identify what you'd revisit as the system grows.