@h1dr0n/skill-pool 0.1.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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +296 -0
  3. package/bin/cli.js +157 -0
  4. package/package.json +41 -0
  5. package/skills/api/agents/backend-specialist.md +69 -0
  6. package/skills/api/agents/database-optimizer.md +176 -0
  7. package/skills/api/manifest.yaml +20 -0
  8. package/skills/api/rules/auth-security.md +45 -0
  9. package/skills/api/skills/api-patterns/SKILL.md +81 -0
  10. package/skills/api/skills/api-patterns/api-style.md +42 -0
  11. package/skills/api/skills/api-patterns/auth.md +24 -0
  12. package/skills/api/skills/api-patterns/documentation.md +26 -0
  13. package/skills/api/skills/api-patterns/graphql.md +41 -0
  14. package/skills/api/skills/api-patterns/rate-limiting.md +31 -0
  15. package/skills/api/skills/api-patterns/response.md +37 -0
  16. package/skills/api/skills/api-patterns/rest.md +40 -0
  17. package/skills/api/skills/api-patterns/scripts/api_validator.py +211 -0
  18. package/skills/api/skills/api-patterns/security-testing.md +122 -0
  19. package/skills/api/skills/api-patterns/trpc.md +41 -0
  20. package/skills/api/skills/api-patterns/versioning.md +22 -0
  21. package/skills/api/skills/database-patterns.md +126 -0
  22. package/skills/api/skills/deployment-patterns.md +105 -0
  23. package/skills/api/skills/docker-patterns.md +135 -0
  24. package/skills/common/agents/code-reviewer.md +78 -0
  25. package/skills/common/agents/planner.md +80 -0
  26. package/skills/common/agents/security-reviewer.md +82 -0
  27. package/skills/common/agents/software-architect.md +81 -0
  28. package/skills/common/manifest.yaml +25 -0
  29. package/skills/common/rules/coding-style.md +39 -0
  30. package/skills/common/rules/git-workflow.md +33 -0
  31. package/skills/common/rules/security.md +25 -0
  32. package/skills/common/skills/architecture/SKILL.md +55 -0
  33. package/skills/common/skills/architecture/context-discovery.md +43 -0
  34. package/skills/common/skills/architecture/examples.md +94 -0
  35. package/skills/common/skills/architecture/pattern-selection.md +68 -0
  36. package/skills/common/skills/architecture/patterns-reference.md +50 -0
  37. package/skills/common/skills/architecture/trade-off-analysis.md +77 -0
  38. package/skills/common/skills/brainstorming/SKILL.md +163 -0
  39. package/skills/common/skills/brainstorming/dynamic-questioning.md +350 -0
  40. package/skills/common/skills/clean-code.md +99 -0
  41. package/skills/common/skills/code-review-checklist.md +86 -0
  42. package/skills/common/skills/plan-writing/SKILL.md +152 -0
  43. package/skills/common/skills/skill-feedback.md +94 -0
  44. package/skills/common/skills/tdd-workflow.md +130 -0
  45. package/skills/common/skills/verification-loop.md +112 -0
  46. package/skills/cpp/agents/cpp-build-resolver.md +90 -0
  47. package/skills/cpp/agents/cpp-reviewer.md +72 -0
  48. package/skills/cpp/manifest.yaml +15 -0
  49. package/skills/cpp/skills/cpp-coding-standards.md +722 -0
  50. package/skills/cpp/skills/cpp-testing.md +323 -0
  51. package/skills/devops/agents/devops-automator.md +376 -0
  52. package/skills/devops/agents/sre.md +90 -0
  53. package/skills/devops/manifest.yaml +20 -0
  54. package/skills/devops/skills/deployment-patterns.md +427 -0
  55. package/skills/devops/skills/deployment-procedures/SKILL.md +241 -0
  56. package/skills/devops/skills/docker-patterns.md +364 -0
  57. package/skills/devops/skills/e2e-testing.md +326 -0
  58. package/skills/devops/skills/github-ops.md +144 -0
  59. package/skills/django/manifest.yaml +16 -0
  60. package/skills/django/skills/django-patterns.md +734 -0
  61. package/skills/django/skills/django-security.md +593 -0
  62. package/skills/django/skills/django-tdd.md +729 -0
  63. package/skills/django/skills/django-verification.md +469 -0
  64. package/skills/dotnet/agents/csharp-reviewer.md +101 -0
  65. package/skills/dotnet/manifest.yaml +14 -0
  66. package/skills/dotnet/skills/csharp-testing.md +321 -0
  67. package/skills/dotnet/skills/dotnet-patterns.md +321 -0
  68. package/skills/go/agents/code-reviewer.md +76 -0
  69. package/skills/go/agents/go-build-resolver.md +94 -0
  70. package/skills/go/agents/go-reviewer.md +76 -0
  71. package/skills/go/manifest.yaml +17 -0
  72. package/skills/go/rules/go-style.md +55 -0
  73. package/skills/go/skills/golang-patterns.md +674 -0
  74. package/skills/go/skills/golang-testing.md +720 -0
  75. package/skills/java/agents/java-build-resolver.md +153 -0
  76. package/skills/java/agents/java-reviewer.md +92 -0
  77. package/skills/java/manifest.yaml +18 -0
  78. package/skills/java/skills/java-coding-standards.md +147 -0
  79. package/skills/java/skills/jpa-patterns.md +151 -0
  80. package/skills/java/skills/springboot-patterns.md +314 -0
  81. package/skills/java/skills/springboot-security.md +272 -0
  82. package/skills/kotlin/agents/kotlin-build-resolver.md +118 -0
  83. package/skills/kotlin/agents/kotlin-reviewer.md +159 -0
  84. package/skills/kotlin/manifest.yaml +17 -0
  85. package/skills/kotlin/skills/kotlin-coroutines-flows.md +284 -0
  86. package/skills/kotlin/skills/kotlin-patterns.md +711 -0
  87. package/skills/kotlin/skills/kotlin-testing.md +824 -0
  88. package/skills/laravel/manifest.yaml +15 -0
  89. package/skills/laravel/skills/laravel-patterns.md +409 -0
  90. package/skills/laravel/skills/laravel-security.md +279 -0
  91. package/skills/laravel/skills/laravel-tdd.md +277 -0
  92. package/skills/laravel/skills/laravel-verification.md +173 -0
  93. package/skills/mobile/agents/dart-build-resolver.md +201 -0
  94. package/skills/mobile/agents/flutter-reviewer.md +243 -0
  95. package/skills/mobile/manifest.yaml +19 -0
  96. package/skills/mobile/skills/android-clean-architecture.md +339 -0
  97. package/skills/mobile/skills/dart-flutter-patterns.md +563 -0
  98. package/skills/mobile/skills/swiftui-patterns.md +259 -0
  99. package/skills/nestjs/manifest.yaml +13 -0
  100. package/skills/nestjs/skills/nestjs-patterns.md +230 -0
  101. package/skills/perl/manifest.yaml +13 -0
  102. package/skills/perl/skills/perl-patterns.md +504 -0
  103. package/skills/perl/skills/perl-security.md +503 -0
  104. package/skills/perl/skills/perl-testing.md +475 -0
  105. package/skills/python/agents/python-reviewer.md +98 -0
  106. package/skills/python/manifest.yaml +18 -0
  107. package/skills/python/rules/python-style.md +69 -0
  108. package/skills/python/skills/python-patterns/SKILL.md +441 -0
  109. package/skills/python/skills/python-patterns.md +90 -0
  110. package/skills/python/skills/python-testing.md +81 -0
  111. package/skills/rust/agents/rust-build-resolver.md +148 -0
  112. package/skills/rust/agents/rust-reviewer.md +94 -0
  113. package/skills/rust/manifest.yaml +16 -0
  114. package/skills/rust/rules/rust-style.md +107 -0
  115. package/skills/rust/skills/rust-patterns.md +499 -0
  116. package/skills/rust/skills/rust-testing.md +500 -0
  117. package/skills/security/agents/accessibility-auditor.md +316 -0
  118. package/skills/security/agents/security-reviewer.md +108 -0
  119. package/skills/security/manifest.yaml +19 -0
  120. package/skills/security/skills/red-team-tactics/SKILL.md +199 -0
  121. package/skills/security/skills/security-bounty-hunter.md +99 -0
  122. package/skills/security/skills/security-review.md +495 -0
  123. package/skills/security/skills/security-scan.md +165 -0
  124. package/skills/security/skills/vulnerability-scanner/SKILL.md +276 -0
  125. package/skills/security/skills/vulnerability-scanner/checklists.md +121 -0
  126. package/skills/security/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  127. package/skills/swift/manifest.yaml +16 -0
  128. package/skills/swift/skills/swift-actor-persistence.md +142 -0
  129. package/skills/swift/skills/swift-concurrency.md +216 -0
  130. package/skills/swift/skills/swift-protocol-di-testing.md +190 -0
  131. package/skills/swift/skills/swiftui-patterns.md +259 -0
  132. package/skills/unity/agents/game-designer.md +167 -0
  133. package/skills/unity/agents/unity-architect.md +52 -0
  134. package/skills/unity/agents/unity-editor-tool-developer.md +310 -0
  135. package/skills/unity/agents/unity-multiplayer-engineer.md +321 -0
  136. package/skills/unity/agents/unity-shader-graph-artist.md +269 -0
  137. package/skills/unity/manifest.yaml +21 -0
  138. package/skills/unity/rules/csharp-patterns.md +48 -0
  139. package/skills/unity/rules/unity-specific.md +53 -0
  140. package/skills/unity/skills/systematic-debugging.md +92 -0
  141. package/skills/unity/skills/unity-architecture.md +173 -0
  142. package/skills/unreal/agents/level-designer.md +208 -0
  143. package/skills/unreal/agents/technical-artist.md +229 -0
  144. package/skills/unreal/agents/unreal-multiplayer-architect.md +313 -0
  145. package/skills/unreal/agents/unreal-systems-engineer.md +310 -0
  146. package/skills/unreal/agents/unreal-technical-artist.md +256 -0
  147. package/skills/unreal/agents/unreal-world-builder.md +273 -0
  148. package/skills/unreal/manifest.yaml +21 -0
  149. package/skills/unreal/skills/unreal-patterns.md +183 -0
  150. package/skills/web/agents/frontend-specialist.md +71 -0
  151. package/skills/web/agents/ui-designer.md +383 -0
  152. package/skills/web/agents/ux-architect.md +469 -0
  153. package/skills/web/manifest.yaml +22 -0
  154. package/skills/web/rules/accessibility.md +54 -0
  155. package/skills/web/rules/css-performance.md +52 -0
  156. package/skills/web/skills/e2e-testing.md +132 -0
  157. package/skills/web/skills/frontend-design/SKILL.md +452 -0
  158. package/skills/web/skills/frontend-design/animation-guide.md +331 -0
  159. package/skills/web/skills/frontend-design/color-system.md +311 -0
  160. package/skills/web/skills/frontend-design/decision-trees.md +418 -0
  161. package/skills/web/skills/frontend-design/motion-graphics.md +306 -0
  162. package/skills/web/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  163. package/skills/web/skills/frontend-design/scripts/ux_audit.py +722 -0
  164. package/skills/web/skills/frontend-design/typography-system.md +345 -0
  165. package/skills/web/skills/frontend-design/ux-psychology.md +1116 -0
  166. package/skills/web/skills/frontend-design/visual-effects.md +383 -0
  167. package/skills/web/skills/react-nextjs.md +135 -0
  168. package/skills/web/skills/tailwind-patterns/SKILL.md +269 -0
  169. package/src/adapters/antigravity.js +164 -0
  170. package/src/adapters/claude.js +188 -0
  171. package/src/adapters/cursor.js +161 -0
  172. package/src/adapters/index.js +67 -0
  173. package/src/adapters/windsurf.js +158 -0
  174. package/src/commands/add.js +266 -0
  175. package/src/commands/create.js +127 -0
  176. package/src/commands/diff.js +78 -0
  177. package/src/commands/info.js +88 -0
  178. package/src/commands/init.js +224 -0
  179. package/src/commands/install.js +90 -0
  180. package/src/commands/list.js +54 -0
  181. package/src/commands/remove.js +101 -0
  182. package/src/commands/targets.js +32 -0
  183. package/src/commands/update.js +57 -0
  184. package/src/core/manifest.js +57 -0
  185. package/src/core/plugins.js +86 -0
  186. package/src/core/resolver.js +84 -0
  187. package/src/core/tracker.js +49 -0
  188. package/src/utils/fs.js +80 -0
  189. package/src/utils/git.js +52 -0
@@ -0,0 +1,383 @@
1
+ # Visual Effects Reference
2
+
3
+ > Modern CSS effect principles and techniques - learn the concepts, create variations.
4
+ > **No fixed values to copy - understand the patterns.**
5
+
6
+ ---
7
+
8
+ ## 1. Glassmorphism Principles
9
+
10
+ ### What Makes Glassmorphism Work
11
+
12
+ ```
13
+ Key Properties:
14
+ ├── Semi-transparent background (not solid)
15
+ ├── Backdrop blur (frosted glass effect)
16
+ ├── Subtle border (for definition)
17
+ └── Often: light shadow for depth
18
+ ```
19
+
20
+ ### The Pattern (Customize Values)
21
+
22
+ ```css
23
+ .glass {
24
+ /* Transparency: adjust opacity based on content readability */
25
+ background: rgba(R, G, B, OPACITY);
26
+ /* OPACITY: 0.1-0.3 for dark bg, 0.5-0.8 for light bg */
27
+
28
+ /* Blur: higher = more frosted */
29
+ backdrop-filter: blur(AMOUNT);
30
+ /* AMOUNT: 8-12px subtle, 16-24px strong */
31
+
32
+ /* Border: defines edges */
33
+ border: 1px solid rgba(255, 255, 255, OPACITY);
34
+ /* OPACITY: 0.1-0.3 typically */
35
+
36
+ /* Radius: match your design system */
37
+ border-radius: YOUR_RADIUS;
38
+ }
39
+ ```
40
+
41
+ ### When to Use Glassmorphism
42
+ - ✅ Over colorful/image backgrounds
43
+ - ✅ Modals, overlays, cards
44
+ - ✅ Navigation bars with scrolling content behind
45
+ - ❌ Text-heavy content (readability issues)
46
+ - ❌ Simple solid backgrounds (pointless)
47
+
48
+ ### When NOT to Use
49
+ - Low contrast situations
50
+ - Accessibility-critical content
51
+ - Performance-constrained devices
52
+
53
+ ---
54
+
55
+ ## 2. Neomorphism Principles
56
+
57
+ ### What Makes Neomorphism Work
58
+
59
+ ```
60
+ Key Concept: Soft, extruded elements using DUAL shadows
61
+ ├── Light shadow (from light source direction)
62
+ ├── Dark shadow (opposite direction)
63
+ └── Background matches surrounding (same color)
64
+ ```
65
+
66
+ ### The Pattern
67
+
68
+ ```css
69
+ .neo-raised {
70
+ /* Background MUST match parent */
71
+ background: SAME_AS_PARENT;
72
+
73
+ /* Two shadows: light direction + dark direction */
74
+ box-shadow:
75
+ OFFSET OFFSET BLUR rgba(light-color),
76
+ -OFFSET -OFFSET BLUR rgba(dark-color);
77
+
78
+ /* OFFSET: typically 6-12px */
79
+ /* BLUR: typically 12-20px */
80
+ }
81
+
82
+ .neo-pressed {
83
+ /* Inset creates "pushed in" effect */
84
+ box-shadow:
85
+ inset OFFSET OFFSET BLUR rgba(dark-color),
86
+ inset -OFFSET -OFFSET BLUR rgba(light-color);
87
+ }
88
+ ```
89
+
90
+ ### Accessibility Warning
91
+ ⚠️ **Low contrast** - use sparingly, ensure clear boundaries
92
+
93
+ ### When to Use
94
+ - Decorative elements
95
+ - Subtle interactive states
96
+ - Minimalist UI with flat colors
97
+
98
+ ---
99
+
100
+ ## 3. Shadow Hierarchy Principles
101
+
102
+ ### Concept: Shadows Indicate Elevation
103
+
104
+ ```
105
+ Higher elevation = larger shadow
106
+ ├── Level 0: No shadow (flat on surface)
107
+ ├── Level 1: Subtle shadow (slightly raised)
108
+ ├── Level 2: Medium shadow (cards, buttons)
109
+ ├── Level 3: Large shadow (modals, dropdowns)
110
+ └── Level 4: Deep shadow (floating elements)
111
+ ```
112
+
113
+ ### Shadow Properties to Adjust
114
+
115
+ ```css
116
+ box-shadow: OFFSET-X OFFSET-Y BLUR SPREAD COLOR;
117
+
118
+ /* Offset: direction of shadow */
119
+ /* Blur: softness (larger = softer) */
120
+ /* Spread: size expansion */
121
+ /* Color: typically black with low opacity */
122
+ ```
123
+
124
+ ### Principles for Natural Shadows
125
+
126
+ 1. **Y-offset larger than X** (light comes from above)
127
+ 2. **Low opacity** (5-15% for subtle, 15-25% for pronounced)
128
+ 3. **Multiple layers** for realism (ambient + direct)
129
+ 4. **Blur scales with offset** (larger offset = larger blur)
130
+
131
+ ### Dark Mode Shadows
132
+ - Shadows less visible on dark backgrounds
133
+ - May need to increase opacity
134
+ - Or use glow/highlight instead
135
+
136
+ ---
137
+
138
+ ## 4. Gradient Principles
139
+
140
+ ### Types and When to Use
141
+
142
+ | Type | Pattern | Use Case |
143
+ |------|---------|----------|
144
+ | **Linear** | Color A → Color B along line | Backgrounds, buttons, headers |
145
+ | **Radial** | Center → outward | Spotlights, focal points |
146
+ | **Conic** | Around center | Pie charts, creative effects |
147
+
148
+ ### Creating Harmonious Gradients
149
+
150
+ ```
151
+ Good Gradient Rules:
152
+ ├── Use ADJACENT colors on wheel (analogous)
153
+ ├── Or same hue with different lightness
154
+ ├── Avoid complementary (can look harsh)
155
+ └── Add middle stops for smoother transitions
156
+ ```
157
+
158
+ ### Gradient Syntax Pattern
159
+
160
+ ```css
161
+ .gradient {
162
+ background: linear-gradient(
163
+ DIRECTION, /* angle or to-keyword */
164
+ COLOR-STOP-1, /* color + optional position */
165
+ COLOR-STOP-2,
166
+ /* ... more stops */
167
+ );
168
+ }
169
+
170
+ /* DIRECTION examples: */
171
+ /* 90deg, 135deg, to right, to bottom right */
172
+ ```
173
+
174
+ ### Mesh Gradients
175
+
176
+ ```
177
+ Multiple radial gradients overlapped:
178
+ ├── Each at different position
179
+ ├── Each with transparent falloff
180
+ ├── **Mandatory for "Wow" factor in Hero sections**
181
+ └── Creates organic, colorful effect (Search: "Aurora Gradient CSS")
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 5. Border Effects Principles
187
+
188
+ ### Gradient Borders
189
+
190
+ ```
191
+ Technique: Pseudo-element with gradient background
192
+ ├── Element has padding = border width
193
+ ├── Pseudo-element fills with gradient
194
+ └── Mask or clip creates border effect
195
+ ```
196
+
197
+ ### Animated Borders
198
+
199
+ ```
200
+ Technique: Rotating gradient or conic sweep
201
+ ├── Pseudo-element larger than content
202
+ ├── Animation rotates the gradient
203
+ └── Overflow hidden clips to shape
204
+ ```
205
+
206
+ ### Glow Borders
207
+
208
+ ```css
209
+ /* Multiple box-shadows create glow */
210
+ box-shadow:
211
+ 0 0 SMALL-BLUR COLOR,
212
+ 0 0 MEDIUM-BLUR COLOR,
213
+ 0 0 LARGE-BLUR COLOR;
214
+
215
+ /* Each layer adds to the glow */
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 6. Glow Effects Principles
221
+
222
+ ### Text Glow
223
+
224
+ ```css
225
+ text-shadow:
226
+ 0 0 BLUR-1 COLOR,
227
+ 0 0 BLUR-2 COLOR,
228
+ 0 0 BLUR-3 COLOR;
229
+
230
+ /* Multiple layers = stronger glow */
231
+ /* Larger blur = softer spread */
232
+ ```
233
+
234
+ ### Element Glow
235
+
236
+ ```css
237
+ box-shadow:
238
+ 0 0 BLUR-1 COLOR,
239
+ 0 0 BLUR-2 COLOR;
240
+
241
+ /* Use color matching element for realistic glow */
242
+ /* Lower opacity for subtle, higher for neon */
243
+ ```
244
+
245
+ ### Pulsing Glow Animation
246
+
247
+ ```css
248
+ @keyframes glow-pulse {
249
+ 0%, 100% { box-shadow: 0 0 SMALL-BLUR COLOR; }
250
+ 50% { box-shadow: 0 0 LARGE-BLUR COLOR; }
251
+ }
252
+
253
+ /* Easing and duration affect feel */
254
+ ```
255
+
256
+ ---
257
+
258
+ ## 7. Overlay Techniques
259
+
260
+ ### Gradient Overlay on Images
261
+
262
+ ```
263
+ Purpose: Improve text readability over images
264
+ Pattern: Gradient from transparent to opaque
265
+ Position: Where text will appear
266
+ ```
267
+
268
+ ```css
269
+ .overlay::after {
270
+ content: '';
271
+ position: absolute;
272
+ inset: 0;
273
+ background: linear-gradient(
274
+ DIRECTION,
275
+ transparent PERCENTAGE,
276
+ rgba(0,0,0,OPACITY) 100%
277
+ );
278
+ }
279
+ ```
280
+
281
+ ### Colored Overlay
282
+
283
+ ```css
284
+ /* Blend mode or layered gradient */
285
+ background:
286
+ linear-gradient(YOUR-COLOR-WITH-OPACITY),
287
+ url('image.jpg');
288
+ ```
289
+
290
+ ---
291
+
292
+ ## 8. Modern CSS Techniques
293
+
294
+ ### Container Queries (Concept)
295
+
296
+ ```
297
+ Instead of viewport breakpoints:
298
+ ├── Component responds to ITS container
299
+ ├── Truly modular, reusable components
300
+ └── Syntax: @container (condition) { }
301
+ ```
302
+
303
+ ### :has() Selector (Concept)
304
+
305
+ ```
306
+ Parent styling based on children:
307
+ ├── "Parent that has X child"
308
+ ├── Enables previously impossible patterns
309
+ └── Progressive enhancement approach
310
+ ```
311
+
312
+ ### Scroll-Driven Animations (Concept)
313
+
314
+ ```
315
+ Animation progress tied to scroll:
316
+ ├── Entry/exit animations on scroll
317
+ ├── Parallax effects
318
+ ├── Progress indicators
319
+ └── View-based or scroll-based timeline
320
+ ```
321
+
322
+ ---
323
+
324
+ ## 9. Performance Principles
325
+
326
+ ### GPU-Accelerated Properties
327
+
328
+ ```
329
+ CHEAP to animate (GPU):
330
+ ├── transform (translate, scale, rotate)
331
+ └── opacity
332
+
333
+ EXPENSIVE to animate (CPU):
334
+ ├── width, height
335
+ ├── top, left, right, bottom
336
+ ├── margin, padding
337
+ └── box-shadow (recalculates)
338
+ ```
339
+
340
+ ### will-change Usage
341
+
342
+ ```css
343
+ /* Use sparingly, only for heavy animations */
344
+ .heavy-animation {
345
+ will-change: transform;
346
+ }
347
+
348
+ /* Remove after animation if possible */
349
+ ```
350
+
351
+ ### Reduced Motion
352
+
353
+ ```css
354
+ @media (prefers-reduced-motion: reduce) {
355
+ /* Disable or minimize animations */
356
+ /* Respect user preference */
357
+ }
358
+ ```
359
+
360
+ ---
361
+
362
+ ## 10. Effect Selection Checklist
363
+
364
+ Before applying any effect:
365
+
366
+ - [ ] **Does it serve a purpose?** (not just decoration)
367
+ - [ ] **Is it appropriate for the context?** (brand, audience)
368
+ - [ ] **Have you varied from previous projects?** (avoid repetition)
369
+ - [ ] **Is it accessible?** (contrast, motion sensitivity)
370
+ - [ ] **Is it performant?** (especially on mobile)
371
+ - [ ] **Did you ask user preference?** (if style open-ended)
372
+
373
+ ### Anti-Patterns
374
+
375
+ - ❌ Glassmorphism on every element (kitsch)
376
+ - ❌ Dark + neon as default (lazy AI look)
377
+ - ❌ **Static/Flat designs with no depth (FAILED)**
378
+ - ❌ Effects that hurt readability
379
+ - ❌ Animations without purpose
380
+
381
+ ---
382
+
383
+ > **Remember**: Effects enhance meaning. Choose based on purpose and context, not because it "looks cool."
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: react-nextjs
3
+ description: React and Next.js patterns - component design, state management, data fetching, App Router, Server Components. Use when building web applications.
4
+ ---
5
+
6
+ # React & Next.js Patterns
7
+
8
+ ## When to Activate
9
+ - Building React components or pages
10
+ - Setting up Next.js project structure
11
+ - Choosing state management approach
12
+ - Optimizing data fetching
13
+ - Migrating to App Router
14
+
15
+ ## Component Design
16
+
17
+ ### Principles
18
+ - Small, focused components (one responsibility)
19
+ - Composition over inheritance
20
+ - Function components with hooks
21
+ - Props defined with TypeScript interfaces
22
+
23
+ ```tsx
24
+ interface UserCardProps {
25
+ user: User;
26
+ onSelect: (id: string) => void;
27
+ }
28
+
29
+ function UserCard({ user, onSelect }: UserCardProps) {
30
+ return <button onClick={() => onSelect(user.id)}>{user.name}</button>;
31
+ }
32
+ ```
33
+
34
+ ### Compound Components
35
+ Use when related UI shares state and interaction:
36
+
37
+ ```tsx
38
+ <Tabs defaultValue="overview">
39
+ <Tabs.List>
40
+ <Tabs.Trigger value="overview">Overview</Tabs.Trigger>
41
+ <Tabs.Trigger value="settings">Settings</Tabs.Trigger>
42
+ </Tabs.List>
43
+ <Tabs.Content value="overview">...</Tabs.Content>
44
+ <Tabs.Content value="settings">...</Tabs.Content>
45
+ </Tabs>
46
+ ```
47
+
48
+ ### Container / Presentational Split
49
+ - Container: owns data loading and side effects
50
+ - Presentational: receives props, renders UI (pure)
51
+
52
+ ## State Management Decision Tree
53
+
54
+ | Concern | Tool | When |
55
+ |---------|------|------|
56
+ | Server state | TanStack Query, SWR | API data, caching |
57
+ | Client state | Zustand, Jotai | UI state, preferences |
58
+ | URL state | Search params | Filters, pagination, sort |
59
+ | Form state | React Hook Form | Complex forms |
60
+
61
+ ### Rules
62
+ - Never duplicate server state into client stores
63
+ - Derive values instead of storing computed state
64
+ - Use URL as state for shareable data
65
+
66
+ ## Data Fetching Patterns
67
+
68
+ ### Stale-While-Revalidate
69
+ Return cached data immediately, revalidate in background.
70
+
71
+ ### Optimistic Updates
72
+ 1. Snapshot current state
73
+ 2. Apply optimistic update immediately
74
+ 3. Roll back on failure
75
+ 4. Show error feedback
76
+
77
+ ### Parallel Loading
78
+ - Fetch independent data concurrently
79
+ - Avoid parent-child request waterfalls
80
+ - Prefetch likely next routes
81
+
82
+ ## Next.js App Router
83
+
84
+ ### Server vs Client Components
85
+
86
+ | Feature | Server Component | Client Component |
87
+ |---------|-----------------|-----------------|
88
+ | Default | Yes | No (`"use client"`) |
89
+ | Hooks | No | Yes |
90
+ | Browser APIs | No | Yes |
91
+ | Direct DB access | Yes | No |
92
+ | Streaming | Yes | No |
93
+
94
+ ### Decision: When to use `"use client"`
95
+ - Interactivity (onClick, onChange)
96
+ - Hooks (useState, useEffect)
97
+ - Browser APIs (localStorage, window)
98
+ - Third-party client libraries
99
+
100
+ ### Patterns
101
+ - Server Actions for mutations
102
+ - `loading.tsx` and `error.tsx` for boundaries
103
+ - Dynamic imports for heavy client components
104
+ - Parallel routes for complex layouts
105
+ - Intercepting routes for modals
106
+
107
+ ## Custom Hooks
108
+
109
+ ### Rules
110
+ - `use` prefix, single responsibility
111
+ - Always include cleanup in useEffect
112
+ - Never call hooks conditionally
113
+ - Avoid useEffect for derived state (use useMemo)
114
+
115
+ ```tsx
116
+ function useDebounce<T>(value: T, delay: number): T {
117
+ const [debounced, setDebounced] = useState(value);
118
+ useEffect(() => {
119
+ const timer = setTimeout(() => setDebounced(value), delay);
120
+ return () => clearTimeout(timer);
121
+ }, [value, delay]);
122
+ return debounced;
123
+ }
124
+ ```
125
+
126
+ ## Anti-Patterns
127
+
128
+ | Don't | Do Instead |
129
+ |-------|-----------|
130
+ | Prop drilling through 4+ levels | Context or state library |
131
+ | useEffect for derived state | useMemo |
132
+ | Giant components (200+ lines) | Split into smaller components |
133
+ | Fetch in useEffect | TanStack Query or Server Components |
134
+ | Index as key in dynamic lists | Stable unique ID |
135
+ | Inline object/function in JSX | useMemo/useCallback or extract |