[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AA8K7XAT2WBH79WAV69NC2":3,"skill-same:01M7AA8K7XAT2WBH79WAV69NC2":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":29,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7AA8K7XAT2WBH79WAV69NC2","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.","777genius\u002Funiversal-agent-plugins-registry","777genius","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F13103045?v=4","01M6JAKPGY3TJJPNABSAZRX0NT","Илия","01M7A9W3CS3WAMM4TSHFH14Y3B",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fworkers-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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","ea0e3704364be66e253fd71f7b5981b395a88bfe","compat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fworkers-best-practices",0,"https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry","https:\u002F\u002Funiversal-agent-plugins.com","https:\u002F\u002Fgithub.com\u002F777genius","Get a lot done by doing very little 🚀\r\nBuilding the future! ✨","2026-11-15 05:35:39",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add 777genius\u002Funiversal-agent-plugins-registry --skill workers-best-practices",{"tool":39,"command":40},"bunx","bunx skills add 777genius\u002Funiversal-agent-plugins-registry --skill workers-best-practices",{"tool":42,"command":43},"pnpm","pnpm dlx skills add 777genius\u002Funiversal-agent-plugins-registry --skill workers-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fworkers-best-practices\u002FSKILL.md",true,[47,53],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Freview.md","REFERENCE","参考文档",8145,"https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fworkers-best-practices\u002Freferences\u002Freview.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Frules.md",16483,"https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fworkers-best-practices\u002Freferences\u002Frules.md",[58,65,72,80,85,92],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7BF619NPKWWJNGGDA4WVBRB","cloudflare-one-migrations","Plans migrations from Zscaler ZIA\u002FZPA, Palo Alto, legacy VPN, SWG, or SASE stacks to Cloudflare One. Use for migration assessments, policy mapping, rollout plans, and parity\u002Fgap analysis.","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fcloudflare-one-migrations\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7BF5V7QKF56G1DSZTMHRJQS","cloudflare-email-service","Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing). Use when building email sending (Workers binding or REST API), email routing, Agents SDK email handling, or integrating email into any app — Workers, Node.js, Python, Go, etc. Also use for email deliverability, SPF\u002FDKIM\u002FDMARC, wrangler email setup, MCP email tools, or when a coding agent needs to send emails. Even for simple requests like \"add email to my Worker\" — this skill has critical config details.","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fcompat\u002Fopenai\u002Fplugins\u002Fcloudflare\u002Fskills\u002Fcloudflare-email-service\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AABQRKV9VF3EXW0MHR4Z7C","fixture-skill","Exercises the deterministic pinned-copy bridge fixture.","MIT","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fplugins\u002Ffixture-bridge\u002Fskills\u002Ffixture-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7AABPA129B49X6N1D8NQG74","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fbridge_upstream\u002Fskills\u002Ffixture-skill\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7AABKAWJPRBKEXP2HQH81EC","fixture","Exercise a valid direct-source Agent Plugins package without Directory submission.","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Ftests\u002Fe2e\u002Ffixtures\u002Fexternal-package\u002Fskills\u002Ffixture\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7AABH0JDVSSPF95TQM6HD7A","campaign-planning","Plan a marketing campaign, content calendar or landing-page launch using an audience brief, existing Notion content, HubSpot CRM insights and Playwright checks.","https:\u002F\u002Fgithub.com\u002F777genius\u002Funiversal-agent-plugins-registry\u002Fblob\u002Fmain\u002Fplugins\u002Fmarketing-kit\u002Fskills\u002Fcampaign-planning\u002FSKILL.md",[],[]]