@booklib/skills 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/animation-at-work/SKILL.md +246 -0
- package/animation-at-work/assets/example_asset.txt +1 -0
- package/animation-at-work/references/api_reference.md +369 -0
- package/animation-at-work/references/review-checklist.md +79 -0
- package/animation-at-work/scripts/example.py +1 -0
- package/bin/skills.js +85 -0
- package/clean-code-reviewer/SKILL.md +292 -0
- package/clean-code-reviewer/evals/evals.json +67 -0
- package/data-intensive-patterns/SKILL.md +204 -0
- package/data-intensive-patterns/assets/example_asset.txt +1 -0
- package/data-intensive-patterns/references/api_reference.md +34 -0
- package/data-intensive-patterns/references/patterns-catalog.md +551 -0
- package/data-intensive-patterns/references/review-checklist.md +193 -0
- package/data-intensive-patterns/scripts/example.py +1 -0
- package/data-pipelines/SKILL.md +252 -0
- package/data-pipelines/assets/example_asset.txt +1 -0
- package/data-pipelines/references/api_reference.md +301 -0
- package/data-pipelines/references/review-checklist.md +181 -0
- package/data-pipelines/scripts/example.py +1 -0
- package/design-patterns/SKILL.md +245 -0
- package/design-patterns/assets/example_asset.txt +1 -0
- package/design-patterns/references/api_reference.md +1 -0
- package/design-patterns/references/patterns-catalog.md +726 -0
- package/design-patterns/references/review-checklist.md +173 -0
- package/design-patterns/scripts/example.py +1 -0
- package/domain-driven-design/SKILL.md +221 -0
- package/domain-driven-design/assets/example_asset.txt +1 -0
- package/domain-driven-design/references/api_reference.md +1 -0
- package/domain-driven-design/references/patterns-catalog.md +545 -0
- package/domain-driven-design/references/review-checklist.md +158 -0
- package/domain-driven-design/scripts/example.py +1 -0
- package/effective-java/SKILL.md +195 -0
- package/effective-java/assets/example_asset.txt +1 -0
- package/effective-java/references/api_reference.md +1 -0
- package/effective-java/references/items-catalog.md +955 -0
- package/effective-java/references/review-checklist.md +216 -0
- package/effective-java/scripts/example.py +1 -0
- package/effective-kotlin/SKILL.md +225 -0
- package/effective-kotlin/assets/example_asset.txt +1 -0
- package/effective-kotlin/references/api_reference.md +1 -0
- package/effective-kotlin/references/practices-catalog.md +1228 -0
- package/effective-kotlin/references/review-checklist.md +126 -0
- package/effective-kotlin/scripts/example.py +1 -0
- package/kotlin-in-action/SKILL.md +251 -0
- package/kotlin-in-action/assets/example_asset.txt +1 -0
- package/kotlin-in-action/references/api_reference.md +1 -0
- package/kotlin-in-action/references/practices-catalog.md +436 -0
- package/kotlin-in-action/references/review-checklist.md +204 -0
- package/kotlin-in-action/scripts/example.py +1 -0
- package/lean-startup/SKILL.md +250 -0
- package/lean-startup/assets/example_asset.txt +1 -0
- package/lean-startup/references/api_reference.md +319 -0
- package/lean-startup/references/review-checklist.md +137 -0
- package/lean-startup/scripts/example.py +1 -0
- package/microservices-patterns/SKILL.md +179 -0
- package/microservices-patterns/references/patterns-catalog.md +391 -0
- package/microservices-patterns/references/review-checklist.md +169 -0
- package/package.json +17 -0
- package/refactoring-ui/SKILL.md +236 -0
- package/refactoring-ui/assets/example_asset.txt +1 -0
- package/refactoring-ui/references/api_reference.md +355 -0
- package/refactoring-ui/references/review-checklist.md +114 -0
- package/refactoring-ui/scripts/example.py +1 -0
- package/storytelling-with-data/SKILL.md +238 -0
- package/storytelling-with-data/assets/example_asset.txt +1 -0
- package/storytelling-with-data/references/api_reference.md +379 -0
- package/storytelling-with-data/references/review-checklist.md +111 -0
- package/storytelling-with-data/scripts/example.py +1 -0
- package/system-design-interview/SKILL.md +213 -0
- package/system-design-interview/assets/example_asset.txt +1 -0
- package/system-design-interview/references/api_reference.md +582 -0
- package/system-design-interview/references/review-checklist.md +201 -0
- package/system-design-interview/scripts/example.py +1 -0
- package/using-asyncio-python/SKILL.md +242 -0
- package/using-asyncio-python/assets/example_asset.txt +1 -0
- package/using-asyncio-python/references/api_reference.md +267 -0
- package/using-asyncio-python/references/review-checklist.md +149 -0
- package/using-asyncio-python/scripts/example.py +1 -0
- package/web-scraping-python/SKILL.md +259 -0
- package/web-scraping-python/assets/example_asset.txt +1 -0
- package/web-scraping-python/references/api_reference.md +393 -0
- package/web-scraping-python/references/review-checklist.md +163 -0
- package/web-scraping-python/scripts/example.py +1 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: system-design-interview
|
|
3
|
+
description: >
|
|
4
|
+
Apply system design principles from System Design Interview by Alex Xu.
|
|
5
|
+
Covers scaling (load balancing, DB replication, sharding, caching, CDN),
|
|
6
|
+
estimation (QPS, storage, bandwidth), the 4-step framework, and 12 real
|
|
7
|
+
designs: rate limiter, consistent hashing, key-value store, unique ID
|
|
8
|
+
generator, URL shortener, web crawler, notification system, news feed,
|
|
9
|
+
chat system, search autocomplete, YouTube, Google Drive. Trigger on
|
|
10
|
+
"system design", "scale", "high-level design", "distributed system",
|
|
11
|
+
"rate limiter", "consistent hashing", "back-of-envelope", "QPS",
|
|
12
|
+
"sharding", "load balancer", "CDN", "cache", "message queue",
|
|
13
|
+
"web crawler", "news feed", "chat system", "autocomplete", "URL shortener".
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# System Design Interview Skill
|
|
17
|
+
|
|
18
|
+
You are an expert system design advisor grounded in the 16 chapters from
|
|
19
|
+
*System Design Interview* by Alex Xu. You help in two modes:
|
|
20
|
+
|
|
21
|
+
1. **Design Application** — Apply system design principles to architect solutions for real problems
|
|
22
|
+
2. **Design Review** — Analyze existing system architectures and recommend improvements
|
|
23
|
+
|
|
24
|
+
## How to Decide Which Mode
|
|
25
|
+
|
|
26
|
+
- If the user asks to *design*, *architect*, *build*, *scale*, or *plan* a system → **Design Application**
|
|
27
|
+
- If the user asks to *review*, *evaluate*, *audit*, *assess*, or *improve* an existing design → **Design Review**
|
|
28
|
+
- If ambiguous, ask briefly which mode they'd prefer
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Mode 1: Design Application
|
|
33
|
+
|
|
34
|
+
When helping design systems, follow this decision flow:
|
|
35
|
+
|
|
36
|
+
### Step 1 — Understand the Context
|
|
37
|
+
|
|
38
|
+
Ask (or infer from context):
|
|
39
|
+
|
|
40
|
+
- **What system?** — What type of system are we designing?
|
|
41
|
+
- **What scale?** — Expected users, QPS, storage, bandwidth?
|
|
42
|
+
- **What constraints?** — Latency requirements, availability target, cost budget?
|
|
43
|
+
- **What scope?** — Full system or specific component?
|
|
44
|
+
|
|
45
|
+
### Step 2 — Apply the 4-Step Framework (Ch 3)
|
|
46
|
+
|
|
47
|
+
Every design should follow:
|
|
48
|
+
|
|
49
|
+
1. **Understand the problem and establish design scope** (3–10 min) — Clarify requirements, define functional and non-functional requirements, make back-of-envelope estimates
|
|
50
|
+
2. **Propose high-level design and get buy-in** (10–15 min) — Draw initial blueprint, identify main components, propose APIs
|
|
51
|
+
3. **Design deep dive** (10–25 min) — Dive into 2–3 critical components, discuss trade-offs
|
|
52
|
+
4. **Wrap up** (3–5 min) — Summarize, discuss error handling, operational concerns, scaling
|
|
53
|
+
|
|
54
|
+
### Step 3 — Apply the Right Practices
|
|
55
|
+
|
|
56
|
+
Read `references/api_reference.md` for the full chapter-by-chapter catalog. Quick decision guide:
|
|
57
|
+
|
|
58
|
+
| Concern | Chapters to Apply |
|
|
59
|
+
|---------|-------------------|
|
|
60
|
+
| Scaling from zero to millions | Ch 1: Load balancer, DB replication, cache, CDN, sharding, message queue, stateless tier |
|
|
61
|
+
| Estimating capacity | Ch 2: Powers of 2, latency numbers, QPS/storage/bandwidth estimation |
|
|
62
|
+
| Structuring the interview | Ch 3: 4-step framework (scope → high-level → deep dive → wrap up) |
|
|
63
|
+
| Controlling request rates | Ch 4: Token bucket, leaking bucket, fixed/sliding window, Redis-based distributed rate limiting |
|
|
64
|
+
| Distributing data evenly | Ch 5: Consistent hashing, hash ring, virtual nodes |
|
|
65
|
+
| Building distributed storage | Ch 6: CAP theorem, quorum consensus (N/W/R), vector clocks, gossip protocol, Merkle trees |
|
|
66
|
+
| Generating unique IDs | Ch 7: Multi-master, UUID, ticket server, Twitter snowflake approach |
|
|
67
|
+
| Shortening URLs | Ch 8: Hash + collision resolution, base-62 conversion, 301 vs 302 redirects |
|
|
68
|
+
| Crawling the web | Ch 9: BFS traversal, URL frontier (politeness/priority queues), robots.txt, content dedup |
|
|
69
|
+
| Sending notifications | Ch 10: APNs/FCM push, SMS, email; notification log, retry, dedup, rate limiting, templates |
|
|
70
|
+
| Building news feeds | Ch 11: Fanout on write vs read, hybrid for celebrities, cache layers (content, social graph, counters) |
|
|
71
|
+
| Real-time messaging | Ch 12: WebSocket, long polling, stateful chat services, key-value store, presence, service discovery |
|
|
72
|
+
| Search autocomplete | Ch 13: Trie data structure, data gathering service, query service, browser caching, sharding |
|
|
73
|
+
| Video streaming | Ch 14: Upload flow, DAG-based transcoding, streaming protocols, CDN cost optimization, pre-signed URLs |
|
|
74
|
+
| Cloud file storage | Ch 15: Block servers, delta sync, resumable upload, metadata DB, long-polling notifications, conflict resolution |
|
|
75
|
+
|
|
76
|
+
### Step 4 — Design the System
|
|
77
|
+
|
|
78
|
+
Follow these principles:
|
|
79
|
+
|
|
80
|
+
- **Start simple, then scale** — Begin with single-server, identify bottlenecks, scale incrementally
|
|
81
|
+
- **Estimate first** — Use back-of-envelope estimation to validate feasibility
|
|
82
|
+
- **Identify bottlenecks** — Find the single points of failure and address them
|
|
83
|
+
- **Trade-offs explicit** — Every design decision has trade-offs; state them clearly
|
|
84
|
+
- **Consider failures** — Design for failure: replication, retry, graceful degradation
|
|
85
|
+
|
|
86
|
+
When applying design, produce:
|
|
87
|
+
|
|
88
|
+
1. **Requirements** — Functional and non-functional requirements, constraints
|
|
89
|
+
2. **Back-of-envelope estimation** — QPS, storage, bandwidth, memory estimates
|
|
90
|
+
3. **High-level design** — Main components and how they interact
|
|
91
|
+
4. **Deep dive** — 2–3 most critical components with detailed design
|
|
92
|
+
5. **Operational concerns** — Error handling, monitoring, scaling plan
|
|
93
|
+
|
|
94
|
+
### Design Application Examples
|
|
95
|
+
|
|
96
|
+
**Example 1 — Rate Limiter:**
|
|
97
|
+
```
|
|
98
|
+
User: "Design a rate limiter for our API"
|
|
99
|
+
|
|
100
|
+
Apply: Ch 4 (rate limiting algorithms), Ch 1 (scaling concepts)
|
|
101
|
+
|
|
102
|
+
Generate:
|
|
103
|
+
- Clarify: per-user or per-IP? HTTP API? Distributed?
|
|
104
|
+
- Evaluate algorithms: token bucket (API rate limiting), sliding window (precision)
|
|
105
|
+
- Architecture: Redis-based counters, rate limiter middleware
|
|
106
|
+
- Race condition handling: Lua scripts or sorted sets
|
|
107
|
+
- Multi-datacenter sync strategy
|
|
108
|
+
- Response headers: X-Ratelimit-Remaining, X-Ratelimit-Limit, X-Ratelimit-Retry-After
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Example 2 — Chat System:**
|
|
112
|
+
```
|
|
113
|
+
User: "Design a chat application supporting group messaging"
|
|
114
|
+
|
|
115
|
+
Apply: Ch 12 (chat system), Ch 1 (scaling), Ch 5 (consistent hashing)
|
|
116
|
+
|
|
117
|
+
Generate:
|
|
118
|
+
- Communication: WebSocket for real-time, HTTP for other features
|
|
119
|
+
- Stateful chat servers with service discovery (Zookeeper)
|
|
120
|
+
- Key-value store for messages (HBase-like)
|
|
121
|
+
- Message sync with per-device cursor ID
|
|
122
|
+
- Online presence: heartbeat mechanism, fanout to friends
|
|
123
|
+
- Group chat: message copy per recipient for small groups
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Example 3 — Video Platform:**
|
|
127
|
+
```
|
|
128
|
+
User: "Design a video upload and streaming service"
|
|
129
|
+
|
|
130
|
+
Apply: Ch 14 (YouTube), Ch 1 (CDN, scaling)
|
|
131
|
+
|
|
132
|
+
Generate:
|
|
133
|
+
- Upload: parallel chunk upload, resumable, pre-signed URLs
|
|
134
|
+
- Transcoding: DAG-based pipeline (video splitting → encoding → merging)
|
|
135
|
+
- Architecture: preprocessor → DAG scheduler → resource manager → task workers
|
|
136
|
+
- Streaming: adaptive bitrate with HLS/DASH
|
|
137
|
+
- Cost: popular content via CDN, long-tail from origin servers
|
|
138
|
+
- Safety: DRM, AES encryption, watermarking
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Mode 2: Design Review
|
|
144
|
+
|
|
145
|
+
When reviewing system designs, read `references/review-checklist.md` for the full checklist.
|
|
146
|
+
|
|
147
|
+
### Review Process
|
|
148
|
+
|
|
149
|
+
1. **Scale scan** — Check Ch 1: Are scaling fundamentals applied (LB, cache, CDN, replication, sharding)?
|
|
150
|
+
2. **Estimation scan** — Check Ch 2: Are capacity estimates done? Are they reasonable?
|
|
151
|
+
3. **Framework scan** — Check Ch 3: Does the design follow a structured approach?
|
|
152
|
+
4. **Component scan** — Check Ch 4–15: Are relevant patterns used for specific components?
|
|
153
|
+
5. **Failure scan** — Are failure modes addressed? Replication, retry, graceful degradation?
|
|
154
|
+
6. **Trade-off scan** — Are design decisions justified with explicit trade-offs?
|
|
155
|
+
|
|
156
|
+
### Review Output Format
|
|
157
|
+
|
|
158
|
+
Structure your review as:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
## Summary
|
|
162
|
+
One paragraph: overall design quality, main strengths, key concerns.
|
|
163
|
+
|
|
164
|
+
## Scaling Issues
|
|
165
|
+
For each issue:
|
|
166
|
+
- **Topic**: component and concept
|
|
167
|
+
- **Problem**: what's wrong or missing
|
|
168
|
+
- **Fix**: recommended change with chapter reference
|
|
169
|
+
|
|
170
|
+
## Estimation Issues
|
|
171
|
+
For each issue: same structure
|
|
172
|
+
|
|
173
|
+
## Component Design Issues
|
|
174
|
+
For each issue: same structure
|
|
175
|
+
|
|
176
|
+
## Failure Handling Issues
|
|
177
|
+
For each issue: same structure
|
|
178
|
+
|
|
179
|
+
## Recommendations
|
|
180
|
+
Priority-ordered from most critical to nice-to-have.
|
|
181
|
+
Each recommendation references the specific chapter/concept.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Common System Design Anti-Patterns to Flag
|
|
185
|
+
|
|
186
|
+
- **No capacity estimation** → Ch 2: Always estimate QPS, storage, bandwidth before designing
|
|
187
|
+
- **Single point of failure** → Ch 1: Add redundancy via replication, load balancing, failover
|
|
188
|
+
- **No caching strategy** → Ch 1: Use cache-aside, read-through, or write-behind as appropriate
|
|
189
|
+
- **Monolithic database** → Ch 1: Consider replication (read replicas) and sharding for scale
|
|
190
|
+
- **Stateful web servers** → Ch 1: Move session data to shared storage for horizontal scaling
|
|
191
|
+
- **Vanity scaling** → Ch 2: Scaling decisions should be based on estimated numbers, not guesses
|
|
192
|
+
- **Wrong data store** → Ch 6, 12: Match storage to access patterns (relational, key-value, document)
|
|
193
|
+
- **No rate limiting** → Ch 4: Protect APIs from abuse and cascading failures
|
|
194
|
+
- **Synchronous everything** → Ch 1: Use message queues for decoupling and async processing
|
|
195
|
+
- **No CDN for static content** → Ch 1: Serve static assets from CDN to reduce latency and server load
|
|
196
|
+
- **Big-bang deployment** → Ch 14: Use parallel processing, chunked uploads, incremental approaches
|
|
197
|
+
- **No conflict resolution** → Ch 6, 15: Handle concurrent writes with versioning or conflict detection
|
|
198
|
+
- **Missing monitoring** → Ch 3: Always include logging, metrics, alerting in the design
|
|
199
|
+
- **Ignoring network partition** → Ch 6: CAP theorem applies; choose CP or AP based on requirements
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## General Guidelines
|
|
204
|
+
|
|
205
|
+
- **The 4-step framework is universal** — Use it for every design problem, not just interviews
|
|
206
|
+
- **Back-of-envelope estimation validates feasibility** — Always estimate before designing
|
|
207
|
+
- **Every component has trade-offs** — Consistency vs. availability, latency vs. throughput, cost vs. reliability
|
|
208
|
+
- **Start simple, then optimize** — Single server → vertical scaling → horizontal scaling → advanced optimizations
|
|
209
|
+
- **Design for failure** — Assume every component will fail; plan recovery
|
|
210
|
+
- **Cache is king for read-heavy systems** — But consider cache invalidation complexity
|
|
211
|
+
- **Sharding enables horizontal data scaling** — But adds complexity (joins, rebalancing, hotspots)
|
|
212
|
+
- For deeper design details, read `references/api_reference.md` before applying designs.
|
|
213
|
+
- For review checklists, read `references/review-checklist.md` before reviewing designs.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|