@neyugn/agent-kits 0.5.1 → 0.5.4
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/common/skills/filter-agent/SKILL.md +33 -45
- package/common/skills/filter-skill/SKILL.md +51 -73
- package/common/skills/scan-techstack/SKILL.md +30 -36
- package/kits/coder/agents/ai-engineer.md +27 -39
- package/kits/coder/agents/backend-specialist.md +31 -45
- package/kits/coder/agents/cloud-architect.md +31 -45
- package/kits/coder/agents/code-reviewer.md +45 -67
- package/kits/coder/agents/data-engineer.md +22 -32
- package/kits/coder/agents/database-specialist.md +30 -44
- package/kits/coder/agents/debugger.md +28 -42
- package/kits/coder/agents/devops-engineer.md +35 -53
- package/kits/coder/agents/documentation-writer.md +48 -68
- package/kits/coder/agents/frontend-specialist.md +30 -46
- package/kits/coder/agents/i18n-specialist.md +37 -51
- package/kits/coder/agents/integration-specialist.md +38 -54
- package/kits/coder/agents/mobile-developer.md +37 -53
- package/kits/coder/agents/multi-tenant-architect.md +25 -37
- package/kits/coder/agents/orchestrator.md +20 -32
- package/kits/coder/agents/performance-analyst.md +43 -65
- package/kits/coder/agents/project-planner.md +25 -39
- package/kits/coder/agents/queue-specialist.md +26 -38
- package/kits/coder/agents/realtime-specialist.md +44 -64
- package/kits/coder/agents/security-auditor.md +44 -64
- package/kits/coder/agents/test-engineer.md +30 -44
- package/kits/coder/agents/ux-researcher.md +26 -38
- package/kits/coder/rules/AGENTS.md +3 -1
- package/kits/coder/rules/CLAUDE.md +3 -1
- package/kits/coder/rules/CURSOR.md +8 -1
- package/kits/coder/rules/GEMINI.md +6 -1
- package/kits/coder/rules/OPENCODE.md +3 -1
- package/kits/coder/rules/sections/classifier.md +11 -7
- package/kits/coder/rules/sections/code.md +5 -4
- package/kits/coder/rules/sections/routing.md +10 -2
- package/kits/coder/rules/sections/universal.md +2 -0
- package/kits/coder/skills/accessibility-patterns/SKILL.md +67 -81
- package/kits/coder/skills/ai-rag-patterns/SKILL.md +27 -23
- package/kits/coder/skills/api-patterns/SKILL.md +40 -43
- package/kits/coder/skills/auth-patterns/SKILL.md +47 -51
- package/kits/coder/skills/aws-patterns/SKILL.md +52 -57
- package/kits/coder/skills/brainstorming/SKILL.md +26 -23
- package/kits/coder/skills/clean-code/SKILL.md +74 -90
- package/kits/coder/skills/database-design/SKILL.md +32 -31
- package/kits/coder/skills/docker-patterns/SKILL.md +46 -49
- package/kits/coder/skills/documentation-templates/SKILL.md +21 -13
- package/kits/coder/skills/e2e-testing/SKILL.md +52 -58
- package/kits/coder/skills/flutter-patterns/SKILL.md +44 -46
- package/kits/coder/skills/frontend-design/SKILL.md +28 -24
- package/kits/coder/skills/github-actions/SKILL.md +43 -45
- package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +35 -33
- package/kits/coder/skills/graphql-patterns/SKILL.md +35 -33
- package/kits/coder/skills/i18n-localization/SKILL.md +37 -35
- package/kits/coder/skills/kubernetes-patterns/SKILL.md +35 -33
- package/kits/coder/skills/mermaid-diagrams/SKILL.md +54 -60
- package/kits/coder/skills/mobile-design/SKILL.md +51 -61
- package/kits/coder/skills/monitoring-observability/SKILL.md +32 -30
- package/kits/coder/skills/multi-tenancy/SKILL.md +16 -8
- package/kits/coder/skills/nodejs-best-practices/SKILL.md +19 -14
- package/kits/coder/skills/performance-profiling/SKILL.md +31 -29
- package/kits/coder/skills/plan-writing/SKILL.md +52 -59
- package/kits/coder/skills/postgres-patterns/SKILL.md +39 -39
- package/kits/coder/skills/prompt-engineering/SKILL.md +40 -42
- package/kits/coder/skills/queue-patterns/SKILL.md +22 -16
- package/kits/coder/skills/react-native-patterns/SKILL.md +35 -33
- package/kits/coder/skills/react-patterns/SKILL.md +46 -52
- package/kits/coder/skills/realtime-patterns/SKILL.md +44 -46
- package/kits/coder/skills/redis-patterns/SKILL.md +35 -33
- package/kits/coder/skills/security-fundamentals/SKILL.md +45 -46
- package/kits/coder/skills/seo-patterns/SKILL.md +56 -62
- package/kits/coder/skills/systematic-debugging/SKILL.md +38 -39
- package/kits/coder/skills/tailwind-patterns/SKILL.md +21 -13
- package/kits/coder/skills/terraform-patterns/SKILL.md +53 -57
- package/kits/coder/skills/testing-patterns/SKILL.md +42 -47
- package/kits/coder/skills/typescript-patterns/SKILL.md +54 -68
- package/kits/coder/skills/ui-ux-pro-max/SKILL.md +362 -364
- package/package.json +1 -1
|
@@ -8,36 +8,42 @@ priority: LOW
|
|
|
8
8
|
|
|
9
9
|
# Mermaid Diagrams - Visual Documentation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## ⚡ Quick Reference
|
|
12
|
+
|
|
13
|
+
- **Diagram types**: `flowchart` (process) · `sequenceDiagram` (HTTP/API) · `erDiagram` (DB) · `classDiagram` (OOP)
|
|
14
|
+
- **Flowchart**: `TD` (top-down) or `LR` (left-right) · `[box]` `(oval)` `{diamond}` `[[subroutine]]`
|
|
15
|
+
- **Mermaid v10+**: Quote labels with special chars `A["Label (note)"]` · Avoid HTML in labels
|
|
16
|
+
- **Sequence**: `participant A` → `A->>B: message` · `activate/deactivate` for lifelines · `Note over A: text`
|
|
17
|
+
- **Colors**: `style node fill:#4CAF50` · Better: use classDef for reuse
|
|
18
|
+
- **Length**: Max 20 nodes for readability · Split complex diagrams · Comment with `%%`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
12
22
|
|
|
13
23
|
---
|
|
14
24
|
|
|
15
25
|
## 🎯 Core Principles
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
| **Purpose** | Every element should serve understanding |
|
|
23
|
-
| **Maintenance** | Easy to update as system evolves |
|
|
27
|
+
- **Clarity**: One diagram, one concept
|
|
28
|
+
- **Simplicity**: Avoid overcrowding - less is more
|
|
29
|
+
- **Consistency**: Same styling and conventions across diagrams
|
|
30
|
+
- **Purpose**: Every element should serve understanding
|
|
31
|
+
- **Maintenance**: Easy to update as system evolves
|
|
24
32
|
|
|
25
33
|
---
|
|
26
34
|
|
|
27
35
|
## 📊 Diagram Types
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| `journey` | User experience flows |
|
|
40
|
-
| `C4Context` | System architecture (with C4 extension) |
|
|
37
|
+
- `flowchart`: Processes, decision trees, workflows
|
|
38
|
+
- `sequenceDiagram`: API calls, interactions, timing
|
|
39
|
+
- `classDiagram`: Object relationships, inheritance
|
|
40
|
+
- `erDiagram`: Database schemas, entity relationships
|
|
41
|
+
- `stateDiagram-v2`: State machines, lifecycle
|
|
42
|
+
- `gantt`: Project timelines, milestones
|
|
43
|
+
- `pie`: Proportions, distributions
|
|
44
|
+
- `gitGraph`: Branch strategies, merges
|
|
45
|
+
- `journey`: User experience flows
|
|
46
|
+
- `C4Context`: System architecture (with C4 extension)
|
|
41
47
|
|
|
42
48
|
---
|
|
43
49
|
|
|
@@ -102,14 +108,12 @@ sequenceDiagram
|
|
|
102
108
|
|
|
103
109
|
### Arrow Types
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| `-x` | Solid with X (failure) |
|
|
112
|
-
| `--x` | Dotted with X |
|
|
111
|
+
- `->>`: Solid with arrowhead
|
|
112
|
+
- `-->`: Dotted with arrowhead
|
|
113
|
+
- `->>+`: Activate lifeline
|
|
114
|
+
- `-->>-`: Deactivate lifeline
|
|
115
|
+
- `-x`: Solid with X (failure)
|
|
116
|
+
- `--x`: Dotted with X
|
|
113
117
|
|
|
114
118
|
### Notes and Loops
|
|
115
119
|
|
|
@@ -177,12 +181,10 @@ erDiagram
|
|
|
177
181
|
|
|
178
182
|
### Relationship Symbols
|
|
179
183
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
| ` | {` | One or more |
|
|
185
|
-
| `o | ` | Zero or one |
|
|
184
|
+
- `
|
|
185
|
+
- `o{`: Zero or more
|
|
186
|
+
- `: {`
|
|
187
|
+
- `o: `
|
|
186
188
|
|
|
187
189
|
---
|
|
188
190
|
|
|
@@ -221,12 +223,10 @@ flowchart LR
|
|
|
221
223
|
A --> B
|
|
222
224
|
```
|
|
223
225
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
| `forest` | Calm, professional |
|
|
229
|
-
| `neutral` | Minimal, clean |
|
|
226
|
+
- `default`: Light backgrounds
|
|
227
|
+
- `dark`: Dark mode documentation
|
|
228
|
+
- `forest`: Calm, professional
|
|
229
|
+
- `neutral`: Minimal, clean
|
|
230
230
|
|
|
231
231
|
### Custom Styling
|
|
232
232
|
|
|
@@ -245,23 +245,19 @@ flowchart TD
|
|
|
245
245
|
|
|
246
246
|
### Do's
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
| Group with subgraphs | Visual organization |
|
|
254
|
-
| Use proper shapes | Semantic meaning |
|
|
248
|
+
- One concept per diagram: Clarity and focus
|
|
249
|
+
- Use descriptive labels: Self-documenting
|
|
250
|
+
- Consistent direction: TD/LR - pick one and stick to it
|
|
251
|
+
- Group with subgraphs: Visual organization
|
|
252
|
+
- Use proper shapes: Semantic meaning
|
|
255
253
|
|
|
256
254
|
### Don'ts
|
|
257
255
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
| Inconsistent styling | Unprofessional look |
|
|
264
|
-
| No legend when needed | Readers can't understand symbols |
|
|
256
|
+
- Too many nodes: Overwhelming, hard to read
|
|
257
|
+
- Long text in nodes: Cluttered diagram
|
|
258
|
+
- Crossing lines: Confusing flow
|
|
259
|
+
- Inconsistent styling: Unprofessional look
|
|
260
|
+
- No legend when needed: Readers can't understand symbols
|
|
265
261
|
|
|
266
262
|
---
|
|
267
263
|
|
|
@@ -339,12 +335,10 @@ Before sharing a diagram:
|
|
|
339
335
|
|
|
340
336
|
## 🔗 Related Skills
|
|
341
337
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
| API documentation | `documentation-templates` |
|
|
347
|
-
| Project planning | `plan-writing` |
|
|
338
|
+
- Architecture decisions: `architecture`
|
|
339
|
+
- Database design: `database-design`
|
|
340
|
+
- API documentation: `documentation-templates`
|
|
341
|
+
- Project planning: `plan-writing`
|
|
348
342
|
|
|
349
343
|
---
|
|
350
344
|
|
|
@@ -6,6 +6,18 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# Mobile Design Patterns
|
|
8
8
|
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Touch targets**: 44×44pt iOS minimum · 48×48dp Android · Padding not just hit area
|
|
12
|
+
- **Navigation**: Bottom tabs for primary (iOS) · Hamburger for secondary · Back gesture support
|
|
13
|
+
- **Gestures**: Swipe-back iOS native · Pull-to-refresh for lists · Long press for contextual menus
|
|
14
|
+
- **Performance**: 60fps animation · Cold start < 2s · Skeleton screens not spinners · Lazy load
|
|
15
|
+
- **Keyboard**: `KeyboardAvoidingView` in RN · Scroll content up · Dismiss on background tap
|
|
16
|
+
- **Safe areas**: Respect notch/Dynamic Island/home indicator · `SafeAreaView` / `useSafeAreaInsets`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
|
|
9
21
|
> Design for thumbs, not mice. Every millisecond matters.
|
|
10
22
|
|
|
11
23
|
---
|
|
@@ -69,14 +81,8 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
69
81
|
|
|
70
82
|
```
|
|
71
83
|
+-----------------------------------+
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
| |
|
|
75
|
-
| Okay - may stretch | <- Middle
|
|
76
|
-
| |
|
|
77
|
-
|-----------------------------------|
|
|
78
|
-
| ✅ Natural thumb zone | <- Bottom 1/3
|
|
79
|
-
| Primary actions |
|
|
84
|
+
- Okay - may stretch: <- Middle
|
|
85
|
+
- ✅ Natural thumb zone: <- Bottom 1/3
|
|
80
86
|
+-----------------------------------+
|
|
81
87
|
```
|
|
82
88
|
|
|
@@ -112,10 +118,8 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
112
118
|
|
|
113
119
|
### Adaptive vs Responsive
|
|
114
120
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
| **Adaptive** | Different layouts per platform |
|
|
118
|
-
| **Responsive** | Same layout, flexible sizing |
|
|
121
|
+
- **Adaptive**: Different layouts per platform
|
|
122
|
+
- **Responsive**: Same layout, flexible sizing
|
|
119
123
|
|
|
120
124
|
---
|
|
121
125
|
|
|
@@ -166,21 +170,17 @@ const colors = {
|
|
|
166
170
|
|
|
167
171
|
### 60fps Animation Rules
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
| Animate during scroll | Use native driver |
|
|
174
|
-
| Complex animations in JS | Use Reanimated/Worklets |
|
|
173
|
+
- Animate width/height: Use transform: scale()
|
|
174
|
+
- Animate left/top: Use transform: translate()
|
|
175
|
+
- Animate during scroll: Use native driver
|
|
176
|
+
- Complex animations in JS: Use Reanimated/Worklets
|
|
175
177
|
|
|
176
178
|
### List Performance
|
|
177
179
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
| **Item memoization** | Complex item components |
|
|
183
|
-
| **Skeleton loading** | Initial data fetch |
|
|
180
|
+
- **FlashList**: Large lists (100+ items)
|
|
181
|
+
- **Virtualization**: Any scrollable list
|
|
182
|
+
- **Item memoization**: Complex item components
|
|
183
|
+
- **Skeleton loading**: Initial data fetch
|
|
184
184
|
|
|
185
185
|
### Image Optimization
|
|
186
186
|
|
|
@@ -202,14 +202,12 @@ const colors = {
|
|
|
202
202
|
|
|
203
203
|
### States to Handle
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| **Offline** | Cached data + offline indicator |
|
|
212
|
-
| **Syncing** | Subtle sync indicator |
|
|
205
|
+
- **Loading**: Skeleton or spinner
|
|
206
|
+
- **Success**: Content display
|
|
207
|
+
- **Empty**: Empty state with action
|
|
208
|
+
- **Error**: Error message + retry
|
|
209
|
+
- **Offline**: Cached data + offline indicator
|
|
210
|
+
- **Syncing**: Subtle sync indicator
|
|
213
211
|
|
|
214
212
|
### Optimistic UI
|
|
215
213
|
|
|
@@ -225,24 +223,20 @@ User Action → Immediate UI Update → Background Sync
|
|
|
225
223
|
|
|
226
224
|
### Haptic Feedback
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
| **Warning** | Destructive action confirm |
|
|
235
|
-
| **Error** | Failed action |
|
|
226
|
+
- **Light**: UI selection
|
|
227
|
+
- **Medium**: Toggle, switch
|
|
228
|
+
- **Heavy**: Significant action
|
|
229
|
+
- **Success**: Task completed
|
|
230
|
+
- **Warning**: Destructive action confirm
|
|
231
|
+
- **Error**: Failed action
|
|
236
232
|
|
|
237
233
|
### Loading States
|
|
238
234
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
| > 3s | Progress + estimated time |
|
|
245
|
-
| Unknown | Skeleton + content streaming |
|
|
235
|
+
- < 100ms: No indicator
|
|
236
|
+
- 100ms-1s: Inline spinner
|
|
237
|
+
- 1s-3s: Progress indicator
|
|
238
|
+
- > 3s: Progress + estimated time
|
|
239
|
+
- Unknown: Skeleton + content streaming
|
|
246
240
|
|
|
247
241
|
---
|
|
248
242
|
|
|
@@ -280,25 +274,21 @@ User Action → Immediate UI Update → Background Sync
|
|
|
280
274
|
|
|
281
275
|
## ❌ Anti-Patterns
|
|
282
276
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
| Infinite scroll without pagination | Load more or paginate |
|
|
290
|
-
| Text that doesn't scale | Support Dynamic Type / Font Scaling |
|
|
277
|
+
- Small tap targets (< 44pt): Minimum 44x44pt
|
|
278
|
+
- Important actions at screen top: Primary actions in thumb zone
|
|
279
|
+
- Hamburger menu for main navigation: Bottom tab bar
|
|
280
|
+
- Custom back button behavior: Respect platform conventions
|
|
281
|
+
- Infinite scroll without pagination: Load more or paginate
|
|
282
|
+
- Text that doesn't scale: Support Dynamic Type / Font Scaling
|
|
291
283
|
|
|
292
284
|
---
|
|
293
285
|
|
|
294
286
|
## 🔗 Related Skills
|
|
295
287
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
| Accessibility | `accessibility-patterns` |
|
|
301
|
-
| Performance profiling | `performance-profiling` |
|
|
288
|
+
- React Native patterns: `react-native-patterns`
|
|
289
|
+
- Flutter patterns: `flutter-patterns`
|
|
290
|
+
- Accessibility: `accessibility-patterns`
|
|
291
|
+
- Performance profiling: `performance-profiling`
|
|
302
292
|
|
|
303
293
|
---
|
|
304
294
|
|
|
@@ -7,19 +7,27 @@ version: 2.0
|
|
|
7
7
|
|
|
8
8
|
# Monitoring & Observability - SRE Patterns
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## ⚡ Quick Reference
|
|
11
|
+
|
|
12
|
+
- **3 pillars**: Metrics (trends) · Logs (events) · Traces (distributed request flow)
|
|
13
|
+
- **Alert tiers**: Critical (< 5min) · High (< 15min) · Medium (< 1hr) · Low (next day)
|
|
14
|
+
- **SLOs**: Define before shipping · P99 latency · Error rate · Availability goals
|
|
15
|
+
- **Logs**: Structured JSON always · Include request ID + tenant ID · No PII in logs
|
|
16
|
+
- **Health checks**: /health (liveness) + /ready (readiness) · Check DB/Redis/deps
|
|
17
|
+
- **Avoid**: Alert fatigue (too many low-value alerts) · Log PII · Monitor without alerting
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
11
21
|
|
|
12
22
|
---
|
|
13
23
|
|
|
14
24
|
## When to Use This Skill
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| Building observability pipelines | No access to telemetry data |
|
|
22
|
-
| Incident response workflow | Static reporting only |
|
|
26
|
+
- Designing monitoring systems: Single ad-hoc dashboard
|
|
27
|
+
- Defining SLI/SLO/SLA: Application feature development
|
|
28
|
+
- Configuring alerting strategy: Local development debugging
|
|
29
|
+
- Building observability pipelines: No access to telemetry data
|
|
30
|
+
- Incident response workflow: Static reporting only
|
|
23
31
|
|
|
24
32
|
---
|
|
25
33
|
|
|
@@ -219,13 +227,11 @@ groups:
|
|
|
219
227
|
|
|
220
228
|
### Reducing Alert Noise
|
|
221
229
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
| Weekend pages | Time-based routing, error budgets |
|
|
228
|
-
| Alert storms | Implement alerting hierarchy |
|
|
230
|
+
- Flapping alerts: Increase `for` duration
|
|
231
|
+
- Too many alerts: Alert on SLOs, not individual causes
|
|
232
|
+
- Duplicate alerts: Use `group_by` and aggregation
|
|
233
|
+
- Weekend pages: Time-based routing, error budgets
|
|
234
|
+
- Alert storms: Implement alerting hierarchy
|
|
229
235
|
|
|
230
236
|
---
|
|
231
237
|
|
|
@@ -417,15 +423,13 @@ async function processOrder(orderId: string) {
|
|
|
417
423
|
|
|
418
424
|
## Anti-Patterns
|
|
419
425
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
| Secret values in logs | Redact sensitive data |
|
|
428
|
-
| High-cardinality labels | Bounded label values |
|
|
426
|
+
- Alert on causes (CPU, memory): Alert on symptoms (latency, errors)
|
|
427
|
+
- Log everything at INFO: Use appropriate log levels
|
|
428
|
+
- Unstructured log messages: JSON structured logging
|
|
429
|
+
- Alert without runbook: Every alert has a runbook
|
|
430
|
+
- Collect metrics without purpose: Define SLIs first, then instrument
|
|
431
|
+
- Secret values in logs: Redact sensitive data
|
|
432
|
+
- High-cardinality labels: Bounded label values
|
|
429
433
|
|
|
430
434
|
---
|
|
431
435
|
|
|
@@ -446,12 +450,10 @@ Before production:
|
|
|
446
450
|
|
|
447
451
|
## Related Skills
|
|
448
452
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
| Performance tuning | `performance-profiling` |
|
|
454
|
-
| Security monitoring | `security-fundamentals` |
|
|
453
|
+
- Kubernetes ops: `kubernetes-patterns`
|
|
454
|
+
- CI/CD pipelines: `github-actions`
|
|
455
|
+
- Performance tuning: `performance-profiling`
|
|
456
|
+
- Security monitoring: `security-fundamentals`
|
|
455
457
|
|
|
456
458
|
---
|
|
457
459
|
|
|
@@ -7,7 +7,17 @@ tags: [architecture, saas, isolation, tenancy, compliance]
|
|
|
7
7
|
|
|
8
8
|
# Multi-Tenancy - SaaS Architecture Skill
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## ⚡ Quick Reference
|
|
11
|
+
|
|
12
|
+
- **Isolation levels**: Shared DB + RLS (startup) · Schema-per-tenant (1000+) · DB-per-tenant (enterprise/HIPAA)
|
|
13
|
+
- **Tenant resolution**: Early in middleware · validate → cache (Redis with TTL) → attach to request context
|
|
14
|
+
- **Data access**: EVERY query filters by `tenant_id` · RLS as second layer · Never trust client-provided tenant ID
|
|
15
|
+
- **Context propagation**: HTTP → Service → Queue → Worker → DB · AsyncLocalStorage (Node.js)
|
|
16
|
+
- **Cache isolation**: All keys prefixed `tenant:{id}:` · Separate Redis DB index for critical isolation
|
|
17
|
+
- **Audit**: Log all cross-tenant boundary access · Rate limit per tenant · No global unfiltered queries
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
11
21
|
|
|
12
22
|
---
|
|
13
23
|
|
|
@@ -26,13 +36,11 @@ tags: [architecture, saas, isolation, tenancy, compliance]
|
|
|
26
36
|
|
|
27
37
|
> **"Multi-tenancy is trust architecture—design for distrust, verify always."**
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
| **Explicit Over Implicit** | Never infer tenant, always verify |
|
|
35
|
-
| **Audit Everything** | Log all cross-boundary access |
|
|
39
|
+
- **Defense in Depth**: Multiple isolation layers (app + DB + infra)
|
|
40
|
+
- **Context Everywhere**: Tenant ID flows through every layer
|
|
41
|
+
- **Fail Closed**: Missing tenant context = deny access
|
|
42
|
+
- **Explicit Over Implicit**: Never infer tenant, always verify
|
|
43
|
+
- **Audit Everything**: Log all cross-boundary access
|
|
36
44
|
|
|
37
45
|
---
|
|
38
46
|
|
|
@@ -6,10 +6,19 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# Node.js Best Practices
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Async**: Always `async/await` · Never blocking I/O in hot paths · `Promise.all()` for parallel
|
|
12
|
+
- **Error handling**: `try/catch` in all async · Unhandled rejection → exit process · Typed custom errors
|
|
13
|
+
- **Event loop**: No sync fs/crypto/heavy compute · Offload to worker threads or background jobs
|
|
14
|
+
- **Config**: `dotenv` for local · env vars always · validate with `zod` on startup · never commit `.env`
|
|
15
|
+
- **Logging**: `pino` (fast, structured JSON) · Correlation IDs · No console.log in production
|
|
16
|
+
- **Security**: `helmet` always · `express-rate-limit` · Validate all inputs (zod) · CORS configured strictly
|
|
10
17
|
|
|
11
18
|
---
|
|
12
19
|
|
|
20
|
+
|
|
21
|
+
|
|
13
22
|
## Core Principles
|
|
14
23
|
|
|
15
24
|
1. **Async by default** - Never block the event loop
|
|
@@ -21,12 +30,10 @@ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
|
21
30
|
|
|
22
31
|
## 🔧 Framework Selection
|
|
23
32
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| **NestJS** | Enterprise, DDD, TypeScript |
|
|
29
|
-
| **Hono** | Edge runtime, lightweight |
|
|
33
|
+
- **Express**: Simple APIs, custom needs
|
|
34
|
+
- **Fastify**: Performance, schema-first
|
|
35
|
+
- **NestJS**: Enterprise, DDD, TypeScript
|
|
36
|
+
- **Hono**: Edge runtime, lightweight
|
|
30
37
|
|
|
31
38
|
---
|
|
32
39
|
|
|
@@ -202,13 +209,11 @@ logger.error({ err, requestId }, "Request failed");
|
|
|
202
209
|
|
|
203
210
|
## ❌ Anti-Patterns
|
|
204
211
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
| Sync file operations | Use async fs methods |
|
|
211
|
-
| Throwing strings | Custom Error classes |
|
|
212
|
+
- `async` without error handling: Wrap with asyncHandler
|
|
213
|
+
- Callback APIs: Promisify or use async libs
|
|
214
|
+
- `console.log` in production: Structured logging
|
|
215
|
+
- Sync file operations: Use async fs methods
|
|
216
|
+
- Throwing strings: Custom Error classes
|
|
212
217
|
|
|
213
218
|
---
|
|
214
219
|
|
|
@@ -6,7 +6,17 @@ allowed-tools: Read, Edit, Glob, Grep, Bash
|
|
|
6
6
|
|
|
7
7
|
# Performance Profiling - Measure First, Optimize Second
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Measure first**: Profile before optimizing · No gut feelings · `console.time()` / Chrome DevTools / clinic.js
|
|
12
|
+
- **Core Web Vitals**: LCP < 2.5s · FID/INP < 200ms · CLS < 0.1 · Check with Lighthouse
|
|
13
|
+
- **Frontend**: Lazy load images/routes · Eliminate render-blocking resources · Bundle splitting · `preconnect` for external
|
|
14
|
+
- **Backend**: EXPLAIN ANALYZE for slow queries · Connection pooling · Response caching (Redis) · Pagination
|
|
15
|
+
- **Node.js**: Event loop not blocked · Avoid sync fs in hot paths · `--prof` for CPU profiling
|
|
16
|
+
- **Priority**: Fix worst P99 first · Cache before compute · Network before CPU
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
10
20
|
|
|
11
21
|
---
|
|
12
22
|
|
|
@@ -204,12 +214,10 @@ npx webpack-bundle-analyzer dist/stats.json
|
|
|
204
214
|
```
|
|
205
215
|
|
|
206
216
|
**Solutions:**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
| One big bundle | Code split by route |
|
|
212
|
-
| Duplicate dependencies | Dedupe in package manager |
|
|
217
|
+
- Large library: Use lighter alternative (date-fns vs moment)
|
|
218
|
+
- Unused exports: Enable tree shaking
|
|
219
|
+
- One big bundle: Code split by route
|
|
220
|
+
- Duplicate dependencies: Dedupe in package manager
|
|
213
221
|
|
|
214
222
|
### Memory Leaks
|
|
215
223
|
|
|
@@ -220,12 +228,10 @@ npx webpack-bundle-analyzer dist/stats.json
|
|
|
220
228
|
- OutOfMemory errors in production
|
|
221
229
|
|
|
222
230
|
**Common Causes:**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
| Closures holding references | Break reference chains |
|
|
228
|
-
| Uncleared timers | clearTimeout/clearInterval |
|
|
231
|
+
- Event listeners not removed: Cleanup in useEffect/componentWillUnmount
|
|
232
|
+
- Growing global arrays/maps: Use WeakMap/WeakSet or bounded caches
|
|
233
|
+
- Closures holding references: Break reference chains
|
|
234
|
+
- Uncleared timers: clearTimeout/clearInterval
|
|
229
235
|
|
|
230
236
|
---
|
|
231
237
|
|
|
@@ -273,16 +279,14 @@ const throttledScroll = throttle(handleScroll, 100);
|
|
|
273
279
|
|
|
274
280
|
## 🚨 Anti-Patterns
|
|
275
281
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
| Block main thread with heavy work | Use web workers, async processing |
|
|
285
|
-
| Ignore p99 latency | p99 affects real users, not just averages |
|
|
282
|
+
- Optimize without measuring: Profile first, then optimize
|
|
283
|
+
- Premature optimization: Focus on correctness, then performance
|
|
284
|
+
- Optimize cold paths: Focus on hot paths (frequently executed)
|
|
285
|
+
- Micro-optimize trivial code: Target the biggest bottleneck
|
|
286
|
+
- Cache everything: Cache strategically, consider invalidation
|
|
287
|
+
- Load everything upfront: Lazy load non-critical resources
|
|
288
|
+
- Block main thread with heavy work: Use web workers, async processing
|
|
289
|
+
- Ignore p99 latency: p99 affects real users, not just averages
|
|
286
290
|
|
|
287
291
|
---
|
|
288
292
|
|
|
@@ -321,12 +325,10 @@ const throttledScroll = throttle(handleScroll, 100);
|
|
|
321
325
|
|
|
322
326
|
## 🔗 Related Skills
|
|
323
327
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
| Testing performance | `testing-patterns` |
|
|
329
|
-
| Clean efficient code | `clean-code` |
|
|
328
|
+
- Frontend optimization: `react-best-practices`
|
|
329
|
+
- Database optimization: `database-design`
|
|
330
|
+
- Testing performance: `testing-patterns`
|
|
331
|
+
- Clean efficient code: `clean-code`
|
|
330
332
|
|
|
331
333
|
---
|
|
332
334
|
|