vybekiit 0.7.25 → 0.7.27

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 (247) hide show
  1. package/dist/bin.js +3891 -1301
  2. package/dist/global-skills/aws-cdk/SKILL.md +19 -5
  3. package/dist/global-skills/aws-cdk/references/fast-deployments.md +191 -0
  4. package/dist/global-skills/aws-cdk/references/troubleshooting-deployment.md +16 -0
  5. package/dist/global-skills/aws-cloudformation/SKILL.md +16 -26
  6. package/dist/global-skills/aws-cloudformation/references/check-cloudformation-template-compliance.script.md +7 -3
  7. package/dist/global-skills/aws-cloudformation/references/cloudformation-language-server.md +177 -0
  8. package/dist/global-skills/aws-cloudformation/references/cloudformation-pre-deploy-validation.script.md +8 -2
  9. package/dist/global-skills/aws-cloudformation/references/persist-template-context.script.md +5 -8
  10. package/dist/global-skills/aws-cloudformation/references/retrieve-template-context.script.md +1 -1
  11. package/dist/global-skills/aws-cloudformation/references/security-considerations.md +51 -0
  12. package/dist/global-skills/aws-cloudformation/references/troubleshoot-failed-stack.script.md +138 -0
  13. package/dist/global-skills/aws-cloudformation/references/{validate-cloudformation-template.script.md → validate-with-cfn-lint.script.md} +15 -27
  14. package/dist/global-skills/aws-cloudformation/references/validate-with-cloudformation-validate.script.md +181 -0
  15. package/dist/global-skills/aws-cloudformation/references/validation-tool-selection.md +44 -0
  16. package/dist/global-skills/aws-serverless/SKILL.md +9 -1
  17. package/dist/global-skills/aws-serverless/references/architecture.md +3 -1
  18. package/dist/global-skills/aws-serverless/references/lambda.md +3 -1
  19. package/dist/global-skills/aws-serverless/references/orchestration.md +1 -0
  20. package/dist/global-skills/better-auth-best-practices/SKILL.md +18 -8
  21. package/dist/global-skills/eas-app-stores/SKILL.md +31 -15
  22. package/dist/global-skills/eas-app-stores/agents/openai.yaml +2 -2
  23. package/dist/global-skills/eas-app-stores/references/ios-app-store.md +37 -32
  24. package/dist/global-skills/eas-app-stores/references/native-ios.md +167 -0
  25. package/dist/global-skills/eas-app-stores/references/play-store.md +3 -7
  26. package/dist/global-skills/eas-app-stores/references/testflight.md +39 -35
  27. package/dist/global-skills/eas-simulator/SKILL.md +48 -26
  28. package/dist/global-skills/eas-simulator/references/controllers.md +32 -3
  29. package/dist/global-skills/eas-simulator/references/run-your-app.md +34 -4
  30. package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -4
  31. package/dist/global-skills/eas-update/SKILL.md +146 -0
  32. package/dist/global-skills/eas-update/agents/openai.yaml +4 -0
  33. package/dist/global-skills/expo-animation/RECIPES.md +2 -2
  34. package/dist/global-skills/expo-animation/SKILL.md +9 -2
  35. package/dist/global-skills/expo-brownfield/SKILL.md +18 -11
  36. package/dist/global-skills/expo-brownfield/agents/openai.yaml +2 -2
  37. package/dist/global-skills/expo-brownfield/references/brownfield-integrated.md +94 -69
  38. package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +40 -42
  39. package/dist/global-skills/expo-brownfield/references/comparison.md +5 -5
  40. package/dist/global-skills/expo-brownfield/references/feature-integration.md +163 -0
  41. package/dist/global-skills/expo-brownfield/references/troubleshooting.md +17 -17
  42. package/dist/global-skills/expo-brownfield/references/version-compatibility.md +40 -0
  43. package/dist/global-skills/expo-data-fetching/SKILL.md +27 -6
  44. package/dist/global-skills/expo-design-system/SKILL.md +27 -7
  45. package/dist/global-skills/expo-design-system/references/audit.md +7 -2
  46. package/dist/global-skills/expo-design-system/references/native-slop.md +74 -0
  47. package/dist/global-skills/expo-examples/SKILL.md +0 -1
  48. package/dist/global-skills/expo-examples/references/catalog.md +1 -1
  49. package/dist/global-skills/expo-migrate-module/SKILL.md +21 -10
  50. package/dist/global-skills/expo-migrate-module/references/compatibility.md +80 -23
  51. package/dist/global-skills/expo-migrate-module/references/migration-map.md +162 -11
  52. package/dist/global-skills/expo-native-ui/SKILL.md +25 -16
  53. package/dist/global-skills/expo-native-ui/agents/openai.yaml +2 -2
  54. package/dist/global-skills/expo-native-ui/references/controls.md +5 -46
  55. package/dist/global-skills/expo-native-ui/references/icons.md +21 -2
  56. package/dist/global-skills/expo-native-ui/references/media.md +15 -20
  57. package/dist/global-skills/expo-native-ui/references/visual-effects.md +12 -11
  58. package/dist/global-skills/expo-overview/SKILL.md +17 -12
  59. package/dist/global-skills/expo-router/SKILL.md +5 -3
  60. package/dist/global-skills/expo-router/references/tabs.md +5 -5
  61. package/dist/global-skills/expo-skill-eval/scripts/check-static.sh +0 -0
  62. package/dist/global-skills/expo-skill-eval/scripts/clean-fixture.sh +0 -0
  63. package/dist/global-skills/expo-skill-eval/scripts/latest-sdk.sh +0 -0
  64. package/dist/global-skills/expo-skill-eval/scripts/make-fixture.sh +0 -0
  65. package/dist/global-skills/expo-skill-eval/scripts/make-workspace.sh +0 -0
  66. package/dist/global-skills/expo-skill-eval/scripts/snapshot-android.sh +0 -0
  67. package/dist/global-skills/expo-skill-eval/scripts/snapshot-ios.sh +0 -0
  68. package/dist/global-skills/expo-skill-eval/scripts/snapshot-web.sh +0 -0
  69. package/dist/global-skills/expo-upgrade/SKILL.md +3 -1
  70. package/dist/global-skills/expo-web-to-native/references/false-friends.md +2 -2
  71. package/dist/global-skills/expo-web-to-native/references/native-patterns.md +1 -1
  72. package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +13 -16
  73. package/dist/global-skills/firebase-ai-logic-basics/references/ios_setup.md +4 -5
  74. package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_android.md +4 -4
  75. package/dist/global-skills/firebase-ai-logic-basics/references/usage_patterns_web.md +3 -3
  76. package/dist/global-skills/firebase-auth-basics/SKILL.md +11 -6
  77. package/dist/global-skills/firebase-auth-basics/references/client_sdk_android.md +4 -5
  78. package/dist/global-skills/firebase-auth-basics/references/client_sdk_web.md +3 -3
  79. package/dist/global-skills/firebase-auth-basics/references/flutter_setup.md +24 -25
  80. package/dist/global-skills/firebase-auth-basics/references/security_rules.md +4 -2
  81. package/dist/global-skills/firebase-crashlytics/references/android_setup.md +7 -4
  82. package/dist/global-skills/firebase-crashlytics/references/ios_setup.md +2 -3
  83. package/dist/global-skills/firebase-data-connect/SKILL.md +2 -1
  84. package/dist/global-skills/firebase-data-connect/examples.md +4 -4
  85. package/dist/global-skills/firebase-data-connect/reference/config.md +5 -4
  86. package/dist/global-skills/firebase-data-connect/reference/realtime.md +1 -2
  87. package/dist/global-skills/firebase-data-connect/reference/sdk_flutter.md +2 -2
  88. package/dist/global-skills/firebase-data-connect/reference/sdk_ios.md +2 -2
  89. package/dist/global-skills/firebase-data-connect/reference/sdk_web.md +17 -6
  90. package/dist/global-skills/firebase-data-connect/reference/security.md +5 -5
  91. package/dist/global-skills/firebase-data-connect/templates.md +2 -1
  92. package/dist/global-skills/firebase-firestore/SKILL.md +20 -8
  93. package/dist/global-skills/firebase-firestore/references/enterprise/android_sdk_usage.md +5 -4
  94. package/dist/global-skills/firebase-firestore/references/enterprise/data_model.md +12 -3
  95. package/dist/global-skills/firebase-firestore/references/enterprise/indexes.md +16 -18
  96. package/dist/global-skills/firebase-firestore/references/enterprise/provisioning.md +1 -1
  97. package/dist/global-skills/firebase-firestore/references/enterprise/python_sdk_usage.md +5 -1
  98. package/dist/global-skills/firebase-firestore/references/enterprise/web_sdk_usage.md +7 -7
  99. package/dist/global-skills/firebase-firestore/references/standard/android_sdk_usage.md +5 -5
  100. package/dist/global-skills/firebase-firestore/references/standard/flutter_setup.md +4 -4
  101. package/dist/global-skills/firebase-firestore/references/standard/indexes.md +16 -18
  102. package/dist/global-skills/firebase-firestore/references/standard/provisioning.md +1 -1
  103. package/dist/global-skills/firebase-remote-config-basics/SKILL.md +0 -5
  104. package/dist/global-skills/firebase-remote-config-basics/references/android_setup.md +36 -8
  105. package/dist/global-skills/firebase-remote-config-basics/references/ios_setup.md +1 -7
  106. package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +17 -6
  107. package/dist/global-skills/{firebase-firestore/references/standard/security_rules.md → firestore-rules-creation/SKILL.md} +24 -13
  108. package/dist/global-skills/grow-my-customers/SKILL.md +23 -0
  109. package/dist/global-skills/instrument-feature-flags/SKILL.md +25 -25
  110. package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +141 -285
  111. package/dist/global-skills/instrument-feature-flags/references/android.md +6 -15
  112. package/dist/global-skills/instrument-feature-flags/references/api.md +4 -11
  113. package/dist/global-skills/instrument-feature-flags/references/best-practices.md +1 -13
  114. package/dist/global-skills/instrument-feature-flags/references/django.md +14 -27
  115. package/dist/global-skills/instrument-feature-flags/references/dotnet.md +20 -79
  116. package/dist/global-skills/instrument-feature-flags/references/elixir.md +1 -9
  117. package/dist/global-skills/instrument-feature-flags/references/flask.md +13 -13
  118. package/dist/global-skills/instrument-feature-flags/references/flutter.md +3 -24
  119. package/dist/global-skills/instrument-feature-flags/references/go.md +3 -15
  120. package/dist/global-skills/instrument-feature-flags/references/ios.md +4 -17
  121. package/dist/global-skills/instrument-feature-flags/references/java.md +5 -13
  122. package/dist/global-skills/instrument-feature-flags/references/laravel.md +13 -17
  123. package/dist/global-skills/instrument-feature-flags/references/next-js.md +25 -32
  124. package/dist/global-skills/instrument-feature-flags/references/nodejs.md +8 -15
  125. package/dist/global-skills/instrument-feature-flags/references/php.md +1 -15
  126. package/dist/global-skills/instrument-feature-flags/references/python.md +2 -15
  127. package/dist/global-skills/instrument-feature-flags/references/react-native.md +13 -15
  128. package/dist/global-skills/instrument-feature-flags/references/react.md +17 -21
  129. package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +37 -83
  130. package/dist/global-skills/instrument-feature-flags/references/ruby.md +2 -15
  131. package/dist/global-skills/instrument-feature-flags/references/rust.md +13 -25
  132. package/dist/global-skills/instrument-feature-flags/references/usage.md +14 -63
  133. package/dist/global-skills/instrument-feature-flags/references/web.md +9 -14
  134. package/dist/global-skills/instrument-product-analytics/SKILL.md +29 -29
  135. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +3 -1
  136. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +3 -1
  137. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-static.md +3 -1
  138. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-view-transitions.md +3 -1
  139. package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +3 -1
  140. package/dist/global-skills/instrument-product-analytics/references/android.md +72 -107
  141. package/dist/global-skills/instrument-product-analytics/references/angular.md +26 -28
  142. package/dist/global-skills/instrument-product-analytics/references/astro.md +13 -24
  143. package/dist/global-skills/instrument-product-analytics/references/configuration.md +45 -63
  144. package/dist/global-skills/instrument-product-analytics/references/django.md +14 -27
  145. package/dist/global-skills/instrument-product-analytics/references/dotnet.md +20 -79
  146. package/dist/global-skills/instrument-product-analytics/references/elixir.md +47 -49
  147. package/dist/global-skills/instrument-product-analytics/references/flask.md +13 -13
  148. package/dist/global-skills/instrument-product-analytics/references/flutter.md +60 -90
  149. package/dist/global-skills/instrument-product-analytics/references/go.md +17 -56
  150. package/dist/global-skills/instrument-product-analytics/references/identify-users.md +15 -15
  151. package/dist/global-skills/instrument-product-analytics/references/ios.md +11 -15
  152. package/dist/global-skills/instrument-product-analytics/references/laravel.md +13 -17
  153. package/dist/global-skills/instrument-product-analytics/references/next-js.md +25 -32
  154. package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +13 -27
  155. package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +14 -28
  156. package/dist/global-skills/instrument-product-analytics/references/php.md +33 -84
  157. package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +229 -9
  158. package/dist/global-skills/instrument-product-analytics/references/python.md +415 -106
  159. package/dist/global-skills/instrument-product-analytics/references/react-native.md +161 -155
  160. package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +12 -33
  161. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +15 -33
  162. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +12 -33
  163. package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +26 -41
  164. package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +37 -83
  165. package/dist/global-skills/instrument-product-analytics/references/ruby.md +48 -108
  166. package/dist/global-skills/instrument-product-analytics/references/svelte.md +18 -24
  167. package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +17 -19
  168. package/dist/global-skills/instrument-product-analytics/references/usage.md +14 -63
  169. package/dist/global-skills/instrument-product-analytics/references/vue-js.md +29 -28
  170. package/dist/global-skills/manifest.json +8 -2
  171. package/dist/global-skills/mongodb-search-and-ai/SKILL.md +28 -37
  172. package/dist/global-skills/mongodb-search-and-ai/references/automated-embedding.md +438 -0
  173. package/dist/global-skills/mongodb-search-and-ai/references/hybrid-search.md +60 -4
  174. package/dist/global-skills/mongodb-search-and-ai/references/vector-search.md +46 -108
  175. package/dist/global-skills/neon/SKILL.md +207 -213
  176. package/dist/global-skills/neon/references/auth.md +12 -0
  177. package/dist/global-skills/neon/references/claimable-neon.md +10 -14
  178. package/dist/global-skills/neon/references/function-triggers.md +53 -0
  179. package/dist/global-skills/neon/references/logs-loki.md +61 -0
  180. package/dist/global-skills/neon/references/parse-env.md +32 -0
  181. package/dist/global-skills/neon/references/sdk.md +7 -0
  182. package/dist/global-skills/neon-ai-gateway/SKILL.md +14 -16
  183. package/dist/global-skills/neon-auth/SKILL.md +155 -0
  184. package/dist/global-skills/neon-auth/references/managed-auth.md +173 -0
  185. package/dist/global-skills/neon-auth/references/self-managed.md +25 -0
  186. package/dist/global-skills/neon-functions/SKILL.md +159 -84
  187. package/dist/global-skills/neon-functions/references/ai-sdk.md +4 -6
  188. package/dist/global-skills/neon-functions/references/function-triggers.md +249 -0
  189. package/dist/global-skills/neon-functions/references/mastra-studio.md +3 -3
  190. package/dist/global-skills/neon-functions/references/mcp.md +1 -1
  191. package/dist/global-skills/neon-functions/references/production-hardening.md +340 -0
  192. package/dist/global-skills/neon-functions/references/sse.md +8 -5
  193. package/dist/global-skills/neon-object-storage/SKILL.md +10 -11
  194. package/dist/global-skills/neon-postgres/SKILL.md +120 -17
  195. package/dist/global-skills/neon-postgres/references/full-text-search.md +99 -0
  196. package/dist/global-skills/neon-postgres/references/hybrid-search.md +90 -0
  197. package/dist/global-skills/neon-postgres/references/lakebase-search-drizzle.md +172 -0
  198. package/dist/global-skills/neon-postgres/references/vector-search.md +137 -0
  199. package/dist/global-skills/neon-postgres-branches/SKILL.md +3 -3
  200. package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +1 -1
  201. package/dist/global-skills/onboarding/SKILL.md +8 -6
  202. package/dist/global-skills/resend/SKILL.md +4 -2
  203. package/dist/global-skills/resend/references/broadcasts.md +6 -1
  204. package/dist/global-skills/resend/references/receiving.md +29 -10
  205. package/dist/global-skills/resend/references/sending/email-management.md +14 -4
  206. package/dist/global-skills/resend/references/topics.md +9 -6
  207. package/dist/global-skills/resend/references/usage.md +117 -0
  208. package/dist/global-skills/resend/references/webhooks.md +59 -2
  209. package/dist/global-skills/stripe-best-practices/SKILL.md +35 -29
  210. package/dist/global-skills/stripe-best-practices/references/billing.md +9 -2
  211. package/dist/global-skills/stripe-best-practices/references/payments.md +4 -2
  212. package/dist/global-skills/stripe-best-practices/references/security.md +3 -1
  213. package/dist/global-skills/stripe-best-practices/references/tax.md +39 -20
  214. package/dist/global-skills/supabase/SKILL.md +6 -0
  215. package/dist/global-skills/use-railway/SKILL.md +42 -22
  216. package/dist/global-skills/use-railway/references/analyze-db.md +7 -6
  217. package/dist/global-skills/use-railway/references/cloud-agents.md +70 -0
  218. package/dist/global-skills/use-railway/references/configure.md +17 -2
  219. package/dist/global-skills/use-railway/references/databases.md +107 -0
  220. package/dist/global-skills/use-railway/references/deploy.md +5 -5
  221. package/dist/global-skills/use-railway/references/feature-flags.md +25 -13
  222. package/dist/global-skills/use-railway/references/iac.md +66 -77
  223. package/dist/global-skills/use-railway/references/operate.md +26 -3
  224. package/dist/global-skills/use-railway/references/request.md +31 -23
  225. package/dist/global-skills/use-railway/references/setup.md +16 -5
  226. package/dist/global-skills/use-railway/references/tracing.md +261 -0
  227. package/dist/global-skills/use-railway/references/usage.md +52 -0
  228. package/dist/global-skills/use-railway/scripts/analyze-mongo.py +0 -0
  229. package/dist/global-skills/use-railway/scripts/analyze-mysql.py +0 -0
  230. package/dist/global-skills/use-railway/scripts/analyze-postgres.py +0 -0
  231. package/dist/global-skills/use-railway/scripts/analyze-redis.py +0 -0
  232. package/dist/global-skills/use-railway/scripts/enable-pg-stats.py +0 -0
  233. package/dist/global-skills/use-railway/scripts/pg-extensions.py +0 -0
  234. package/dist/global-skills/use-railway/scripts/railway-api.sh +0 -0
  235. package/dist/global-skills/validate-my-idea/SKILL.md +54 -0
  236. package/dist/global-skills/{feedback → vybekiit-feedback}/SKILL.md +16 -12
  237. package/dist/global-skills/watch-my-app/SKILL.md +53 -0
  238. package/dist/global-skills/workers-best-practices/SKILL.md +36 -103
  239. package/dist/global-skills/workers-best-practices/references/configuration.md +139 -0
  240. package/dist/global-skills/workers-best-practices/references/platform-apis.md +51 -0
  241. package/dist/global-skills/workers-best-practices/references/{rules.md → runtime-patterns.md} +13 -137
  242. package/dist/global-skills/wrangler/SKILL.md +48 -901
  243. package/dist/global-skills/xcode-project-setup/scripts/xcode_spm_setup/Sources/main.swift +19 -15
  244. package/package.json +22 -22
  245. package/dist/global-skills/expo-native-ui/references/animations.md +0 -220
  246. package/dist/global-skills/firebase-firestore/references/enterprise/security_rules.md +0 -577
  247. package/dist/global-skills/workers-best-practices/references/review.md +0 -174
@@ -1,115 +1,55 @@
1
1
  ---
2
2
  name: workers-best-practices
3
- description: Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
3
+ description: Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.
4
4
  ---
5
5
 
6
- Your knowledge of Cloudflare Workers APIs, types, and configuration may be outdated. **Prefer retrieval over pre-training** for any Workers code task — writing or reviewing.
6
+ Your knowledge of Cloudflare Workers APIs, types, and configuration may be outdated. **Prefer retrieval over pre-training** when writing or reviewing Workers code.
7
7
 
8
- ## Retrieval Sources
8
+ Use the project's installed versions, generated types, and Wrangler compatibility settings as the baseline for existing code. Retrieve relevant Cloudflare documentation to verify API, configuration, runtime behavior, and limit claims.
9
9
 
10
- Fetch the **latest** versions before writing or reviewing Workers code. Do not rely on baked-in knowledge for API signatures, config fields, or binding shapes.
10
+ ## References
11
11
 
12
- | Source | How to retrieve | Use for |
13
- |--------|----------------|---------|
14
- | Workers best practices | Fetch `https://developers.cloudflare.com/workers/best-practices/workers-best-practices/` | Canonical rules, patterns, anti-patterns |
15
- | Workers types | See `references/review.md` for retrieval steps | API signatures, handler types, binding types |
16
- | Wrangler config schema | `node_modules/wrangler/config-schema.json` | Config fields, binding shapes, allowed values |
17
- | Cloudflare docs | Search tool or `https://developers.cloudflare.com/workers/` | API reference, compatibility dates/flags |
12
+ Read the sections relevant to the task:
18
13
 
19
- ## FIRST: Fetch Latest References
14
+ | Reference | When to use it |
15
+ |-----------|----------------|
16
+ | [Configuration and observability](references/configuration.md) | Compatibility dates, bindings, generated types, secrets, logs, and traces |
17
+ | [Runtime patterns](references/runtime-patterns.md) | Streaming, promise lifetime, request state, service calls, security, and runtime tests |
18
+ | [Platform API checks](references/platform-apis.md) | Handler signatures, platform classes, binding access, and serialization |
20
19
 
21
- Before reviewing or writing Workers code, retrieve the current best practices page and relevant type definitions. If the project's `node_modules` has an older version, **prefer the latest published version**.
20
+ For missing evidence, consult [Workers best practices](https://developers.cloudflare.com/workers/best-practices/workers-best-practices/) or find the affected product in the [Cloudflare docs directory](https://developers.cloudflare.com/directory/). Use the installed Wrangler schema for config fields. A newer type package does not supersede the project's configured target.
22
21
 
23
- ```bash
24
- # Fetch latest workers types
25
- mkdir -p /tmp/workers-types-latest && \
26
- npm pack @cloudflare/workers-types --pack-destination /tmp/workers-types-latest && \
27
- tar -xzf /tmp/workers-types-latest/cloudflare-workers-types-*.tgz -C /tmp/workers-types-latest
28
- # Types at /tmp/workers-types-latest/package/index.d.ts
29
- ```
22
+ ## Keep Compatibility Dates Current
30
23
 
31
- ## Reference Documentation
24
+ Use today's date for new Workers. Encourage periodic updates for existing Workers, reviewing compatibility changes and running relevant tests. Assess existing behavior against its configured date and flags; see [compatibility guidance](references/configuration.md#keep-compatibility_date-current).
32
25
 
33
- - `references/rules.md` — all best practice rules with code examples and anti-patterns
34
- - `references/review.md` — type validation, config validation, binding access patterns, review process
26
+ ## Enable Observability
35
27
 
36
- ## Rules Quick Reference
37
-
38
- ### Configuration
39
-
40
- | Rule | Summary |
41
- |------|---------|
42
- | Compatibility date | Set `compatibility_date` to today on new projects; update periodically on existing ones |
43
- | nodejs_compat | Enable the `nodejs_compat` flag — many libraries depend on Node.js built-ins |
44
- | wrangler types | Run `wrangler types` to generate `Env` — never hand-write binding interfaces |
45
- | Secrets | Use `wrangler secret put`, never hardcode secrets in config or source |
46
- | wrangler.jsonc | Use JSONC config for non-secret settings — newer features are JSON-only |
47
-
48
- ### Request & Response Handling
49
-
50
- | Rule | Summary |
51
- |------|---------|
52
- | Streaming | Stream large/unknown payloads — never `await response.text()` on unbounded data |
53
- | waitUntil | Use `ctx.waitUntil()` for post-response work; do not destructure `ctx` |
54
-
55
- ### Architecture
56
-
57
- | Rule | Summary |
58
- |------|---------|
59
- | Bindings over REST | Use in-process bindings (KV, R2, D1, Queues) — not the Cloudflare REST API |
60
- | Queues & Workflows | Move async/background work off the critical path |
61
- | Service bindings | Use service bindings for Worker-to-Worker calls — not public HTTP |
62
- | Hyperdrive | Always use Hyperdrive for external PostgreSQL/MySQL connections |
63
-
64
- ### Observability
65
-
66
- | Rule | Summary |
67
- |------|---------|
68
- | Logs & Traces | Enable `observability` in config with `head_sampling_rate`; use structured JSON logging |
69
-
70
- ### Code Patterns
71
-
72
- | Rule | Summary |
73
- |------|---------|
74
- | No global request state | Never store request-scoped data in module-level variables |
75
- | Floating promises | Every Promise must be `await`ed, `return`ed, `void`ed, or passed to `ctx.waitUntil()` |
76
-
77
- ### Security
78
-
79
- | Rule | Summary |
80
- |------|---------|
81
- | Web Crypto | Use `crypto.randomUUID()` / `crypto.getRandomValues()` — never `Math.random()` for security |
82
- | No passThroughOnException | Use explicit try/catch with structured error responses |
28
+ Enable [Workers Logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/) and [Traces](https://developers.cloudflare.com/workers/observability/traces/) when creating or preparing a Worker for production. Set `observability.enabled` and `observability.traces.enabled` to `true`; the top-level setting alone does not enable traces. Use structured JSON logging and configure sampling for the workload. During reviews, flag missing logs or traces. See the [configuration example](references/configuration.md#enable-workers-logs-and-traces).
83
29
 
84
30
  ## Anti-Patterns to Flag
85
31
 
86
- | Anti-pattern | Why it matters |
87
- |-------------|----------------|
88
- | `await response.text()` on unbounded data | Memory exhaustion — 128 MB limit |
89
- | Hardcoded secrets in source or config | Credential leak via version control |
90
- | `Math.random()` for tokens/IDs | Predictable, not cryptographically secure |
91
- | Bare `fetch()` without `await` or `waitUntil` | Floating promise — dropped result, swallowed error |
92
- | Module-level mutable variables for request state | Cross-request data leaks, stale state, I/O errors |
93
- | Cloudflare REST API from inside a Worker | Unnecessary network hop, auth overhead, added latency |
94
- | `ctx.passThroughOnException()` as error handling | Hides bugs, makes debugging impossible |
95
- | Hand-written `Env` interface | Drifts from actual wrangler config bindings |
96
- | Direct string comparison for secret values | Timing side-channel — use `crypto.subtle.timingSafeEqual` |
97
- | Destructuring `ctx` (`const { waitUntil } = ctx`) | Loses `this` binding — throws "Illegal invocation" at runtime |
98
- | `any` on `Env` or handler params | Defeats type safety for all binding access |
99
- | `as unknown as T` double-cast | Hides real type incompatibilities — fix the design |
100
- | `implements` on platform base classes (instead of `extends`) | Legacy — loses `this.ctx`, `this.env`. Applies to DurableObject, WorkerEntrypoint, Workflow |
101
- | `env.X` inside platform base class | Should be `this.env.X` in classes extending DurableObject, WorkerEntrypoint, etc. |
102
-
103
- ## Review Workflow
104
-
105
- 1. **Retrieve** — fetch latest best practices page, workers types, and wrangler schema
106
- 2. **Read full files** — not just diffs; context matters for binding access patterns
107
- 3. **Check types** — binding access, handler signatures, no `any`, no unsafe casts (see `references/review.md`)
108
- 4. **Check config** — compatibility_date, nodejs_compat, observability, secrets, binding-code consistency
109
- 5. **Check patterns** — streaming, floating promises, global state, serialization boundaries
110
- 6. **Check security** — crypto usage, secret handling, timing-safe comparisons, error handling
111
- 7. **Validate with tools** — `npx tsc --noEmit`, lint for `no-floating-promises`
112
- 8. **Reference rules** — see `references/rules.md` for each rule's correct pattern
32
+ | Anti-pattern | Consequence and preferred pattern |
33
+ |-------------|-----------------------------------|
34
+ | `await response.text()` or similar buffering on unbounded data | Can exhaust Worker memory; [stream large or unbounded bodies](references/runtime-patterns.md#stream-request-and-response-bodies). |
35
+ | Hardcoded secrets in source or config | Leaks credentials through version control; use Wrangler secrets. |
36
+ | `Math.random()` for security-sensitive tokens or IDs | Predictable values; use `crypto.randomUUID()` or `crypto.getRandomValues()`. |
37
+ | Async work started without awaiting, returning, or attaching it to `ctx.waitUntil()` | Work can be dropped and errors missed; tie it to the request or background-work lifetime. |
38
+ | Module-level mutable request state | Leaks data across requests and can cause I/O ownership errors; pass request state explicitly. |
39
+ | Cloudflare REST API calls for operations available through Worker bindings | Adds network and authentication overhead; use the available binding. |
40
+ | `ctx.passThroughOnException()` used as general error handling | Can conceal Worker failures by forwarding to the origin; use explicit error handling and structured error responses. |
41
+ | Hand-written `Env` that duplicates Wrangler bindings | Can drift from configuration; generate binding types with `wrangler types`. |
42
+ | Direct string comparison of secret values | Can expose timing differences; use the [Web Crypto comparison pattern](references/runtime-patterns.md#use-web-crypto-for-secure-token-generation). |
43
+ | Destructuring `ctx` methods, such as `const { waitUntil } = ctx` | Loses the receiver; call `ctx.waitUntil(...)`. |
44
+ | `any` on `Env` or handler parameters | Hides binding and handler contract errors; use the project's generated and platform types. |
45
+ | `as unknown as T` to force a platform type match | Hides incompatibilities; fix the underlying contract. |
46
+ | `implements` used in place of extending a platform base class | Does not inherit runtime behavior, `this.ctx`, or `this.env`; use the appropriate base class. |
47
+ | Unbound `env.X` in a platform class method | Bindings are available through `this.env.X`; see [binding access patterns](references/platform-apis.md#binding-access--the-most-common-error). |
48
+ | Applying one serialization rule across Queues, Workflow steps, storage, and WebSockets | Can reject valid payloads or accept unsupported ones; check the [specific API and encoding](references/platform-apis.md#serialization-boundaries). |
49
+
50
+ ## Validation
51
+
52
+ Use the project's existing checks for affected Workers behavior: type-check binding or handler contract changes, and run relevant runtime tests for behavior changes. Preserve required repository checks; a narrow edit does not require a full Workers audit.
113
53
 
114
54
  ## Scope
115
55
 
@@ -118,10 +58,3 @@ This skill covers Workers-specific best practices and code review. For related t
118
58
  - **Durable Objects**: load the `durable-objects` skill
119
59
  - **Workflows**: see [Rules of Workflows](https://developers.cloudflare.com/workflows/build/rules-of-workflows/)
120
60
  - **Wrangler CLI commands**: load the `wrangler` skill
121
-
122
- ## Principles
123
-
124
- - **Be certain.** Retrieve before flagging. If unsure about an API, config field, or pattern, fetch the docs first.
125
- - **Provide evidence.** Reference line numbers, tool output, or docs links.
126
- - **Focus on what developers will copy.** Workers code in examples and docs gets pasted into production.
127
- - **Correctness over completeness.** A concise example that works beats a comprehensive one with errors.
@@ -0,0 +1,139 @@
1
+ # Workers Configuration and Observability
2
+
3
+ Use the project's Wrangler configuration and installed `node_modules/wrangler/config-schema.json` to check fields and binding declarations. Consult current product docs when a field or compatibility requirement needs verification. Doc paths below are relative to `https://developers.cloudflare.com`.
4
+
5
+ - [Configuration](#configuration): compatibility dates, Node.js compatibility, generated types, secrets, and config format
6
+ - [Binding consistency](#binding-code-consistency): configuration and code agree
7
+ - [Observability](#observability): enable logs and traces, configure sampling, and emit structured logs
8
+
9
+ ## Configuration
10
+
11
+ ### Keep compatibility_date current
12
+
13
+ Set `compatibility_date` to today on new projects. Encourage periodic updates on existing projects to adopt new runtime behavior and fixes. Review the intervening compatibility changes and run relevant tests when advancing the date.
14
+
15
+ **Check**: `compatibility_date` exists and supports the affected feature with the configured flags. Recommend updates as maintenance; flag a compatibility defect when the configured date or flags do not support the required behavior.
16
+
17
+ ```jsonc
18
+ // wrangler.jsonc
19
+ {
20
+ "compatibility_date": "$today", // Replace with today's date (YYYY-MM-DD)
21
+ "compatibility_flags": ["nodejs_compat"]
22
+ }
23
+ ```
24
+
25
+ **Retrieve**: current compatibility dates at `/workers/configuration/compatibility-dates/`.
26
+
27
+ ### Enable nodejs_compat
28
+
29
+ The `nodejs_compat` flag enables Node.js built-in modules (`node:crypto`, `node:buffer`, `node:stream`). Many libraries require it. Missing this flag causes cryptic import errors at runtime.
30
+
31
+ **Check**: `compatibility_flags` includes `"nodejs_compat"`.
32
+
33
+ ```jsonc
34
+ {
35
+ "compatibility_flags": ["nodejs_compat"]
36
+ }
37
+ ```
38
+
39
+ ### Generate binding types with wrangler types
40
+
41
+ Never hand-write the `Env` interface. Run `wrangler types` to generate it from the wrangler config. Re-run after adding or renaming any binding.
42
+
43
+ **Check**: no manually defined `Env` or `interface Env` that duplicates wrangler config bindings. Look for `satisfies ExportedHandler<Env>` pattern on the default export.
44
+
45
+ ```ts
46
+ // Generated by wrangler types — always matches actual config
47
+ export default {
48
+ async fetch(request: Request, env: Env): Promise<Response> {
49
+ const value = await env.MY_KV.get("key");
50
+ return new Response(value);
51
+ },
52
+ } satisfies ExportedHandler<Env>;
53
+ ```
54
+
55
+ Anti-pattern:
56
+ ```ts
57
+ // Hand-written Env that drifts from actual bindings
58
+ interface Env {
59
+ MY_KV: KVNamespace; // What if the binding name changed?
60
+ }
61
+ ```
62
+
63
+ ### Store secrets with wrangler secret
64
+
65
+ Secrets must never appear in wrangler config or source code. Use `wrangler secret put` and access via `env` at runtime. Non-secret config goes in `vars`.
66
+
67
+ **Check**: no string literals that look like API keys, tokens, or credentials. Verify `.env` is in `.gitignore` for local dev.
68
+
69
+ ```jsonc
70
+ {
71
+ "vars": {
72
+ "API_BASE_URL": "https://api.example.com" // Non-secret: OK in config
73
+ }
74
+ // Secrets set via: wrangler secret put API_KEY
75
+ }
76
+ ```
77
+
78
+ Anti-pattern:
79
+ ```jsonc
80
+ {
81
+ "vars": {
82
+ "API_KEY": "sk-live-abc123..." // Secret in version control
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### Use wrangler.jsonc for config
88
+
89
+ Prefer `wrangler.jsonc` over `wrangler.toml`. Newer features are JSON-only. JSONC supports comments for documenting config decisions.
90
+
91
+ **Check**: project uses `wrangler.jsonc` (or `wrangler.json`). Flag `wrangler.toml` in new projects.
92
+
93
+ ---
94
+
95
+ ### Binding-code consistency
96
+
97
+ For executable Worker examples, verify `name`, `compatibility_date`, and `main` against the target Wrangler schema.
98
+
99
+ 1. Every `env.X` reference in code has a corresponding binding declaration in config
100
+ 2. Names match exactly (case-sensitive)
101
+ 3. For Durable Objects: `class_name` matches the exported class name
102
+
103
+ An unused binding alone is not a finding; establish a concrete configuration or runtime consequence before recommending a change.
104
+
105
+ For a new Durable Object class, verify its migration entry and exported class name against the target Wrangler schema.
106
+
107
+ ## Observability
108
+
109
+ ### Enable Workers Logs and Traces
110
+
111
+ Enable Workers Logs and Traces in Wrangler config before deploying to production. Set `observability.enabled` and `observability.traces.enabled` to `true`; the top-level setting alone does not enable traces. Use `head_sampling_rate` to control volume and cost. Use structured JSON logging — `console.log(JSON.stringify({...}))` — so logs are searchable. Use `console.error` for errors (appears at error severity in the dashboard).
112
+
113
+ **Check**: logs and traces are enabled in the target deployment environment, with neither disabled by an environment override. Check `observability.enabled`, `observability.logs.enabled`, and `observability.traces.enabled`, accounting for their defaults. Logging uses structured JSON, not string concatenation.
114
+
115
+ ```jsonc
116
+ {
117
+ "observability": {
118
+ "enabled": true,
119
+ "logs": { "enabled": true, "head_sampling_rate": 1 },
120
+ "traces": { "enabled": true, "head_sampling_rate": 0.01 }
121
+ }
122
+ }
123
+ ```
124
+
125
+ ```ts
126
+ // Structured JSON — searchable and filterable
127
+ console.log(JSON.stringify({ message: "incoming request", method: request.method, path: url.pathname }));
128
+
129
+ // Error severity
130
+ console.error(JSON.stringify({ message: "request failed", error: e instanceof Error ? e.message : String(e) }));
131
+ ```
132
+
133
+ Anti-pattern:
134
+ ```ts
135
+ // Unstructured string logs — hard to query
136
+ console.log("Got a request to " + url.pathname);
137
+ ```
138
+
139
+ **Retrieve**: [Workers Logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/) and [Traces](https://developers.cloudflare.com/workers/observability/traces/) for current config options.
@@ -0,0 +1,51 @@
1
+ # Workers Platform API Checks
2
+
3
+ Use the project's installed and generated types to check affected handlers and bindings. Consult current Cloudflare docs when API or runtime compatibility remains uncertain.
4
+
5
+ - [Type validation](#type-validation): binding types, handler signatures, and platform classes
6
+ - [Serialization boundaries](#serialization-boundaries): encoding and supported values for each API
7
+
8
+ ## Type Validation
9
+
10
+ ### Env interface
11
+
12
+ - Every binding must have a specific type. Flag `any`, `unknown`, `object`, or `Record<string, unknown>` on bindings.
13
+ - Binding types that accept generic parameters (Durable Object namespaces, Queues, Service bindings for RPC) must include them. Read the type definition to confirm which types are generic.
14
+ - Use the project's generated binding types; see [configuration guidance](configuration.md#generate-binding-types-with-wrangler-types).
15
+
16
+ ### Handler and class signatures
17
+
18
+ Verify affected signatures against the project's target type definitions; consult current docs if runtime support or compatibility remains uncertain.
19
+
20
+ - Correct import path (most Workers platform classes import from `"cloudflare:workers"`)
21
+ - Generic type parameter on base classes (e.g., `DurableObject<Env>`)
22
+ - `ExecutionContext` as the third param in module export handlers (needed for `ctx.waitUntil()`)
23
+ - `fetch()` handlers must return `Promise<Response>`
24
+
25
+ ### Binding access — the most common error
26
+
27
+ - **Module export handlers** (`fetch`, `scheduled`, `queue`, `email`): bindings via `env.X` parameter
28
+ - **Platform base classes** (`WorkerEntrypoint`, `DurableObject`, `Workflow`, `Agent`): bindings via `this.env.X`
29
+
30
+ Flag `env.X` inside a class extending a platform base class. Flag `this.env.X` inside a module export handler.
31
+
32
+ ### Stale class patterns
33
+
34
+ Old patterns survive in codebases long after APIs change.
35
+
36
+ - **`extends` vs `implements`**: platform classes use `extends`, not `implements`. The `implements` pattern is legacy and loses `this.ctx`, `this.env`.
37
+ - **Import paths**: verify module specifiers match what types actually export. Common mistake: wrong path for `"cloudflare:workers"` vs `"cloudflare:workflows"`.
38
+ - **Renamed properties**: e.g., `this.state` to `this.ctx` in Durable Objects. Search types to confirm.
39
+ - **Constructor signatures**: base class constructors change. Verify expected parameters.
40
+
41
+ ## Serialization Boundaries
42
+
43
+ Check the API and encoding at each boundary. Structured clone support does not imply JSON compatibility or SQL parameter support.
44
+
45
+ | Boundary | What to check |
46
+ |----------|---------------|
47
+ | [Queue messages](https://developers.cloudflare.com/queues/configuration/javascript-apis/#queuescontenttype) | Match the body to `contentType`: `json` requires JSON-compatible data, `text` a string, `bytes` an `ArrayBuffer`, and `v8` supports structured-clone values such as `Map` and `Date`. Check the configured compatibility date when relying on the default encoding. |
48
+ | [Workflow step results](https://developers.cloudflare.com/workflows/build/workers-api/) | Verify the step result against the documented serialization contract and the project's Workflow types before flagging a value. |
49
+ | [Durable Object KV storage](https://developers.cloudflare.com/durable-objects/api/sqlite-storage-api/#put-1) | `storage.put()` supports structured-clone values; do not apply a blanket ban on `Map` or `Set`. |
50
+ | [Durable Object SQL](https://developers.cloudflare.com/durable-objects/api/sqlite-storage-api/#exec) | Check bound parameters against the SQL API's supported types. Encode objects explicitly for the intended column representation. |
51
+ | [WebSocket messages](https://developers.cloudflare.com/workers/runtime-apis/websockets/#send) | Use `send()` with a string, `ArrayBuffer`, or `ArrayBufferView`; encode objects, for example with `JSON.stringify()`. |
@@ -1,96 +1,12 @@
1
- # Workers Best Practices — Rules
1
+ # Workers Runtime Patterns
2
2
 
3
- Each rule has an imperative summary, what to check, the correct pattern, and an anti-pattern where applicable. Code examples are plain TypeScript — no MDX components.
3
+ Consult the sections relevant to the affected behavior. Examples show preferred patterns and common mistakes; **Retrieve** links identify documentation to check when an API, behavior, or limit is uncertain. Doc paths are relative to `https://developers.cloudflare.com`.
4
4
 
5
- When a rule involves config fields or API signatures that may evolve, a **Retrieve** callout reminds you to check the latest docs or types before flagging. All doc paths are relative to `https://developers.cloudflare.com`.
6
-
7
- ---
8
-
9
- ## Configuration
10
-
11
- ### Keep compatibility_date current
12
-
13
- Set `compatibility_date` to today on new projects. Update periodically on existing ones to access new APIs and fixes.
14
-
15
- **Check**: `compatibility_date` exists. Flag if older than 6 months.
16
-
17
- ```jsonc
18
- // wrangler.jsonc
19
- {
20
- "compatibility_date": "$today", // Replace with today's date (YYYY-MM-DD)
21
- "compatibility_flags": ["nodejs_compat"]
22
- }
23
- ```
24
-
25
- **Retrieve**: current compatibility dates at `/workers/configuration/compatibility-dates/`.
26
-
27
- ### Enable nodejs_compat
28
-
29
- The `nodejs_compat` flag enables Node.js built-in modules (`node:crypto`, `node:buffer`, `node:stream`). Many libraries require it. Missing this flag causes cryptic import errors at runtime.
30
-
31
- **Check**: `compatibility_flags` includes `"nodejs_compat"`.
32
-
33
- ```jsonc
34
- {
35
- "compatibility_flags": ["nodejs_compat"]
36
- }
37
- ```
38
-
39
- ### Generate binding types with wrangler types
40
-
41
- Never hand-write the `Env` interface. Run `wrangler types` to generate it from the wrangler config. Re-run after adding or renaming any binding.
42
-
43
- **Check**: no manually defined `Env` or `interface Env` that duplicates wrangler config bindings. Look for `satisfies ExportedHandler<Env>` pattern on the default export.
44
-
45
- ```ts
46
- // Generated by wrangler types — always matches actual config
47
- export default {
48
- async fetch(request: Request, env: Env): Promise<Response> {
49
- const value = await env.MY_KV.get("key");
50
- return new Response(value);
51
- },
52
- } satisfies ExportedHandler<Env>;
53
- ```
54
-
55
- Anti-pattern:
56
- ```ts
57
- // Hand-written Env that drifts from actual bindings
58
- interface Env {
59
- MY_KV: KVNamespace; // What if the binding name changed?
60
- }
61
- ```
62
-
63
- ### Store secrets with wrangler secret
64
-
65
- Secrets must never appear in wrangler config or source code. Use `wrangler secret put` and access via `env` at runtime. Non-secret config goes in `vars`.
66
-
67
- **Check**: no string literals that look like API keys, tokens, or credentials. Verify `.env` is in `.gitignore` for local dev.
68
-
69
- ```jsonc
70
- {
71
- "vars": {
72
- "API_BASE_URL": "https://api.example.com" // Non-secret: OK in config
73
- }
74
- // Secrets set via: wrangler secret put API_KEY
75
- }
76
- ```
77
-
78
- Anti-pattern:
79
- ```jsonc
80
- {
81
- "vars": {
82
- "API_KEY": "sk-live-abc123..." // Secret in version control
83
- }
84
- }
85
- ```
86
-
87
- ### Use wrangler.jsonc for config
88
-
89
- Prefer `wrangler.jsonc` over `wrangler.toml`. Newer features are JSON-only. JSONC supports comments for documenting config decisions.
90
-
91
- **Check**: project uses `wrangler.jsonc` (or `wrangler.json`). Flag `wrangler.toml` in new projects.
92
-
93
- ---
5
+ - [Request and response handling](#request--response-handling): streaming, memory use, and post-response work
6
+ - [Architecture](#architecture): bindings, Queues, Workflows, and database connections
7
+ - [Code patterns](#code-patterns): request state, promise lifetime, and platform limits
8
+ - [Security](#security): Web Crypto and error handling
9
+ - [Development and testing](#development--testing): tests in the Workers runtime
94
10
 
95
11
  ## Request & Response Handling
96
12
 
@@ -141,6 +57,10 @@ return new Response(text);
141
57
 
142
58
  **Retrieve**: streaming APIs at `/workers/runtime-apis/streams/`.
143
59
 
60
+ ### Use Zod 4.5.0 or later
61
+
62
+ **Check**: Workers using Zod for runtime validation depend on [Zod 4.5.0 or later](https://github.com/colinhacks/zod/releases/tag/v4.5.0); older versions retain substantially more heap per schema, so check the installed version when investigating high memory usage or OOMs.
63
+
144
64
  ### Use waitUntil for work after the response
145
65
 
146
66
  `ctx.waitUntil()` performs background work (analytics, cache writes, webhooks) after the response is sent. Keeps response fast. 30-second time limit after response.
@@ -234,7 +154,7 @@ export class AuthService extends WorkerEntrypoint {
234
154
  const auth = await env.AUTH_SERVICE.verifyToken(token);
235
155
  ```
236
156
 
237
- **Retrieve**: verify `WorkerEntrypoint` import path and signature against latest `@cloudflare/workers-types`.
157
+ **Retrieve**: verify uncertain `WorkerEntrypoint` import paths or signatures against the project's target types, consulting current docs when runtime compatibility needs clarification.
238
158
 
239
159
  ### Use Hyperdrive for external database connections
240
160
 
@@ -263,42 +183,6 @@ async fetch(request: Request, env: Env): Promise<Response> {
263
183
 
264
184
  ---
265
185
 
266
- ## Observability
267
-
268
- ### Enable Workers Logs and Traces
269
-
270
- Enable `observability` in wrangler config before deploying to production. Use `head_sampling_rate` to control volume and cost. Use structured JSON logging — `console.log(JSON.stringify({...}))` — so logs are searchable. Use `console.error` for errors (appears at error severity in the dashboard).
271
-
272
- **Check**: `observability.enabled` is `true` in config. Logging uses structured JSON, not string concatenation.
273
-
274
- ```jsonc
275
- {
276
- "observability": {
277
- "enabled": true,
278
- "logs": { "head_sampling_rate": 1 },
279
- "traces": { "enabled": true, "head_sampling_rate": 0.01 }
280
- }
281
- }
282
- ```
283
-
284
- ```ts
285
- // Structured JSON — searchable and filterable
286
- console.log(JSON.stringify({ message: "incoming request", method: request.method, path: url.pathname }));
287
-
288
- // Error severity
289
- console.error(JSON.stringify({ message: "request failed", error: e instanceof Error ? e.message : String(e) }));
290
- ```
291
-
292
- Anti-pattern:
293
- ```ts
294
- // Unstructured string logs — hard to query
295
- console.log("Got a request to " + url.pathname);
296
- ```
297
-
298
- **Retrieve**: `/workers/observability/logs/workers-logs/` and `/workers/observability/traces/` for current config options.
299
-
300
- ---
301
-
302
186
  ## Code Patterns
303
187
 
304
188
  ### Do not store request-scoped state in global scope
@@ -334,15 +218,7 @@ export default {
334
218
 
335
219
  A Promise that is not `await`ed, `return`ed, or passed to `ctx.waitUntil()` is a floating promise. Causes: dropped results, swallowed errors, unfinished work. The runtime may terminate the isolate before it completes.
336
220
 
337
- **Check**: every `fetch()`, `env.*.put()`, `env.*.send()`, and any other async call is handled. Enable `no-floating-promises` lint rule.
338
-
339
- ```bash
340
- # ESLint
341
- npx eslint --rule '{"@typescript-eslint/no-floating-promises": "error"}' src/
342
-
343
- # oxlint
344
- npx oxlint --deny typescript/no-floating-promises src/
345
- ```
221
+ **Check**: async calls in the affected execution path are awaited, returned, or attached to the appropriate lifetime. Use the project's existing floating-promise lint check, such as Oxlint's [typescript/no-floating-promises](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-floating-promises.html), when available and relevant; otherwise inspect the promise paths directly. Adding lint tooling is a separate change, not a prerequisite for reviewing this behavior.
346
222
 
347
223
  ```ts
348
224
  // Correct: await when you need the result