一键导入
system-design
Use when designing system architecture for a new project or major feature — service boundaries, data flow, API contracts, and technical trade-offs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when designing system architecture for a new project or major feature — service boundaries, data flow, API contracts, and technical trade-offs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when the user wants to free disk space, investigate disk usage, clean caches, remove unused artifacts, or when disk capacity is high. Also use when asked to "clean up", "free space", "disk full", or "what's using disk space". Always uses AskUserQuestion for every deletion decision.
Use at the start of every conversation and for every user message — orchestrates the full engineering skills suite by understanding intent, clarifying requirements interactively, and invoking the right skills
Use when refactoring Go code, cleaning up legacy codebases, optimizing performance, or enforcing clean architecture boundaries in a Go/Fiber backend
Use when refactoring Python code, cleaning up legacy codebases, optimizing performance, enforcing type safety, or improving clean architecture in a FastAPI backend
Use when refactoring React components, cleaning up legacy frontends, optimizing performance, improving component architecture, or reducing bundle size
Use when reviewing changed code before committing or after completing a feature — checks performance, architecture, type safety, and code quality against project standards
| name | system-design |
| description | Use when designing system architecture for a new project or major feature — service boundaries, data flow, API contracts, and technical trade-offs |
Design the architecture before writing code. Define service boundaries, data flow, API contracts, and infrastructure. Make trade-off decisions explicit.
Core principle: Architecture mistakes are 100x more expensive to fix than code mistakes. Think first, build second.
product-spec, before scaffoldingFrom the product spec, extract:
## Technical Requirements
### Functional
- [What the system must do — derived from user stories]
### Non-Functional
- **Throughput:** [requests/sec, messages/sec]
- **Latency:** [p50, p95, p99 targets]
- **Availability:** [uptime target, e.g., 99.9%]
- **Data volume:** [storage growth rate, retention policy]
- **Consistency:** [strong vs eventual, where each applies]
- **Security:** [auth, encryption, compliance]
Define the system components and how they interact:
## Architecture
### Components
- **API Gateway** — entry point, auth, rate limiting
- **Service A** — handles [domain area]
- **Service B** — handles [domain area]
- **Database** — PostgreSQL for [what data]
- **Cache** — Redis for [what purpose]
- **Queue** — [Redis Pub/Sub / NATS / Kafka] for [what events]
### Data Flow
[Client] → [API Gateway] → [Service] → [Database]
→ [Cache]
→ [Queue] → [Worker]
For most indie/startup projects, start as a modular monolith:
Single Go/Python service with clean architecture
→ Split into microservices only when you have a clear reason
→ Reasons: independent scaling, different team ownership, different deploy cadence
Define the interface between components before implementing:
## API Contracts
### POST /api/v1/resources
Request: { field: type }
Response: { data: Resource }
Errors: 400 (validation), 401 (auth), 409 (conflict)
### GET /api/v1/resources?limit=20&offset=0
Response: { items: Resource[], pagination: { limit, offset, total } }
High-level entity relationships:
## Data Model
### Entities
- User (id, email, name, role, created_at)
- Organization (id, name, plan, created_at)
- Membership (user_id, org_id, role)
### Relationships
- User → many Organizations (through Membership)
- Organization → many Users (through Membership)
### Indexes
- users: email (unique), org_id
- memberships: (user_id, org_id) unique, org_id
REQUIRED: Use data-model skill for detailed schema design.
Document every significant technical decision:
## Trade-Offs
### Decision: Monolith vs Microservices
- **Chose:** Modular monolith
- **Why:** Team of 1-3, single deploy pipeline, shared database is fine at current scale
- **Revisit when:** Service needs independent scaling or different team owns a domain
### Decision: PostgreSQL vs [alternative]
- **Chose:** PostgreSQL
- **Why:** ACID transactions, JSONB for flexible data, mature ecosystem
- **Trade-off:** Horizontal scaling harder than NoSQL (acceptable at our scale)
## Infrastructure
### Local Development
- Docker Compose: API + Postgres + Redis
- Hot reload: air (Go) / uvicorn --reload (Python)
### Production
- [Cloud provider]: [services used]
- Database: managed Postgres
- Cache: managed Redis
- CDN: [for frontend assets]
- CI/CD: GitHub Actions → Docker → [deployment target]
## Risks & Mitigations
| Risk | Impact | Mitigation |
|------|--------|-----------|
| DB becomes bottleneck | High | Read replicas, query optimization, caching layer |
| Third-party API downtime | Medium | Circuit breaker, retry with backoff, fallback |
| Data loss | Critical | Automated backups, point-in-time recovery |
| Signal | Action |
|---|---|
| Same team, same deploy cadence | Keep as monolith |
| Different scaling needs (CPU vs I/O) | Consider splitting |
| Different data ownership | Consider splitting |
| Shared database works fine | Keep as monolith |
| Cross-service transactions needed | Keep as monolith |
| Team > 5 engineers on same codebase | Consider splitting |
product-spec for requirementsdata-model for detailed schema → adr for documenting decisions