opensearch-sugar 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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.agents/skills/diataxis/SKILL.md +142 -0
  3. data/.agents/skills/diataxis/references/examples.md +420 -0
  4. data/.agents/skills/diataxis/references/explanation-template.md +96 -0
  5. data/.agents/skills/diataxis/references/framework.md +400 -0
  6. data/.agents/skills/diataxis/references/how-to-guide-template.md +105 -0
  7. data/.agents/skills/diataxis/references/reference-template.md +110 -0
  8. data/.agents/skills/diataxis/references/tutorial-template.md +101 -0
  9. data/.agents/skills/diataxis/scripts/generate_index.py +139 -0
  10. data/.rspec +3 -0
  11. data/.standard.yml +3 -0
  12. data/AGENTS.md +120 -0
  13. data/CHANGELOG.md +5 -0
  14. data/Dockerfile.opensearch +4 -0
  15. data/Increase_Coverage.md +311 -0
  16. data/README.md +143 -0
  17. data/Rakefile +27 -0
  18. data/Steepfile +23 -0
  19. data/adrs/ADR-000-template.md +87 -0
  20. data/adrs/ADR-001-simpledelegator-for-client.md +138 -0
  21. data/adrs/ADR-002-facade-pattern-for-index.md +126 -0
  22. data/adrs/ADR-003-repository-pattern-for-models.md +148 -0
  23. data/adrs/ADR-004-integration-tests-no-mocking.md +91 -0
  24. data/adrs/ADR-005-exceptions-over-result-objects.md +107 -0
  25. data/adrs/ADR-006-ssl-on-by-default.md +95 -0
  26. data/adrs/ADR-007-selective-sugar-surface.md +118 -0
  27. data/adrs/ADR-008-integration-test-design.md +178 -0
  28. data/compose.yml +2 -0
  29. data/compose_opensearch.yml +31 -0
  30. data/docs/HOWTO.md +844 -0
  31. data/docs/REFERENCE.md +725 -0
  32. data/docs/TUTORIAL.md +327 -0
  33. data/docs/alias-api-design-notes.md +119 -0
  34. data/lib/opensearch/sugar/client.rb +300 -0
  35. data/lib/opensearch/sugar/index/include/utilities.rb +6 -0
  36. data/lib/opensearch/sugar/index.rb +339 -0
  37. data/lib/opensearch/sugar/models.rb +209 -0
  38. data/lib/opensearch/sugar/version.rb +8 -0
  39. data/lib/opensearch/sugar.rb +61 -0
  40. data/old_docs/DELEGATED_METHODS_ANALYSIS.md +361 -0
  41. data/old_docs/EXPLANATION.md +685 -0
  42. data/old_docs/README.md +155 -0
  43. data/old_docs/docs/CLI-PROPOSAL.md +257 -0
  44. data/old_docs/docs/HOWTO.md +798 -0
  45. data/old_docs/docs/REFERENCE.md +901 -0
  46. data/old_docs/docs/TUTORIAL.md +493 -0
  47. data/sig/opensearch/sugar.rbs +162 -0
  48. metadata +240 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6d1486b22e98b74ba4476a37426aec9731b02b6a7a77205a3efd887b9b4a7a4a
4
+ data.tar.gz: 0af59b7653390f2a19b6226a8addd7d61b73cad37e0261001a2a8aac8f23c06e
5
+ SHA512:
6
+ metadata.gz: 7ca00642cf6bf0b9ba3fdfb28d95e22c5a76b2ffa5b50bf4decca0f76a390a40c82556cd6f44ce60f168c09ef14777b06c8de1d6d08504e0e070ae539810449b
7
+ data.tar.gz: 26c12cdf67f9a1dd2e01006d21b05bb088ededb6a75672e9263734fe9caafa47fec52f1057e1b53c95d8c4f6227a552e62138d6c1302de7ebec6bcef80b03c7c
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: diataxis
3
+ description: Create and evaluate documentation using the Diátaxis framework. Use when writing, organizing, or auditing documentation to ensure it serves distinct user needs through four systematic categories (Tutorials, How-to Guides, Reference, Explanation). Ideal for diagnosing documentation problems, separating mixed content, and ensuring each piece serves a single, clear purpose.
4
+ metadata:
5
+ version: 1.0.0
6
+ author: arisng
7
+ ---
8
+
9
+ # Diátaxis Documentation Skill
10
+
11
+ The **Diátaxis framework** organizes documentation by user need, not by topic. This skill helps you create documentation that works for your audience.
12
+
13
+ ## The Four Categories
14
+
15
+ Diátaxis distinguishes four documentation needs using a 2×2 matrix:
16
+
17
+ | | **Practical** | **Theoretical** |
18
+ | ------------ | ----------------- | --------------- |
19
+ | **Learning** | **Tutorials** | **Explanation** |
20
+ | **Working** | **How-to Guides** | **Reference** |
21
+
22
+ ### Quick Reference
23
+
24
+ - **Tutorials** (Learning + Practical): "Teach me by doing"
25
+ - **How-to Guides** (Working + Practical): "Help me accomplish X"
26
+ - **Reference** (Working + Theoretical): "Tell me how things work"
27
+ - **Explanation** (Learning + Theoretical): "Help me understand why"
28
+
29
+ ## Working With Documentation
30
+
31
+ ### 1. Diagnose What You Have
32
+
33
+ When given documentation, determine which category it belongs to:
34
+
35
+ - **Is it teaching or working?** (Axis 1)
36
+ - **Is it practical or theoretical?** (Axis 2)
37
+ - **Does it serve a single purpose or is it mixed?**
38
+
39
+ ### 2. Identify Problems
40
+
41
+ Common documentation problems map to mixing categories:
42
+
43
+ - **Tutorials polluted with explanation** → Users get lost in "why" when they should focus on "do"
44
+ - **How-to guides that teach** → Assumes no prior knowledge; should link to tutorials instead
45
+ - **Reference missing examples** → Should show, not just describe
46
+ - **Explanation that instructs** → Should link to how-to guides instead
47
+ - **Missing entire categories** → Product has only reference; users can't get started
48
+
49
+ ### 3. Choose the Right Template
50
+
51
+ When writing documentation, use the appropriate template:
52
+
53
+ - **Writing a tutorial?** See [tutorial-template.md](references/tutorial-template.md)
54
+ - **Writing a how-to guide?** See [how-to-guide-template.md](references/how-to-guide-template.md)
55
+ - **Writing reference?** See [reference-template.md](references/reference-template.md)
56
+ - **Writing explanation?** See [explanation-template.md](references/explanation-template.md)
57
+ - **Want real-world examples?** See [examples.md](references/examples.md)
58
+
59
+ ### 4. Apply Category-Specific Principles
60
+
61
+ See [framework.md](references/framework.md) for detailed principles, language patterns, and anti-patterns for each category.
62
+
63
+ ### 5. Structure Output
64
+
65
+ Create documentation in this structure:
66
+
67
+ ```
68
+ .docs/
69
+ ├── tutorials/ # Learning-oriented lessons
70
+ │ └── [topic]/
71
+ ├── how-to/ # Task-oriented guides
72
+ │ └── [domain]/
73
+ ├── reference/ # Technical descriptions
74
+ │ └── [component]/
75
+ ├── explanation/ # Conceptual discussions
76
+ │ └── [subject]/
77
+ └── index.md # Navigation (generated automatically)
78
+ ```
79
+
80
+ **Naming conventions:**
81
+ - Use `kebab-case` for all files and folders
82
+ - Tutorials: `getting-started-with-x.md`, `your-first-y.md`
83
+ - How-to: `how-to-configure-x.md`, `how-to-deploy-y.md`
84
+ - Reference: `api-reference.md`, `configuration-options.md`
85
+ - Explanation: `about-architecture.md`, `understanding-x.md`
86
+
87
+ ### 6. Generate Index
88
+
89
+ Use the Python script to automatically generate the `index.md` file:
90
+
91
+ ```bash
92
+ python skills/diataxis/scripts/generate_index.py
93
+ ```
94
+
95
+ This script scans the `.docs/` subfolders, extracts titles from `.md` files, and creates links organized by category. Run it whenever you add or remove documentation files to keep the index up-to-date.
96
+
97
+ ## Common Workflows
98
+
99
+ ### Auditing existing documentation
100
+
101
+ 1. Read through each document
102
+ 2. Determine which category it belongs to
103
+ 3. Flag content that belongs in other categories
104
+ 4. Suggest extractions or links to separate content
105
+ 5. Check for "category pollution" (mixing purposes)
106
+
107
+ ### Writing new documentation
108
+
109
+ 1. Identify the user need (learning/working, practical/theoretical)
110
+ 2. Choose the appropriate category
111
+ 3. Find the right template:
112
+ - Tutorial: [tutorial-template.md](references/tutorial-template.md)
113
+ - How-to: [how-to-guide-template.md](references/how-to-guide-template.md)
114
+ - Reference: [reference-template.md](references/reference-template.md)
115
+ - Explanation: [explanation-template.md](references/explanation-template.md)
116
+ 4. Use category-specific language patterns (in template)
117
+ 5. See [examples.md](references/examples.md) for production-grade examples
118
+ 6. Save in the correct folder structure
119
+
120
+ ### Refactoring mixed content
121
+
122
+ 1. Read the mixed document
123
+ 2. Identify sections that belong in different categories
124
+ 3. Create separate files for each category
125
+ 4. In each file, link to related content in other categories
126
+ 5. Remove the original mixed document
127
+
128
+ ### Generating the documentation index
129
+
130
+ To keep the documentation index consistent and up-to-date:
131
+
132
+ 1. Ensure all documentation files are placed in the appropriate `.docs/` subfolders (`tutorials/`, `how-to/`, `reference/`, `explanation/`).
133
+ 2. Run the generation script: `python skills/diataxis/scripts/generate_index.py`
134
+ 3. The script will automatically scan for `.md` files, extract their titles, and update `.docs/index.md` with organized links.
135
+
136
+ This workflow should be used after adding new documents or restructuring existing ones.
137
+
138
+ ## Key Principle
139
+
140
+ **Every document should serve exactly one user need.** When content serves multiple needs, separate it into multiple documents and link them together. This is better than trying to serve all needs in one place.
141
+
142
+ Remember: *The first rule of teaching is simply: don't try to teach.* Let the structure and the doing facilitate learning.
@@ -0,0 +1,420 @@
1
+ # Real-World Diataxis Examples
2
+
3
+ Complete, production-grade examples for each documentation type.
4
+
5
+ ## Table of Contents
6
+ 1. [Example 1: Tutorial](#example-1-tutorial)
7
+ 2. [Example 2: How-to Guide](#example-2-how-to-guide)
8
+ 3. [Example 3: Reference](#example-3-reference)
9
+ 4. [Example 4: Explanation](#example-4-explanation)
10
+
11
+ ---
12
+
13
+ ## Example 1: Tutorial
14
+
15
+ **Source**: Getting started with a Python web framework
16
+
17
+ ```markdown
18
+ # Your First Django App
19
+
20
+ Create a simple blogging application with posts and comments.
21
+
22
+ ## What you'll build
23
+
24
+ A working blog where you can create, read, and delete posts. By the end,
25
+ you'll understand Django's MVT (Model-View-Template) architecture.
26
+
27
+ ## Before you start
28
+
29
+ - Python 3.8+ installed
30
+ - pip installed
31
+ - Basic familiarity with command line
32
+ - A code editor (VS Code, Sublime, etc.)
33
+
34
+ ## Step 1: Create a project directory
35
+
36
+ ```bash
37
+ mkdir my_blog
38
+ cd my_blog
39
+ ```
40
+
41
+ Notice that you're now inside the directory. Your prompt should show `my_blog`
42
+ in the path.
43
+
44
+ ## Step 2: Create a virtual environment
45
+
46
+ ```bash
47
+ python -m venv venv
48
+ source venv/bin/activate # On Windows: venv\Scripts\activate
49
+ ```
50
+
51
+ The prompt should now start with `(venv)`. This means the virtual
52
+ environment is active.
53
+
54
+ ## Step 3: Install Django
55
+
56
+ ```bash
57
+ pip install django
58
+ ```
59
+
60
+ Wait a moment for installation. You should see "Successfully installed Django"
61
+ in your terminal.
62
+
63
+ ## Step 4: Create a Django project
64
+
65
+ ```bash
66
+ django-admin startproject blog_config .
67
+ django-admin startapp blog
68
+ ```
69
+
70
+ You should see new folders: `blog_config/` and a `blog/` folder.
71
+
72
+ ## Step 5: Run the development server
73
+
74
+ ```bash
75
+ python manage.py runserver
76
+ ```
77
+
78
+ The output will show:
79
+
80
+ ```
81
+ Starting development server at http://127.0.0.1:8000/
82
+ ```
83
+
84
+ Open your browser and visit `http://127.0.0.1:8000/`. You should see
85
+ Django's welcome page.
86
+
87
+ ## Step 6: Create a simple model
88
+
89
+ Edit `blog/models.py`:
90
+
91
+ ```python
92
+ from django.db import models
93
+
94
+ class Post(models.Model):
95
+ title = models.CharField(max_length=200)
96
+ content = models.TextField()
97
+ created_at = models.DateTimeField(auto_now_add=True)
98
+
99
+ def __str__(self):
100
+ return self.title
101
+ ```
102
+
103
+ Notice that we've defined what a Post is: it has a title, content, and
104
+ creation timestamp.
105
+
106
+ ## What you've built
107
+
108
+ You've created a Django project with a Post model. You now understand how
109
+ Django organizes projects, applications, and data models. Your development
110
+ server is running, and you can extend it by creating views and templates.
111
+
112
+ ## Next steps
113
+
114
+ - **Customize it**: [How to add comment functionality](...)
115
+ - **Understand it**: [About Django's MVT architecture](...)
116
+ - **Explore**: [Django models reference](...)
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Example 2: How-to Guide
122
+
123
+ **Source**: Deploying a database migration
124
+
125
+ ```markdown
126
+ # How to migrate a PostgreSQL database with zero downtime
127
+
128
+ This guide shows you how to move your database to a new server while
129
+ keeping your application running.
130
+
131
+ ## When to use this guide
132
+
133
+ Use this when you need to move PostgreSQL to new infrastructure
134
+ (new server, new provider, new region) while serving live traffic.
135
+
136
+ ## Before you start
137
+
138
+ - PostgreSQL 9.5+ on both source and destination
139
+ - A standby server or read replica capability
140
+ - SSH access to both servers
141
+ - About 30-60 minutes of work
142
+
143
+ ## Context
144
+
145
+ Zero-downtime migration works by setting up replication from your old
146
+ database to the new one, letting it catch up, then switching your
147
+ application to use the new server. The entire switch takes seconds.
148
+
149
+ ## Steps
150
+
151
+ ### 1. Set up replication from source to destination
152
+
153
+ ```bash
154
+ psql -h source-server -U postgres -c "SELECT pg_start_backup('migration', true);"
155
+ ```
156
+
157
+ This creates a consistent backup point that the destination can follow.
158
+
159
+ ### 2. Backup the source database
160
+
161
+ ```bash
162
+ pg_basebackup -h source-server -D /var/lib/postgresql/backup -P -v
163
+ ```
164
+
165
+ This creates a full backup of your source database. On a large database,
166
+ this may take several minutes.
167
+
168
+ ### 3. Start replication on destination
169
+
170
+ ```bash
171
+ psql -h dest-server -c "ALTER SYSTEM SET primary_conninfo = 'host=source-server ...'"
172
+ pg_ctl -D /path/to/data restart
173
+ ```
174
+
175
+ Wait 5-10 seconds for replication to establish. Check status with `pg_stat_replication`
176
+ on the source.
177
+
178
+ ### 4. Monitor replication lag
179
+
180
+ ```bash
181
+ psql -h source-server -U postgres -c "SELECT slot_name, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots;"
182
+ ```
183
+
184
+ Replication lag is normal. Wait until it reaches zero before switching.
185
+
186
+ ### 5. Switch application to use destination
187
+
188
+ Update your connection string to point to the new server. This typically takes
189
+ 2-5 seconds per application instance.
190
+
191
+ ```bash
192
+ # Update config and restart app
193
+ systemctl restart myapp
194
+ ```
195
+
196
+ ### 6. Verify everything works
197
+
198
+ ```bash
199
+ psql -h dest-server -c "SELECT count(*) FROM [your_table];"
200
+ ```
201
+
202
+ Compare the row count to your source. They should match.
203
+
204
+ ## Troubleshooting
205
+
206
+ **Problem: Replication lag is too high**
207
+ Solution: The source is getting too much write traffic during migration.
208
+ Reduce application load or increase network bandwidth. Lag is normal; wait
209
+ until it syncs before switching.
210
+
211
+ **Problem: Application fails after switching**
212
+ Solution: Check your new connection string. A common issue is firewall
213
+ blocking the new destination. Test connectivity: `pg_isready -h dest-server`
214
+
215
+ **Problem: Replication doesn't start**
216
+ Solution: Ensure the destination server is empty or a clean backup. Also
217
+ verify network connectivity: `ping dest-server` and check firewall rules
218
+ for port 5432.
219
+
220
+ ## Variations
221
+
222
+ If you're using Amazon RDS, use AWS Database Migration Service instead.
223
+ It handles replication automatically.
224
+
225
+ If you're on MySQL, the process is similar but use `mysqldump` and
226
+ `mysqlbinlog` for replication.
227
+
228
+ ## Related guides
229
+
230
+ - [How to set up read replicas](...)
231
+ - [How to monitor replication lag](...)
232
+ - [How to handle network failures during migration](...)
233
+
234
+ ## See also
235
+
236
+ - [About PostgreSQL replication architecture](...)
237
+ - [Troubleshooting PostgreSQL connection issues](...)
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Example 3: Reference
243
+
244
+ **Source**: API endpoint reference
245
+
246
+ ```markdown
247
+ # POST /api/articles Reference
248
+
249
+ Create a new article.
250
+
251
+ ## Request
252
+
253
+ **Endpoint**: `POST /api/articles`
254
+
255
+ **Authentication**: Required. Bearer token in Authorization header.
256
+
257
+ **Headers**
258
+ | Header | Value |
259
+ |--------|-------|
260
+ | Authorization | `Bearer {jwt_token}` |
261
+ | Content-Type | `application/json` |
262
+
263
+ **Body**
264
+ | Field | Type | Required | Description |
265
+ |-------|------|----------|-------------|
266
+ | title | string | Yes | Article title, 1-200 characters |
267
+ | content | string | Yes | Article body, 1-50000 characters |
268
+ | published | boolean | No | Default: false. If true, article is immediately visible |
269
+ | tags | array | No | Up to 10 tags. Each 1-50 characters |
270
+
271
+ ## Response
272
+
273
+ **Status**: 201 Created
274
+
275
+ **Body**
276
+ ```json
277
+ {
278
+ "id": "art_abc123",
279
+ "title": "My Article",
280
+ "content": "...",
281
+ "published": false,
282
+ "tags": ["tech", "tutorial"],
283
+ "created_at": "2025-12-19T10:30:00Z",
284
+ "updated_at": "2025-12-19T10:30:00Z"
285
+ }
286
+ ```
287
+
288
+ ## Example
289
+
290
+ ```bash
291
+ curl -X POST https://api.example.com/api/articles \
292
+ -H "Authorization: Bearer eyJhbGc..." \
293
+ -H "Content-Type: application/json" \
294
+ -d '{
295
+ "title": "Getting Started with API",
296
+ "content": "This is my first article...",
297
+ "tags": ["api", "guide"]
298
+ }'
299
+ ```
300
+
301
+ ## Errors
302
+
303
+ | Status | Code | Meaning |
304
+ |--------|------|---------|
305
+ | 400 | invalid_input | Title or content missing, or exceeds limits |
306
+ | 401 | unauthorized | Token missing or invalid |
307
+ | 403 | forbidden | User lacks permission to create articles |
308
+ | 409 | duplicate | Title already exists (if title uniqueness enforced) |
309
+
310
+ ## Notes
311
+
312
+ - Articles are created in draft status by default. Publish them separately.
313
+ - Titles must be unique across your account.
314
+ - Content supports Markdown formatting.
315
+ - Maximum request size: 1MB
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Example 4: Explanation
321
+
322
+ **Source**: Understanding API rate limiting
323
+
324
+ ```markdown
325
+ # About API rate limiting
326
+
327
+ Rate limiting is the practice of restricting how many requests a client
328
+ can make to an API in a given time window.
329
+
330
+ ## Background
331
+
332
+ Early APIs had no limits, which led to problems: a single misbehaving
333
+ client could overwhelm the server, hurting all users. As APIs became
334
+ critical infrastructure, rate limiting became essential—as important
335
+ as circuit breakers in electrical systems.
336
+
337
+ Different services implement rate limiting differently. Some (like AWS)
338
+ tie it to your plan. Others (like Twitter) tie it to your authentication.
339
+ This reflects different business models and reliability needs.
340
+
341
+ ## The core concept
342
+
343
+ Rate limiting works by associating requests with an identity (API key,
344
+ user, IP address) and counting them. When a request would exceed the
345
+ limit, it's rejected with a 429 status.
346
+
347
+ From the user's perspective, rate limits represent a contract: "You can
348
+ make this many requests per minute. Plan accordingly."
349
+
350
+ ## Token bucket vs. sliding window
351
+
352
+ Rate limiting algorithms fall into two main categories.
353
+
354
+ **Token bucket** (used by most modern APIs) works like a bucket that
355
+ refills at a constant rate. Every request costs one token. When the bucket
356
+ is empty, requests are denied. This approach allows bursts: if you didn't
357
+ use your tokens, you can use more now.
358
+
359
+ Example: Stripe allows 100 requests per second, but with token bucket
360
+ algorithm, you could make 500 requests in 5 seconds if you hadn't made
361
+ any requests before.
362
+
363
+ **Sliding window** counts requests in a rolling time window. Strictly
364
+ enforces the limit over any N-second window. This prevents bursts, which
365
+ is useful for protecting against denial-of-service attacks.
366
+
367
+ Google Cloud uses sliding window. You get a hard cap: no more than 1000
368
+ requests per minute, period.
369
+
370
+ ## Why your API cares about limits
371
+
372
+ Protecting infrastructure is one reason, but not the only reason:
373
+
374
+ - **Fairness**: Ensures one large customer doesn't monopolize resources
375
+ - **Predictability**: Users can build reliable systems if they know the limit
376
+ - **Cost management**: For usage-based pricing, limits enforce billing tiers
377
+ - **Security**: Limits prevent brute-force attacks (credential stuffing, DDoS)
378
+
379
+ ## Comparison to authentication
380
+
381
+ Rate limiting is often confused with authentication, but they're distinct:
382
+
383
+ - **Authentication** answers: "Who are you?" (Validated by token)
384
+ - **Rate limiting** answers: "How much can you do?" (Enforced by counter)
385
+
386
+ You can be authenticated (pass token) but rate-limited (hit the ceiling).
387
+ This is actually a good design: it lets legitimate users be identified
388
+ while still protecting the service.
389
+
390
+ ## Different perspectives
391
+
392
+ Some argue rate limits should be generous because they build trust: "If
393
+ you trust me, let me make 10,000 requests per minute." This is good for
394
+ developer experience during development.
395
+
396
+ Others argue limits should be strict because one bad client can hurt
397
+ everyone: "Everyone gets 100 requests per minute, no exceptions." This
398
+ protects the service.
399
+
400
+ Most production APIs do both: generous limits for authenticated users
401
+ (based on their plan) and very strict limits for unauthenticated requests.
402
+
403
+ ## Further reading
404
+
405
+ - **Learn it**: [Tutorial: Handling rate limit responses](...)
406
+ - **Use it**: [How to design rate limits for your API](...)
407
+ - **Details**: [Rate limits reference documentation](...)
408
+ ```
409
+
410
+ ---
411
+
412
+ ## Using These Examples
413
+
414
+ Each example above is **production-ready code** you can:
415
+ - Copy and adapt for your own documentation
416
+ - Use as a reference when writing similar documentation
417
+ - Share with your team as a style guide
418
+ - Test to ensure it actually works
419
+
420
+ The examples follow the principles and language patterns from their respective template files.
@@ -0,0 +1,96 @@
1
+ # Explanation Template
2
+
3
+ **Purpose**: Deepen understanding by providing context, history, and perspective. User reads when reflecting.
4
+
5
+ **Key Characteristics**:
6
+ - Provides context, background, and history
7
+ - Makes connections to other concepts
8
+ - Discusses "why", not "how"
9
+ - Admits perspectives and alternatives
10
+ - Bounded to a single topic
11
+
12
+ ## Structure
13
+
14
+ ```markdown
15
+ # About [Subject]
16
+
17
+ [One sentence introducing what this is about]
18
+
19
+ ## Background
20
+
21
+ [Historical context: why this matters, when it was introduced, or how it evolved]
22
+
23
+ Example: "Caching has been essential to web performance since the early
24
+ days of the internet, when bandwidth was scarce. While bandwidth is
25
+ cheaper now, caching remains critical because latency directly affects
26
+ user experience."
27
+
28
+ ## The core concept
29
+
30
+ [What is this fundamentally, without being instructional]
31
+
32
+ ## [Aspect 1: Design consideration]
33
+
34
+ [Discuss why this was chosen, tradeoffs, alternatives]
35
+
36
+ Example: "We chose Event-Sourcing because it provides a complete audit
37
+ trail. The tradeoff is that queries are more complex; traditional
38
+ databases offer simpler queries but lose the ability to see historical state."
39
+
40
+ ## [Aspect 2: Another consideration]
41
+
42
+ [Same approach: discuss why, tradeoffs, alternatives]
43
+
44
+ ## Comparison to [related concept]
45
+
46
+ [How this relates to similar ideas]
47
+
48
+ Example: "Unlike traditional caching, which discards old data, Event
49
+ Sourcing preserves the entire history. This is similar to a version
50
+ control system like Git, where every change is recorded."
51
+
52
+ ## Different perspectives
53
+
54
+ Some teams prefer [Approach A] because [reason]. This works well when
55
+ [condition], but can be problematic when [condition].
56
+
57
+ Others prefer [Approach B] because [reason]. This is better suited for
58
+ [situation], though it requires [tradeoff].
59
+
60
+ ## Further reading
61
+
62
+ - **Learn it**: [Link to Tutorial]
63
+ - **Use it**: [Link to How-to Guide]
64
+ - **Details**: [Link to Reference]
65
+ ```
66
+
67
+ ## Language Patterns
68
+
69
+ Use these patterns consistently throughout your explanation:
70
+
71
+ | Pattern | Example |
72
+ |---------|---------|
73
+ | **The reason for X is because historically, Y** | "The reason we use semver is because it emerged from the open-source community's need for predictable versioning." |
74
+ | **W is better than Z, because** | "Immutability is better than shared state because it eliminates entire categories of race conditions." |
75
+ | **X in system Y is analogous to W in system Z** | "A microservice in our architecture is analogous to a module in traditional monoliths—isolated, focused, and independently deployable." |
76
+ | **Some prefer W because Z. This is good when** | "Some teams prefer GraphQL because it reduces over-fetching. This is beneficial when you have diverse client needs." |
77
+
78
+ ## Key Principles to Remember
79
+
80
+ ✓ **Make connections** — Relate to other concepts and contexts
81
+
82
+ ✓ **Provide context** — Design decisions, history, constraints, tradeoffs
83
+
84
+ ✓ **Talk about the subject** — Titles should work with "About…" prefix
85
+
86
+ ✓ **Admit perspective** — Acknowledge limitations and alternatives
87
+
88
+ ✓ **Weigh alternatives** — Show why one approach is chosen over others
89
+
90
+ ✓ **Bound the discussion** — Don't absorb instructions or reference
91
+
92
+ ✓ **Answer "why" questions** — Not "how" or "what"
93
+
94
+ ## Example
95
+
96
+ See [examples.md](examples.md#example-4-explanation) for a complete working example: "About API rate limiting"