[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7349V3WCBF835QP74SA9Q8C":3,"skill-same:01M7349V3WCBF835QP74SA9Q8C":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7349V3WCBF835QP74SA9Q8C","workers-best-practices",null,"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.","LiamVisionary\u002Fhivemindos","LiamVisionary","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F102138294?v=4","01M73379NZZ99TT4ZS17XR3Q9D","01M73379PX6AKQNWN05VNSYRXW",13,"MIT","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fworkers-best-practices\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: workers-best-practices\ndescription: 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.\n---\n\nYour knowledge of Cloudflare Workers APIs, types, and configuration may be outdated. **Prefer retrieval over pre-training** for any Workers code task — writing or reviewing.\n\n## Retrieval Sources\n\nFetch the **latest** versions before writing or reviewing Workers code. Do not rely on baked-in knowledge for API signatures, config fields, or binding shapes.\n\n| Source | How to retrieve | Use for |\n|--------|----------------|---------|\n| Workers best practices | Fetch `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fbest-practices\u002Fworkers-best-practices\u002F` | Canonical rules, patterns, anti-patterns |\n| Workers types | See `references\u002Freview.md` for retrieval steps | API signatures, handler types, binding types |\n| Wrangler config schema | `node_modules\u002Fwrangler\u002Fconfig-schema.json` | Config fields, binding shapes, allowed values |\n| Cloudflare docs | Search tool or `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F` | API reference, compatibility dates\u002Fflags |\n\n## FIRST: Fetch Latest References\n\nBefore 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**.\n\n```bash\n# Fetch latest workers types\nmkdir -p \u002Ftmp\u002Fworkers-types-latest && \\\n  npm pack @cloudflare\u002Fworkers-types --pack-destination \u002Ftmp\u002Fworkers-types-latest && \\\n  tar -xzf \u002Ftmp\u002Fworkers-types-latest\u002Fcloudflare-workers-types-*.tgz -C \u002Ftmp\u002Fworkers-types-latest\n# Types at \u002Ftmp\u002Fworkers-types-latest\u002Fpackage\u002Findex.d.ts\n```\n\n## Reference Documentation\n\n- `references\u002Frules.md` — all best practice rules with code examples and anti-patterns\n- `references\u002Freview.md` — type validation, config validation, binding access patterns, review process\n\n## Rules Quick Reference\n\n### Configuration\n\n| Rule | Summary |\n|------|---------|\n| Compatibility date | Set `compatibility_date` to today on new projects; update periodically on existing ones |\n| nodejs_compat | Enable the `nodejs_compat` flag — many libraries depend on Node.js built-ins |\n| wrangler types | Run `wrangler types` to generate `Env` — never hand-write binding interfaces |\n| Secrets | Use `wrangler secret put`, never hardcode secrets in config or source |\n| wrangler.jsonc | Use JSONC config for non-secret settings — newer features are JSON-only |\n\n### Request & Response Handling\n\n| Rule | Summary |\n|------|---------|\n| Streaming | Stream large\u002Funknown payloads — never `await response.text()` on unbounded data |\n| waitUntil | Use `ctx.waitUntil()` for post-response work; do not destructure `ctx` |\n\n### Architecture\n\n| Rule | Summary |\n|------|---------|\n| Bindings over REST | Use in-process bindings (KV, R2, D1, Queues) — not the Cloudflare REST API |\n| Queues & Workflows | Move async\u002Fbackground work off the critical path |\n| Service bindings | Use service bindings for Worker-to-Worker calls — not public HTTP |\n| Hyperdrive | Always use Hyperdrive for external PostgreSQL\u002FMySQL connections |\n\n### Observability\n\n| Rule | Summary |\n|------|---------|\n| Logs & Traces | Enable `observability` in config with `head_sampling_rate`; use structured JSON logging |\n\n### Code Patterns\n\n| Rule | Summary |\n|------|---------|\n| No global request state | Never store request-scoped data in module-level variables |\n| Floating promises | Every Promise must be `await`ed, `return`ed, `void`ed, or passed to `ctx.waitUntil()` |\n\n### Security\n\n| Rule | Summary |\n|------|---------|\n| Web Crypto | Use `crypto.randomUUID()` \u002F `crypto.getRandomValues()` — never `Math.random()` for security |\n| No passThroughOnException | Use explicit try\u002Fcatch with structured error responses |\n\n## Anti-Patterns to Flag\n\n| Anti-pattern | Why it matters |\n|-------------|----------------|\n| `await response.text()` on unbounded data | Memory exhaustion — 128 MB limit |\n| Hardcoded secrets in source or config | Credential leak via version control |\n| `Math.random()` for tokens\u002FIDs | Predictable, not cryptographically secure |\n| Bare `fetch()` without `await` or `waitUntil` | Floating promise — dropped result, swallowed error |\n| Module-level mutable variables for request state | Cross-request data leaks, stale state, I\u002FO errors |\n| Cloudflare REST API from inside a Worker | Unnecessary network hop, auth overhead, added latency |\n| `ctx.passThroughOnException()` as error handling | Hides bugs, makes debugging impossible |\n| Hand-written `Env` interface | Drifts from actual wrangler config bindings |\n| Direct string comparison for secret values | Timing side-channel — use `crypto.subtle.timingSafeEqual` |\n| Destructuring `ctx` (`const { waitUntil } = ctx`) | Loses `this` binding — throws \"Illegal invocation\" at runtime |\n| `any` on `Env` or handler params | Defeats type safety for all binding access |\n| `as unknown as T` double-cast | Hides real type incompatibilities — fix the design |\n| `implements` on platform base classes (instead of `extends`) | Legacy — loses `this.ctx`, `this.env`. Applies to DurableObject, WorkerEntrypoint, Workflow |\n| `env.X` inside platform base class | Should be `this.env.X` in classes extending DurableObject, WorkerEntrypoint, etc. |\n\n## Review Workflow\n\n1. **Retrieve** — fetch latest best practices page, workers types, and wrangler schema\n2. **Read full files** — not just diffs; context matters for binding access patterns\n3. **Check types** — binding access, handler signatures, no `any`, no unsafe casts (see `references\u002Freview.md`)\n4. **Check config** — compatibility_date, nodejs_compat, observability, secrets, binding-code consistency\n5. **Check patterns** — streaming, floating promises, global state, serialization boundaries\n6. **Check security** — crypto usage, secret handling, timing-safe comparisons, error handling\n7. **Validate with tools** — `npx tsc --noEmit`, lint for `no-floating-promises`\n8. **Reference rules** — see `references\u002Frules.md` for each rule's correct pattern\n\n## Scope\n\nThis skill covers Workers-specific best practices and code review. For related topics:\n\n- **Durable Objects**: load the `durable-objects` skill\n- **Workflows**: see [Rules of Workflows](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkflows\u002Fbuild\u002Frules-of-workflows\u002F)\n- **Wrangler CLI commands**: load the `wrangler` skill\n\n## Principles\n\n- **Be certain.** Retrieve before flagging. If unsure about an API, config field, or pattern, fetch the docs first.\n- **Provide evidence.** Reference line numbers, tool output, or docs links.\n- **Focus on what developers will copy.** Workers code in examples and docs gets pasted into production.\n- **Correctness over completeness.** A concise example that works beats a comprehensive one with errors.\n","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.\n\n## Retrieval Sources\n\nFetch the **latest** versions before writing or reviewing Workers code. Do not rely on baked-in knowledge for API signatures, config fields, or binding shapes.\n\n| Source | How to retrieve | Use for |\n|--------|----------------|---------|\n| Workers best practices | Fetch `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fbest-practices\u002Fworkers-best-practices\u002F` | Canonical rules, patterns, anti-patterns |\n| Workers types | See `references\u002Freview.md` for retrieval steps | API signatures, handler types, binding types |\n| Wrangler config schema | `node_modules\u002Fwrangler\u002Fconfig-schema.json` | Config fields, binding shapes, allowed values |\n| Cloudflare docs | Search tool or `https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F` | API reference, compatibility dates\u002Fflags |\n\n## FIRST: Fetch Latest References\n\nBefore 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**.\n\n```bash\n# Fetch latest workers types\nmkdir -p \u002Ftmp\u002Fworkers-types-latest && \\\n  npm pack @cloudflare\u002Fworkers-types --pack-destination \u002Ftmp\u002Fworkers-types-latest && \\\n  tar -xzf \u002Ftmp\u002Fworkers-types-latest\u002Fcloudflare-workers-types-*.tgz -C \u002Ftmp\u002Fworkers-types-latest\n# Types at \u002Ftmp\u002Fworkers-types-latest\u002Fpackage\u002Findex.d.ts\n```\n\n## Reference Documentation\n\n- `references\u002Frules.md` — all best practice rules with code examples and anti-patterns\n- `references\u002Freview.md` — type validation, config validation, binding access patterns, review process\n\n## Rules Quick Reference\n\n### Configuration\n\n| Rule | Summary |\n|------|---------|\n| Compatibility date | Set `compatibility_date` to today on new projects; update periodically on existing ones |\n| nodejs_compat | Enable the `nodejs_compat` flag — many libraries depend on Node.js built-ins |\n| wrangler types | Run `wrangler types` to generate `Env` — never hand-write binding interfaces |\n| Secrets | Use `wrangler secret put`, never hardcode secrets in config or source |\n| wrangler.jsonc | Use JSONC config for non-secret settings — newer features are JSON-only |\n\n### Request & Response Handling\n\n| Rule | Summary |\n|------|---------|\n| Streaming | Stream large\u002Funknown payloads — never `await response.text()` on unbounded data |\n| waitUntil | Use `ctx.waitUntil()` for post-response work; do not destructure `ctx` |\n\n### Architecture\n\n| Rule | Summary |\n|------|---------|\n| Bindings over REST | Use in-process bindings (KV, R2, D1, Queues) — not the Cloudflare REST API |\n| Queues & Workflows | Move async\u002Fbackground work off the critical path |\n| Service bindings | Use service bindings for Worker-to-Worker calls — not public HTTP |\n| Hyperdrive | Always use Hyperdrive for external PostgreSQL\u002FMySQL connections |\n\n### Observability\n\n| Rule | Summary |\n|------|---------|\n| Logs & Traces | Enable `observability` in config with `head_sampling_rate`; use structured JSON logging |\n\n### Code Patterns\n\n| Rule | Summary |\n|------|---------|\n| No global request state | Never store request-scoped data in module-level variables |\n| Floating promises | Every Promise must be `await`ed, `return`ed, `void`ed, or passed to `ctx.waitUntil()` |\n\n### Security\n\n| Rule | Summary |\n|------|---------|\n| Web Crypto | Use `crypto.randomUUID()` \u002F `crypto.getRandomValues()` — never `Math.random()` for security |\n| No passThroughOnException | Use explicit try\u002Fcatch with structured error responses |\n\n## Anti-Patterns to Flag\n\n| Anti-pattern | Why it matters |\n|-------------|----------------|\n| `await response.text()` on unbounded data | Memory exhaustion — 128 MB limit |\n| Hardcoded secrets in source or config | Credential leak via version control |\n| `Math.random()` for tokens\u002FIDs | Predictable, not cryptographically secure |\n| Bare `fetch()` without `await` or `waitUntil` | Floating promise — dropped result, swallowed error |\n| Module-level mutable variables for request state | Cross-request data leaks, stale state, I\u002FO errors |\n| Cloudflare REST API from inside a Worker | Unnecessary network hop, auth overhead, added latency |\n| `ctx.passThroughOnException()` as error handling | Hides bugs, makes debugging impossible |\n| Hand-written `Env` interface | Drifts from actual wrangler config bindings |\n| Direct string comparison for secret values | Timing side-channel — use `crypto.subtle.timingSafeEqual` |\n| Destructuring `ctx` (`const { waitUntil } = ctx`) | Loses `this` binding — throws \"Illegal invocation\" at runtime |\n| `any` on `Env` or handler params | Defeats type safety for all binding access |\n| `as unknown as T` double-cast | Hides real type incompatibilities — fix the design |\n| `implements` on platform base classes (instead of `extends`) | Legacy — loses `this.ctx`, `this.env`. Applies to DurableObject, WorkerEntrypoint, Workflow |\n| `env.X` inside platform base class | Should be `this.env.X` in classes extending DurableObject, WorkerEntrypoint, etc. |\n\n## Review Workflow\n\n1. **Retrieve** — fetch latest best practices page, workers types, and wrangler schema\n2. **Read full files** — not just diffs; context matters for binding access patterns\n3. **Check types** — binding access, handler signatures, no `any`, no unsafe casts (see `references\u002Freview.md`)\n4. **Check config** — compatibility_date, nodejs_compat, observability, secrets, binding-code consistency\n5. **Check patterns** — streaming, floating promises, global state, serialization boundaries\n6. **Check security** — crypto usage, secret handling, timing-safe comparisons, error handling\n7. **Validate with tools** — `npx tsc --noEmit`, lint for `no-floating-promises`\n8. **Reference rules** — see `references\u002Frules.md` for each rule's correct pattern\n\n## Scope\n\nThis skill covers Workers-specific best practices and code review. For related topics:\n\n- **Durable Objects**: load the `durable-objects` skill\n- **Workflows**: see [Rules of Workflows](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkflows\u002Fbuild\u002Frules-of-workflows\u002F)\n- **Wrangler CLI commands**: load the `wrangler` skill\n\n## Principles\n\n- **Be certain.** Retrieve before flagging. If unsure about an API, config field, or pattern, fetch the docs first.\n- **Provide evidence.** Reference line numbers, tool output, or docs links.\n- **Focus on what developers will copy.** Workers code in examples and docs gets pasted into production.\n- **Correctness over completeness.** A concise example that works beats a comprehensive one with errors.\n",{"name":5,"description":7},"main","f270c4ae4f9d09c4e5da9cfa8adab7e89ae1f53e","skills\u002Fcloudflare\u002Fworkers-best-practices",4,"https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos","https:\u002F\u002Fgithub.com\u002FLiamVisionary","2026-11-10 21:48:41",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add LiamVisionary\u002Fhivemindos --skill workers-best-practices",{"tool":36,"command":37},"bunx","bunx skills add LiamVisionary\u002Fhivemindos --skill workers-best-practices",{"tool":39,"command":40},"pnpm","pnpm dlx skills add LiamVisionary\u002Fhivemindos --skill workers-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fworkers-best-practices\u002FSKILL.md",true,[44,50],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Freview.md","REFERENCE","参考文档",8145,"https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fworkers-best-practices\u002Freferences\u002Freview.md",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Frules.md",16483,"https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fworkers-best-practices\u002Freferences\u002Frules.md",[55,62,69,76,83,90],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M734AA85KQEXDQXQJ3T7769M","tailscale-generation-skill-authoring","This skill should be used when the user asks to \"create a Tailscale generation skill\", \"add a local generation skill\", \"document a generation endpoint\", \"add an image generation provider\", \"add a TTS provider\", \"add video generation\", \"add 3D generation\", or needs guidance on where HivemindOS Tailscale or local generation providers belong in the shared skills shelf.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Ftailscale-generation-skill-authoring\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":18},"01M734A7VD69PRA0C0EV5EFY9T","localtts","This skill should be used when the user asks to \"generate local TTS\", \"use local text to speech\", \"use remote TTS over Tailscale\", \"make speech audio\", \"add a TTS provider\", \"use Qwen3-TTS\", or needs TTS endpoint setup through local or HivemindOS Tailscale routes.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Flocaltts\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":18},"01M734A4K2Z0F74QZP7V7WBFRY","karpathy-guidelines","Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fkarpathy-guidelines\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M734A1HMVYVJX3YJGNQ6KF6C","comfyui-image-generation","This skill should be used when the user asks to \"generate images\", \"generate images with ComfyUI\", \"use local ComfyUI\", \"use remote ComfyUI\", \"use Z-Image\", \"add an image generation provider\", or needs image-generation endpoint setup through local or HivemindOS Tailscale routes.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcomfyui-image-generation\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":18},"01M7349Y684Q676DNNHZPSC8W1","wrangler","Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fwrangler\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M7349RCCDA76C9956PW99XBS","sandbox-sdk","Build sandboxed applications for secure code execution. Load when building AI code execution, code interpreters, CI\u002FCD systems, interactive dev environments, or executing untrusted code. Covers Sandbox SDK lifecycle, commands, files, code interpreter, and preview URLs. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002FLiamVisionary\u002Fhivemindos\u002Fblob\u002Fmain\u002Fskills\u002Fcloudflare\u002Fsandbox-sdk\u002FSKILL.md",[],[]]