@nockdev/awf 6.2.6 → 6.2.8

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 (269) hide show
  1. package/.agent/config.yaml +2 -2
  2. package/.agent/core/AGENT_BEHAVIOR.md +1 -1
  3. package/.agent/core/AUDIT_POLICY.md +1 -1
  4. package/.agent/core/CACHE.md +1 -1
  5. package/.agent/core/DATA_SAFETY.md +1 -1
  6. package/.agent/core/MEMORY_PATHS.yaml +2 -2
  7. package/.agent/core/PERMISSIONS.md +1 -1
  8. package/.agent/core/README.md +1 -1
  9. package/.agent/core/VERSION.yaml +4 -4
  10. package/.agent/core/archive/ACTIVE_MEMORY.yaml +2 -2
  11. package/.agent/core/archive/CHECKPOINT.yaml +2 -2
  12. package/.agent/core/archive/CLEANUP_ENGINE.yaml +2 -2
  13. package/.agent/core/archive/CONTEXT_INJECTOR.yaml +2 -2
  14. package/.agent/core/archive/CONTEXT_LOADER.yaml +1 -1
  15. package/.agent/core/archive/CONTEXT_OPTIMIZATION.yaml +1 -1
  16. package/.agent/core/archive/CONTEXT_PRIORITY.yaml +2 -2
  17. package/.agent/core/archive/FLOW_ENGINE.yaml +1 -1
  18. package/.agent/core/archive/GRAPH_MEMORY.yaml +1 -1
  19. package/.agent/core/archive/HYBRID_ROUTER.yaml +1 -1
  20. package/.agent/core/archive/INTENT_DETECTION.yaml +1 -1
  21. package/.agent/core/archive/MEMORY_CONSOLIDATION.yaml +3 -3
  22. package/.agent/core/archive/MEMORY_ENGINE.yaml +2 -2
  23. package/.agent/core/archive/MEMORY_UTILS.yaml +1 -1
  24. package/.agent/core/archive/REFLECTION_ENGINE.yaml +1 -1
  25. package/.agent/core/archive/ROUTER.yaml +4 -4
  26. package/.agent/core/archive/SCORING_FORMULA.yaml +2 -2
  27. package/.agent/core/archive/SEMANTIC_ENGINE.yaml +1 -1
  28. package/.agent/core/archive/SKILLS_FLOW.yaml +1 -1
  29. package/.agent/core/archive/STATE_MACHINE.yaml +1 -1
  30. package/.agent/core/archive/SUMMARIZATION_ENGINE.yaml +2 -2
  31. package/.agent/core/archive/TOKEN_BUDGETS.yaml +2 -2
  32. package/.agent/core/archive/TOKEN_LOADING.yaml +2 -2
  33. package/.agent/core/archive/TOKEN_SUMMARY.yaml +2 -2
  34. package/.agent/core/reference/CODING_STYLES.yaml +1 -1
  35. package/.agent/core/reference/LIBRARY_REGISTRY.yaml +1 -1
  36. package/.agent/core/reference/MCP_TOOLS.yaml +2 -2
  37. package/.agent/core/reference/PATTERNS.yaml +1 -1
  38. package/.agent/core/reference/SKILL_SCHEMA.yaml +1 -1
  39. package/.agent/i18n/en.yaml +6 -6
  40. package/.agent/i18n/vi.yaml +6 -6
  41. package/.agent/ide/README.md +1 -1
  42. package/.agent/ide/amazonq.json +1 -1
  43. package/.agent/ide/amp.json +1 -1
  44. package/.agent/ide/antigravity.json +1 -1
  45. package/.agent/ide/augment.json +1 -1
  46. package/.agent/ide/claude.json +1 -1
  47. package/.agent/ide/cline.json +1 -1
  48. package/.agent/ide/cody.json +1 -1
  49. package/.agent/ide/continue.json +1 -1
  50. package/.agent/ide/cursor.json +1 -1
  51. package/.agent/ide/gemini.json +1 -1
  52. package/.agent/ide/jetbrains.json +1 -1
  53. package/.agent/ide/kiro.json +1 -1
  54. package/.agent/ide/opencode.json +1 -1
  55. package/.agent/ide/roo.json +1 -1
  56. package/.agent/ide/tabnine.json +1 -1
  57. package/.agent/ide/trae.json +1 -1
  58. package/.agent/ide/vscode.json +1 -1
  59. package/.agent/ide/windsurf.json +1 -1
  60. package/.agent/ide/zed.json +1 -1
  61. package/.agent/manifest.yaml +1 -1
  62. package/.agent/personas/README.md +1 -1
  63. package/.agent/personas/architect.md +1 -1
  64. package/.agent/personas/auditor.md +1 -1
  65. package/.agent/personas/debugger.md +1 -1
  66. package/.agent/personas/developer.md +1 -1
  67. package/.agent/personas/devops.md +1 -1
  68. package/.agent/personas/documenter.md +1 -1
  69. package/.agent/personas/orchestrator.md +1 -1
  70. package/.agent/personas/persona.schema.yaml +1 -1
  71. package/.agent/personas/planner.md +1 -1
  72. package/.agent/personas/researcher.md +1 -1
  73. package/.agent/personas/security.md +1 -1
  74. package/.agent/personas/tester.md +1 -1
  75. package/.agent/rules/README.md +1 -1
  76. package/.agent/rules/archive/constitutional/tier-0-core.yaml +5 -5
  77. package/.agent/rules/archive/constitutional/tier-1-safety.yaml +5 -5
  78. package/.agent/rules/archive/constitutional/tier-2-execution.yaml +6 -6
  79. package/.agent/rules/archive/context-management.yaml +1 -1
  80. package/.agent/rules/archive/duplication-prevention.md +1 -1
  81. package/.agent/rules/archive/evidence.yaml +1 -1
  82. package/.agent/rules/archive/project-detection.md +1 -1
  83. package/.agent/rules/archive/reflection.yaml +1 -1
  84. package/.agent/rules/archive/versioning.yaml +5 -5
  85. package/.agent/rules/data/build-systems.yaml +2 -2
  86. package/.agent/rules/modules/agent-delegation.yaml +2 -2
  87. package/.agent/rules/modules/edit-verification.yaml +1 -1
  88. package/.agent/rules/modules/git-workflow.yaml +1 -1
  89. package/.agent/rules/modules/language.yaml +1 -1
  90. package/.agent/rules/modules/online-research.yaml +1 -1
  91. package/.agent/rules/modules/performance-optimization.yaml +2 -2
  92. package/.agent/rules/modules/quality.yaml +1 -1
  93. package/.agent/rules/modules/stop-conditions.yaml +1 -1
  94. package/.agent/rules/modules/terminal-safety.yaml +1 -1
  95. package/.agent/rules/modules/yagni.yaml +1 -1
  96. package/.agent/rules/validation-framework.md +1 -1
  97. package/.agent/skills/README.md +1 -1
  98. package/.agent/skills/_categories.yaml +2 -2
  99. package/.agent/skills/ai-ml/rag-patterns/META.yaml +2 -0
  100. package/.agent/skills/core/api-design/META.yaml +1 -1
  101. package/.agent/skills/core/authentication/META.yaml +1 -1
  102. package/.agent/skills/core/error-handling/META.yaml +1 -1
  103. package/.agent/skills/core/logging/META.yaml +1 -1
  104. package/.agent/skills/core/observability/META.yaml +1 -1
  105. package/.agent/skills/core/security/META.yaml +1 -1
  106. package/.agent/skills/core/security/SKILL.md +1 -1
  107. package/.agent/skills/cross-cutting/accessibility/META.yaml +1 -1
  108. package/.agent/skills/cross-cutting/audit-pro/META.yaml +9 -1
  109. package/.agent/skills/cross-cutting/audit-pro/SKILL.md +61 -5
  110. package/.agent/skills/cross-cutting/bun/META.yaml +17 -8
  111. package/.agent/skills/cross-cutting/bun/SKILL.md +1 -1
  112. package/.agent/skills/cross-cutting/coding-rules/META.yaml +1 -1
  113. package/.agent/skills/cross-cutting/database/META.yaml +42 -1
  114. package/.agent/skills/cross-cutting/database/SKILL.md +44 -628
  115. package/.agent/skills/cross-cutting/database/references/nosql-patterns.md +194 -0
  116. package/.agent/skills/cross-cutting/database/references/orms-patterns.md +278 -0
  117. package/.agent/skills/cross-cutting/database/references/postgresql.md +144 -0
  118. package/.agent/skills/cross-cutting/deno/META.yaml +19 -10
  119. package/.agent/skills/cross-cutting/deno/SKILL.md +1 -1
  120. package/.agent/skills/cross-cutting/domyh-design/META.yaml +1 -1
  121. package/.agent/skills/cross-cutting/domyh-design/data/desktop-colors.yaml +1 -1
  122. package/.agent/skills/cross-cutting/electron/SKILL.md +15 -616
  123. package/.agent/skills/cross-cutting/electron/references/ipc-testing.md +114 -0
  124. package/.agent/skills/cross-cutting/electron/references/native-integrations.md +216 -0
  125. package/.agent/skills/cross-cutting/electron/references/performance-accessibility.md +118 -0
  126. package/.agent/skills/cross-cutting/electron/references/updates-persistence.md +165 -0
  127. package/.agent/skills/cross-cutting/seo/META.yaml +1 -1
  128. package/.agent/skills/cross-cutting/skill-creator/META.yaml +37 -0
  129. package/.agent/skills/cross-cutting/skill-creator/SKILL.md +163 -0
  130. package/.agent/skills/cross-cutting/skill-creator/references/patterns.md +58 -0
  131. package/.agent/skills/cross-cutting/skill-creator/references/schema-v2.md +44 -0
  132. package/.agent/skills/cross-cutting/sql/META.yaml +1 -1
  133. package/.agent/skills/cross-cutting/sql/SKILL.md +1 -1
  134. package/.agent/skills/cross-cutting/tailwind/META.yaml +1 -1
  135. package/.agent/skills/cross-cutting/tailwind/SKILL.md +1 -1
  136. package/.agent/skills/cross-cutting/tdd-workflow/META.yaml +1 -1
  137. package/.agent/skills/cross-cutting/testing/META.yaml +7 -1
  138. package/.agent/skills/cross-cutting/testing/SKILL.md +1 -1
  139. package/.agent/skills/cross-cutting/testing/data/frameworks.yaml +1 -1
  140. package/.agent/skills/cross-cutting/web-perf/META.yaml +1 -1
  141. package/.agent/skills/cross-cutting/web-perf/SKILL.md +1 -1
  142. package/.agent/skills/devops/aws/META.yaml +1 -1
  143. package/.agent/skills/devops/aws/SKILL.md +101 -16
  144. package/.agent/skills/devops/azure/SKILL.md +96 -30
  145. package/.agent/skills/devops/ci-cd/META.yaml +1 -1
  146. package/.agent/skills/devops/ci-cd/SKILL.md +114 -8
  147. package/.agent/skills/devops/docker/META.yaml +1 -1
  148. package/.agent/skills/devops/docker/SKILL.md +96 -8
  149. package/.agent/skills/devops/gcp/SKILL.md +106 -30
  150. package/.agent/skills/devops/kubernetes/META.yaml +1 -1
  151. package/.agent/skills/devops/kubernetes/SKILL.md +125 -8
  152. package/.agent/skills/frameworks/angular/META.yaml +1 -1
  153. package/.agent/skills/frameworks/angular/SKILL.md +1 -1
  154. package/.agent/skills/frameworks/flutter/META.yaml +1 -1
  155. package/.agent/skills/frameworks/flutter/SKILL.md +1 -1
  156. package/.agent/skills/frameworks/nextjs/META.yaml +1 -1
  157. package/.agent/skills/frameworks/nextjs/SKILL.md +1 -1
  158. package/.agent/skills/frameworks/nuxt/META.yaml +1 -1
  159. package/.agent/skills/frameworks/nuxt/SKILL.md +1 -1
  160. package/.agent/skills/frameworks/react/META.yaml +1 -1
  161. package/.agent/skills/frameworks/react/SKILL.md +24 -1
  162. package/.agent/skills/frameworks/react-native/META.yaml +1 -1
  163. package/.agent/skills/frameworks/react-native/SKILL.md +1 -1
  164. package/.agent/skills/frameworks/svelte/META.yaml +1 -1
  165. package/.agent/skills/frameworks/svelte/SKILL.md +1 -1
  166. package/.agent/skills/frameworks/vue/META.yaml +1 -1
  167. package/.agent/skills/frameworks/vue/SKILL.md +1 -1
  168. package/.agent/skills/index.json +2 -2
  169. package/.agent/skills/languages/asm/META.yaml +1 -1
  170. package/.agent/skills/languages/asm/SKILL.md +27 -436
  171. package/.agent/skills/languages/asm/references/advanced-architectures.md +191 -0
  172. package/.agent/skills/languages/asm/references/build-structure.md +150 -0
  173. package/.agent/skills/languages/asm/references/simd-programming.md +92 -0
  174. package/.agent/skills/languages/c/META.yaml +1 -1
  175. package/.agent/skills/languages/c/SKILL.md +14 -356
  176. package/.agent/skills/languages/c/references/data-structures.md +63 -0
  177. package/.agent/skills/languages/c/references/memory-management.md +74 -0
  178. package/.agent/skills/languages/c/references/platform-headers.md +230 -0
  179. package/.agent/skills/languages/clojure/META.yaml +1 -1
  180. package/.agent/skills/languages/clojure/SKILL.md +1 -1
  181. package/.agent/skills/languages/cpp/META.yaml +1 -1
  182. package/.agent/skills/languages/cpp/SKILL.md +22 -753
  183. package/.agent/skills/languages/cpp/references/headers-optimization.md +229 -0
  184. package/.agent/skills/languages/cpp/references/memory-concurrency.md +85 -0
  185. package/.agent/skills/languages/cpp/references/modern-cpp-features.md +126 -0
  186. package/.agent/skills/languages/cpp/references/platform-headers.md +202 -0
  187. package/.agent/skills/languages/cpp/references/stl-containers.md +57 -0
  188. package/.agent/skills/languages/crystal/META.yaml +1 -1
  189. package/.agent/skills/languages/crystal/SKILL.md +1 -1
  190. package/.agent/skills/languages/csharp/META.yaml +1 -1
  191. package/.agent/skills/languages/csharp/SKILL.md +1 -1
  192. package/.agent/skills/languages/elixir/META.yaml +1 -1
  193. package/.agent/skills/languages/elixir/SKILL.md +1 -1
  194. package/.agent/skills/languages/fsharp/META.yaml +1 -1
  195. package/.agent/skills/languages/fsharp/SKILL.md +1 -1
  196. package/.agent/skills/languages/go/META.yaml +1 -1
  197. package/.agent/skills/languages/go/SKILL.md +1 -1
  198. package/.agent/skills/languages/haskell/META.yaml +1 -1
  199. package/.agent/skills/languages/haskell/SKILL.md +1 -1
  200. package/.agent/skills/languages/java/META.yaml +1 -1
  201. package/.agent/skills/languages/java/SKILL.md +1 -1
  202. package/.agent/skills/languages/javascript/META.yaml +1 -1
  203. package/.agent/skills/languages/javascript/SKILL.md +1 -1
  204. package/.agent/skills/languages/julia/META.yaml +1 -1
  205. package/.agent/skills/languages/julia/SKILL.md +1 -1
  206. package/.agent/skills/languages/kotlin/META.yaml +1 -1
  207. package/.agent/skills/languages/kotlin/SKILL.md +1 -1
  208. package/.agent/skills/languages/lua/META.yaml +1 -1
  209. package/.agent/skills/languages/lua/SKILL.md +3 -3
  210. package/.agent/skills/languages/nim/META.yaml +1 -1
  211. package/.agent/skills/languages/nim/SKILL.md +1 -1
  212. package/.agent/skills/languages/ocaml/META.yaml +1 -1
  213. package/.agent/skills/languages/ocaml/SKILL.md +1 -1
  214. package/.agent/skills/languages/perl/META.yaml +1 -1
  215. package/.agent/skills/languages/perl/SKILL.md +1 -1
  216. package/.agent/skills/languages/php/META.yaml +1 -1
  217. package/.agent/skills/languages/php/SKILL.md +1 -1
  218. package/.agent/skills/languages/python/META.yaml +1 -1
  219. package/.agent/skills/languages/python/SKILL.md +1 -1
  220. package/.agent/skills/languages/r/META.yaml +1 -1
  221. package/.agent/skills/languages/r/SKILL.md +1 -1
  222. package/.agent/skills/languages/ruby/META.yaml +1 -1
  223. package/.agent/skills/languages/ruby/SKILL.md +1 -1
  224. package/.agent/skills/languages/rust/META.yaml +1 -1
  225. package/.agent/skills/languages/rust/SKILL.md +1 -1
  226. package/.agent/skills/languages/scala/META.yaml +1 -1
  227. package/.agent/skills/languages/scala/SKILL.md +1 -1
  228. package/.agent/skills/languages/solidity/META.yaml +1 -1
  229. package/.agent/skills/languages/solidity/SKILL.md +1 -1
  230. package/.agent/skills/languages/swift/META.yaml +1 -1
  231. package/.agent/skills/languages/swift/SKILL.md +1 -1
  232. package/.agent/skills/languages/typescript/META.yaml +19 -1
  233. package/.agent/skills/languages/typescript/SKILL.md +23 -1
  234. package/.agent/skills/languages/zig/META.yaml +1 -1
  235. package/.agent/skills/languages/zig/SKILL.md +1 -1
  236. package/.agent/templates/README.md +2 -2
  237. package/.agent/templates/chains/feature/step1-requirements.md +76 -0
  238. package/.agent/templates/chains/feature/step2-design.md +75 -0
  239. package/.agent/templates/chains/feature/step3-planning.md +81 -0
  240. package/.agent/templates/chains/feature/step4-implementation.md +74 -0
  241. package/.agent/templates/chains/feature/step5-testing.md +81 -0
  242. package/.agent/templates/debug-report.md +1 -1
  243. package/.agent/templates/deploy-plan.md +1 -1
  244. package/.agent/templates/doc-template.md +1 -1
  245. package/.agent/templates/feature-lifecycle.md +53 -0
  246. package/.agent/templates/index.yaml +53 -2
  247. package/.agent/templates/migrate-plan.md +1 -1
  248. package/.agent/templates/phase-template.md +1 -1
  249. package/.agent/templates/tasks/audit.yaml +1 -1
  250. package/.agent/templates/tasks/bug_fix.yaml +1 -1
  251. package/.agent/templates/tasks/code_implementation.yaml +1 -1
  252. package/.agent/templates/tasks/feature_development.yaml +89 -0
  253. package/.agent/templates/tasks/refactor.yaml +1 -1
  254. package/.agent/templates/test-report.md +1 -1
  255. package/.agent/workflows/doctor.md +124 -0
  256. package/.agent/workflows/feature.md +130 -0
  257. package/.agent/workflows/help.md +7 -5
  258. package/dist/commands/install.js +1 -1
  259. package/dist/commands/install.js.map +1 -1
  260. package/dist/constants/ide-install-specs.js +30 -30
  261. package/dist/constants/ide-install-specs.js.map +1 -1
  262. package/dist/constants/ides.d.ts.map +1 -1
  263. package/dist/constants/ides.js +7 -5
  264. package/dist/constants/ides.js.map +1 -1
  265. package/dist/constants.d.ts +1 -1
  266. package/dist/constants.js +1 -1
  267. package/dist/types/ide-install.d.ts +1 -1
  268. package/dist/types/ide-install.d.ts.map +1 -1
  269. package/package.json +2 -2
@@ -0,0 +1,194 @@
1
+ ## 🍃 MongoDB Patterns
2
+
3
+ ### When to Use MongoDB
4
+
5
+ | ✅ Good For | ❌ Not Good For |
6
+ | ------------------------ | ----------------------------- |
7
+ | Flexible/evolving schema | Complex joins |
8
+ | JSON-like documents | ACID transactions (multi-doc) |
9
+ | Rapid prototyping | Strong consistency |
10
+ | Content management | Financial data |
11
+ | IoT data ingestion | Complex queries |
12
+ | Real-time analytics | Relational data |
13
+
14
+ ### MongoDB Node.js Patterns
15
+
16
+ ```typescript
17
+ import { MongoClient, ObjectId } from "mongodb";
18
+
19
+ const client = new MongoClient(process.env.MONGODB_URI);
20
+ const db = client.db("myapp");
21
+
22
+ // ✅ Insert
23
+ await db.collection("users").insertOne({
24
+ email: "alice@example.com",
25
+ name: "Alice",
26
+ metadata: { lastLogin: new Date(), preferences: { theme: "dark" } },
27
+ createdAt: new Date(),
28
+ });
29
+
30
+ // ✅ Find with projection
31
+ const user = await db.collection("users").findOne(
32
+ { email: "alice@example.com" },
33
+ { projection: { password: 0 } }, // Exclude password
34
+ );
35
+
36
+ // ✅ Aggregation pipeline
37
+ const results = await db
38
+ .collection("orders")
39
+ .aggregate([
40
+ { $match: { status: "completed" } },
41
+ {
42
+ $group: {
43
+ _id: "$userId",
44
+ totalAmount: { $sum: "$amount" },
45
+ orderCount: { $sum: 1 },
46
+ },
47
+ },
48
+ { $sort: { totalAmount: -1 } },
49
+ { $limit: 10 },
50
+ ])
51
+ .toArray();
52
+
53
+ // ✅ Indexes
54
+ await db.collection("users").createIndex({ email: 1 }, { unique: true });
55
+ await db
56
+ .collection("events")
57
+ .createIndex({ createdAt: 1 }, { expireAfterSeconds: 86400 });
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🔴 Redis Patterns
63
+
64
+ ### Redis Use Cases
65
+
66
+ | Pattern | Use Case | TTL |
67
+ | --------------- | -------------------- | ---------- |
68
+ | **Cache** | Database query cache | 5-60 min |
69
+ | **Session** | User sessions | 24h |
70
+ | **Rate Limit** | API throttling | 1 min |
71
+ | **Leaderboard** | Sorted sets | Persistent |
72
+ | **Pub/Sub** | Real-time events | N/A |
73
+ | **Queue** | Job queue (List) | N/A |
74
+ | **Lock** | Distributed lock | 30s |
75
+
76
+ ### Redis Node.js Patterns
77
+
78
+ ```typescript
79
+ import Redis from "ioredis";
80
+
81
+ const redis = new Redis(process.env.REDIS_URL);
82
+
83
+ // ✅ Cache pattern
84
+ async function getCachedUser(userId: string) {
85
+ const cacheKey = `user:${userId}`;
86
+
87
+ // Try cache first
88
+ const cached = await redis.get(cacheKey);
89
+ if (cached) return JSON.parse(cached);
90
+
91
+ // Cache miss - fetch from DB
92
+ const user = await db.users.findUnique({ where: { id: userId } });
93
+
94
+ // Store in cache with TTL
95
+ await redis.setex(cacheKey, 3600, JSON.stringify(user));
96
+
97
+ return user;
98
+ }
99
+
100
+ // ✅ Rate limiting (sliding window)
101
+ async function checkRateLimit(ip: string, limit = 100, windowSec = 60) {
102
+ const key = `ratelimit:${ip}`;
103
+ const current = await redis.incr(key);
104
+
105
+ if (current === 1) {
106
+ await redis.expire(key, windowSec);
107
+ }
108
+
109
+ return current <= limit;
110
+ }
111
+
112
+ // ✅ Session storage
113
+ await redis.hset(`session:${sessionId}`, {
114
+ userId: user.id,
115
+ email: user.email,
116
+ loginAt: Date.now(),
117
+ });
118
+ await redis.expire(`session:${sessionId}`, 86400); // 24h
119
+
120
+ // ✅ Leaderboard
121
+ await redis.zadd("leaderboard", score, `user:${userId}`);
122
+ const top10 = await redis.zrevrange("leaderboard", 0, 9, "WITHSCORES");
123
+
124
+ // ✅ Pub/Sub
125
+ const subscriber = redis.duplicate();
126
+ await subscriber.subscribe("notifications");
127
+ subscriber.on("message", (channel, message) => {
128
+ console.log(`Received: ${message}`);
129
+ });
130
+
131
+ await redis.publish("notifications", JSON.stringify({ type: "new_order" }));
132
+
133
+ // ✅ Distributed lock
134
+ async function withLock<T>(key: string, fn: () => Promise<T>, ttlMs = 30000) {
135
+ const lockKey = `lock:${key}`;
136
+ const lockValue = crypto.randomUUID();
137
+
138
+ const acquired = await redis.set(lockKey, lockValue, "PX", ttlMs, "NX");
139
+ if (!acquired) throw new Error("Failed to acquire lock");
140
+
141
+ try {
142
+ return await fn();
143
+ } finally {
144
+ // Release only if we own the lock
145
+ const script = `
146
+ if redis.call("get", KEYS[1]) == ARGV[1] then
147
+ return redis.call("del", KEYS[1])
148
+ else
149
+ return 0
150
+ end
151
+ `;
152
+ await redis.eval(script, 1, lockKey, lockValue);
153
+ }
154
+ }
155
+ ```
156
+
157
+ ---
158
+
159
+ ## 🛠️ Database Tools
160
+
161
+ ### Migration Tools
162
+
163
+ | Tool | Language | Database |
164
+ | ------------------ | -------- | ---------- |
165
+ | **Prisma Migrate** | TS/JS | Multi |
166
+ | **Drizzle Kit** | TS/JS | Multi |
167
+ | **golang-migrate** | Go | Multi |
168
+ | **Alembic** | Python | SQLAlchemy |
169
+ | **Flyway** | Java/CLI | Multi |
170
+ | **Atlas** | Go | Multi |
171
+
172
+ ### Monitoring & GUI
173
+
174
+ | Tool | Purpose |
175
+ | ------------------- | -------------- |
176
+ | **pgAdmin** | PostgreSQL GUI |
177
+ | **DBeaver** | Universal GUI |
178
+ | **TablePlus** | Multi-DB GUI |
179
+ | **Prisma Studio** | Prisma visual |
180
+ | **RedisInsight** | Redis GUI |
181
+ | **MongoDB Compass** | MongoDB GUI |
182
+
183
+ ### Connection Pooling
184
+
185
+ | Tool | Database |
186
+ | ----------------- | ---------- |
187
+ | **PgBouncer** | PostgreSQL |
188
+ | **PgCat** | PostgreSQL |
189
+ | **ProxySQL** | MySQL |
190
+ | **Redis Cluster** | Redis |
191
+
192
+ ---
193
+
194
+ ## ✅ Production Checklist
@@ -0,0 +1,278 @@
1
+ ## 📦 MySQL 8.x
2
+
3
+ ### MySQL Core Patterns
4
+
5
+ ```sql
6
+ -- ✅ Parameterized queries (use ? placeholder)
7
+ SELECT id, name FROM users WHERE id = ?;
8
+
9
+ -- ✅ Indexes
10
+ CREATE INDEX idx_users_email ON users(email);
11
+
12
+ -- ✅ Full-text search
13
+ CREATE FULLTEXT INDEX idx_products_search
14
+ ON products(name, description);
15
+
16
+ SELECT * FROM products
17
+ WHERE MATCH(name, description) AGAINST('laptop' IN NATURAL LANGUAGE MODE);
18
+
19
+ -- ✅ Window functions
20
+ SELECT id, name, price,
21
+ ROW_NUMBER() OVER (ORDER BY price DESC) AS rank,
22
+ AVG(price) OVER () AS avg_price
23
+ FROM products;
24
+ ```
25
+
26
+ ### MySQL vs PostgreSQL
27
+
28
+ | Feature | PostgreSQL | MySQL |
29
+ | ---------------- | ----------------------- | ----------------- |
30
+ | JSON Support | JSONB (binary, indexed) | JSON (text-based) |
31
+ | Full-text Search | Built-in tsquery | FULLTEXT index |
32
+ | CTEs | Optimized | Less optimized |
33
+ | Arrays | Native | JSON workaround |
34
+ | Enums | Native | Limited |
35
+ | Partitioning | Declarative | Hash, Range, List |
36
+ | Replication | Logical + Physical | Group Replication |
37
+
38
+ ---
39
+
40
+ ## 📦 ORMs Comparison (2025)
41
+
42
+ ### Node.js/TypeScript
43
+
44
+ | ORM | Type Safety | Performance | Bundle Size | Best For |
45
+ | ------------- | ----------- | ----------- | ----------- | --------------------- |
46
+ | **Prisma 7** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 90% smaller | Type-safe, Next.js |
47
+ | **Drizzle** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ~7.4kb | Serverless, SQL-first |
48
+ | **TypeORM** | ⭐⭐⭐⭐ | ⭐⭐⭐ | Medium | NestJS, Enterprise |
49
+ | **Sequelize** | ⭐⭐⭐ | ⭐⭐⭐ | Medium | Legacy, Beginner |
50
+ | **Kysely** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Tiny | Type-safe SQL builder |
51
+
52
+ ### Python
53
+
54
+ | ORM | Use Case |
55
+ | ------------------ | -------------------------------- |
56
+ | **SQLAlchemy 2.0** | Industry standard, async support |
57
+ | **Tortoise ORM** | Async-first, Django-like |
58
+ | **SQLModel** | Pydantic + SQLAlchemy |
59
+
60
+ ### Go
61
+
62
+ | Library | Use Case |
63
+ | -------- | --------------------------- |
64
+ | **GORM** | Full-featured ORM |
65
+ | **sqlc** | Code generation from SQL |
66
+ | **sqlx** | Extensions for database/sql |
67
+ | **pgx** | PostgreSQL driver |
68
+
69
+ ---
70
+
71
+ ## 🔷 Prisma Patterns
72
+
73
+ ### Schema Definition
74
+
75
+ ```prisma
76
+ // schema.prisma
77
+ generator client {
78
+ provider = "prisma-client-js"
79
+ }
80
+
81
+ datasource db {
82
+ provider = "postgresql"
83
+ url = env("DATABASE_URL")
84
+ }
85
+
86
+ model User {
87
+ id String @id @default(cuid())
88
+ email String @unique
89
+ name String?
90
+ role Role @default(USER)
91
+ posts Post[]
92
+ profile Profile?
93
+ createdAt DateTime @default(now())
94
+ updatedAt DateTime @updatedAt
95
+
96
+ @@index([email])
97
+ @@index([createdAt])
98
+ }
99
+
100
+ model Post {
101
+ id String @id @default(cuid())
102
+ title String
103
+ content String?
104
+ published Boolean @default(false)
105
+ author User @relation(fields: [authorId], references: [id])
106
+ authorId String
107
+ tags Tag[]
108
+ createdAt DateTime @default(now())
109
+
110
+ @@index([authorId])
111
+ @@index([published, createdAt])
112
+ }
113
+
114
+ enum Role {
115
+ USER
116
+ ADMIN
117
+ MODERATOR
118
+ }
119
+ ```
120
+
121
+ ### Prisma Queries
122
+
123
+ ```typescript
124
+ import { PrismaClient } from "@prisma/client";
125
+
126
+ const prisma = new PrismaClient();
127
+
128
+ // ✅ Find with relations
129
+ const users = await prisma.user.findMany({
130
+ where: { role: "ADMIN" },
131
+ include: { posts: { where: { published: true } } },
132
+ orderBy: { createdAt: "desc" },
133
+ take: 10,
134
+ });
135
+
136
+ // ✅ Create with nested relations
137
+ const user = await prisma.user.create({
138
+ data: {
139
+ email: "alice@example.com",
140
+ name: "Alice",
141
+ posts: {
142
+ create: [{ title: "Hello World", content: "First post!" }],
143
+ },
144
+ },
145
+ include: { posts: true },
146
+ });
147
+
148
+ // ✅ Transaction (atomic operations)
149
+ const [updatedUser, newPost] = await prisma.$transaction([
150
+ prisma.user.update({
151
+ where: { id: userId },
152
+ data: { postCount: { increment: 1 } },
153
+ }),
154
+ prisma.post.create({
155
+ data: { title: "New Post", authorId: userId },
156
+ }),
157
+ ]);
158
+
159
+ // ✅ Interactive transaction
160
+ await prisma.$transaction(async (tx) => {
161
+ const balance = await tx.account.findUnique({
162
+ where: { id: fromAccountId },
163
+ });
164
+
165
+ if (balance.amount < transferAmount) {
166
+ throw new Error("Insufficient funds");
167
+ }
168
+
169
+ await tx.account.update({
170
+ where: { id: fromAccountId },
171
+ data: { amount: { decrement: transferAmount } },
172
+ });
173
+
174
+ await tx.account.update({
175
+ where: { id: toAccountId },
176
+ data: { amount: { increment: transferAmount } },
177
+ });
178
+ });
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 🔶 Drizzle Patterns
184
+
185
+ ### Schema Definition
186
+
187
+ ```typescript
188
+ // schema.ts
189
+ import { pgTable, text, timestamp, boolean, index } from "drizzle-orm/pg-core";
190
+ import { relations } from "drizzle-orm";
191
+
192
+ export const users = pgTable(
193
+ "users",
194
+ {
195
+ id: text("id")
196
+ .primaryKey()
197
+ .$defaultFn(() => crypto.randomUUID()),
198
+ email: text("email").notNull().unique(),
199
+ name: text("name"),
200
+ createdAt: timestamp("created_at").defaultNow().notNull(),
201
+ },
202
+ (table) => ({
203
+ emailIdx: index("users_email_idx").on(table.email),
204
+ }),
205
+ );
206
+
207
+ export const posts = pgTable(
208
+ "posts",
209
+ {
210
+ id: text("id")
211
+ .primaryKey()
212
+ .$defaultFn(() => crypto.randomUUID()),
213
+ title: text("title").notNull(),
214
+ content: text("content"),
215
+ published: boolean("published").default(false),
216
+ authorId: text("author_id")
217
+ .notNull()
218
+ .references(() => users.id),
219
+ createdAt: timestamp("created_at").defaultNow().notNull(),
220
+ },
221
+ (table) => ({
222
+ authorIdx: index("posts_author_idx").on(table.authorId),
223
+ }),
224
+ );
225
+
226
+ export const usersRelations = relations(users, ({ many }) => ({
227
+ posts: many(posts),
228
+ }));
229
+
230
+ export const postsRelations = relations(posts, ({ one }) => ({
231
+ author: one(users, {
232
+ fields: [posts.authorId],
233
+ references: [users.id],
234
+ }),
235
+ }));
236
+ ```
237
+
238
+ ### Drizzle Queries
239
+
240
+ ```typescript
241
+ import { drizzle } from "drizzle-orm/node-postgres";
242
+ import { eq, and, desc } from "drizzle-orm";
243
+ import * as schema from "./schema";
244
+
245
+ const db = drizzle(pool, { schema });
246
+
247
+ // ✅ SQL-like query API
248
+ const activeUsers = await db
249
+ .select()
250
+ .from(schema.users)
251
+ .where(eq(schema.users.active, true))
252
+ .orderBy(desc(schema.users.createdAt))
253
+ .limit(10);
254
+
255
+ // ✅ Relational query API
256
+ const usersWithPosts = await db.query.users.findMany({
257
+ with: {
258
+ posts: {
259
+ where: eq(schema.posts.published, true),
260
+ },
261
+ },
262
+ });
263
+
264
+ // ✅ Transaction
265
+ await db.transaction(async (tx) => {
266
+ await tx
267
+ .update(schema.accounts)
268
+ .set({ balance: sql`balance - 100` })
269
+ .where(eq(schema.accounts.id, 1));
270
+
271
+ await tx
272
+ .update(schema.accounts)
273
+ .set({ balance: sql`balance + 100` })
274
+ .where(eq(schema.accounts.id, 2));
275
+ });
276
+ ```
277
+
278
+ ---
@@ -0,0 +1,144 @@
1
+ ## 🐘 PostgreSQL 17/18 (2024-2025)
2
+
3
+ ### Version Comparison
4
+
5
+ | Feature | PG 17 (2024) | PG 18 (2025) |
6
+ | ------------------------- | ------------ | ------------ |
7
+ | JSON_TABLE() | ✅ | ✅ |
8
+ | Incremental Backup | ✅ | ✅ |
9
+ | MERGE + RETURNING | ✅ | ✅ |
10
+ | Asynchronous I/O (AIO) | ❌ | ✅ NEW |
11
+ | Skip Scan (B-tree) | ❌ | ✅ NEW |
12
+ | RETURNING OLD/NEW | ❌ | ✅ NEW |
13
+ | UUIDv7 | ❌ | ✅ NEW |
14
+ | Virtual Generated Columns | ❌ | ✅ NEW |
15
+ | NOT NULL (NOT VALID) | ❌ | ✅ NEW |
16
+
17
+ ### PostgreSQL Core Patterns
18
+
19
+ ```sql
20
+ -- ✅ Parameterized queries (prevent SQL injection)
21
+ SELECT id, name, email FROM users WHERE id = $1;
22
+
23
+ -- ✅ Indexes (critical for performance)
24
+ CREATE INDEX idx_users_email ON users(email);
25
+ CREATE INDEX idx_orders_user_created
26
+ ON orders(user_id, created_at DESC);
27
+
28
+ -- ✅ Partial index (index subset of rows)
29
+ CREATE INDEX idx_active_users ON users(email)
30
+ WHERE active = true;
31
+
32
+ -- ✅ Covering index (include columns to avoid table lookup)
33
+ CREATE INDEX idx_orders_covering
34
+ ON orders(user_id) INCLUDE (status, total);
35
+
36
+ -- ✅ BRIN index (for large time-series tables)
37
+ CREATE INDEX idx_events_created
38
+ ON events USING BRIN(created_at);
39
+ ```
40
+
41
+ ### PostgreSQL 18 New Features
42
+
43
+ ```sql
44
+ -- ✅ PG 18: RETURNING OLD and NEW values
45
+ UPDATE products SET price = price * 1.1
46
+ RETURNING OLD.price AS old_price, NEW.price AS new_price;
47
+
48
+ DELETE FROM users WHERE inactive = true
49
+ RETURNING OLD.*;
50
+
51
+ -- ✅ PG 18: UUIDv7 (time-ordered, better for indexes)
52
+ SELECT uuidv7(); -- e.g., 019445a0-c000-7000-8000-000000000001
53
+
54
+ -- ✅ PG 18: NOT NULL constraint without full scan
55
+ ALTER TABLE large_table
56
+ ADD CONSTRAINT col_not_null
57
+ CHECK (col IS NOT NULL) NOT VALID;
58
+ -- Validate later without ACCESS EXCLUSIVE lock
59
+ ALTER TABLE large_table
60
+ VALIDATE CONSTRAINT col_not_null;
61
+ ```
62
+
63
+ ### PostgreSQL JSON Operations
64
+
65
+ ```sql
66
+ -- ✅ JSONB storage and querying
67
+ CREATE TABLE events (
68
+ id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
69
+ data JSONB NOT NULL,
70
+ created_at TIMESTAMPTZ DEFAULT NOW()
71
+ );
72
+
73
+ -- GIN index for JSONB
74
+ CREATE INDEX idx_events_data ON events USING GIN(data);
75
+
76
+ -- Query JSONB
77
+ SELECT * FROM events
78
+ WHERE data @> '{"type": "purchase"}';
79
+
80
+ SELECT data->>'user_id' AS user_id,
81
+ (data->>'amount')::NUMERIC AS amount
82
+ FROM events
83
+ WHERE data->>'type' = 'purchase';
84
+
85
+ -- ✅ PG 17: JSON_TABLE (convert JSON to rows)
86
+ SELECT jt.*
87
+ FROM events,
88
+ JSON_TABLE(
89
+ data,
90
+ '$.items[*]'
91
+ COLUMNS (
92
+ product_id INT PATH '$.product_id',
93
+ quantity INT PATH '$.qty',
94
+ price NUMERIC PATH '$.price'
95
+ )
96
+ ) AS jt;
97
+ ```
98
+
99
+ ### PostgreSQL Transactions & Locking
100
+
101
+ ```sql
102
+ -- ✅ Transaction with proper isolation
103
+ BEGIN;
104
+ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
105
+
106
+ SELECT balance FROM accounts WHERE id = 1 FOR UPDATE;
107
+ UPDATE accounts SET balance = balance - 100 WHERE id = 1;
108
+ UPDATE accounts SET balance = balance + 100 WHERE id = 2;
109
+
110
+ COMMIT;
111
+
112
+ -- ✅ Advisory locks (application-level)
113
+ SELECT pg_advisory_lock(12345); -- Acquire
114
+ -- Do work...
115
+ SELECT pg_advisory_unlock(12345); -- Release
116
+ ```
117
+
118
+ ### PostgreSQL Configuration (Performance)
119
+
120
+ ```sql
121
+ -- Key parameters for performance tuning
122
+ -- postgresql.conf
123
+
124
+ -- Memory (adjust based on RAM)
125
+ shared_buffers = '4GB' -- 25% of RAM
126
+ effective_cache_size = '12GB' -- 75% of RAM
127
+ work_mem = '256MB' -- Per operation
128
+ maintenance_work_mem = '1GB' -- For VACUUM, CREATE INDEX
129
+
130
+ -- WAL
131
+ wal_buffers = '64MB'
132
+ checkpoint_timeout = '15min'
133
+ max_wal_size = '4GB'
134
+
135
+ -- Connections
136
+ max_connections = 200
137
+ -- Use PgBouncer for connection pooling!
138
+
139
+ -- Queries
140
+ statement_timeout = '30s' -- Prevent long queries
141
+ lock_timeout = '10s' -- Prevent lock waiting
142
+ ```
143
+
144
+ ---
@@ -1,17 +1,12 @@
1
1
  name: deno
2
- version: "6.2.6"
2
+ version: "6.2.7"
3
3
  category: runtime
4
4
  tier: 3
5
5
 
6
6
  desc: "Deno 2.6+ development patterns. Covers TypeScript-first, permissions, Fresh framework, npm/jsr compat, OpenTelemetry."
7
7
 
8
- patterns:
9
- total: 27
10
- domains:
11
- runtime: 12
12
- security: 9
13
- tooling: 6
14
-
8
+ triggers:
9
+ file_patterns:
15
10
  - "deno.json"
16
11
  - "deno.jsonc"
17
12
  - "deno.lock"
@@ -29,8 +24,8 @@ patterns:
29
24
  - permissions deno
30
25
  - deno compile
31
26
  - deno audit
32
- - jsr:
33
- - npm:
27
+ - "jsr:"
28
+ - "npm:"
34
29
  # Security
35
30
  - "--allow-net"
36
31
  - "--allow-read"
@@ -52,6 +47,20 @@ patterns:
52
47
  - deno deploy
53
48
  - deno permissions
54
49
 
50
+ caps:
51
+ - Deno runtime & permissions
52
+ - Deno.serve HTTP server
53
+ - Deno KV database
54
+ - Fresh framework
55
+ - JSR package registry
56
+
57
+ patterns:
58
+ total: 27
59
+ domains:
60
+ runtime: 12
61
+ security: 9
62
+ tooling: 6
63
+
55
64
  related_skills:
56
65
  - typescript
57
66
  - javascript
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: deno
3
3
  detect: ["deno.json", "deno.jsonc", "deno.lock", "mod.ts", "deps.ts"]
4
- version: "6.2.6"
4
+ version: "6.2.7"
5
5
  category: runtime
6
6
  tier: 2
7
7
  ---
@@ -1,5 +1,5 @@
1
1
  name: domyh-design
2
- version: "6.2.6"
2
+ version: "6.2.7"
3
3
  display: UI/UX Pro Max
4
4
  category: cross-cutting
5
5
  tier: 1
@@ -248,7 +248,7 @@ patterns:
248
248
  hex: "#007AFF"
249
249
  rgb: 0,122,255
250
250
  usage: Default accent color
251
- contrast_ratio: v6.2.6:1
251
+ contrast_ratio: v6.2.7:1
252
252
  - id: item_027
253
253
  platform: macos
254
254
  theme: dark