Skip to content

secondsky/claude-skills / plugins/cloudflare-nextjs/skills/cloudflare-nextjs

cloudflare-nextjs

Verified

Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare). Use for SSR/ISR/SSG/App or Pages Router, getCloudflareContext, bindings (D1/R2/KV/AI/Hyperdrive), caching tiers, skew protection, multi-worker, custom worker, env vars, or worker size/runtime/keep_names/FinalizationRegistry/connection-scoping errors.

references/wrangler.jsonc

View on GitHub
// wrangler.jsonc templates for Next.js on Cloudflare Workers via OpenNext
// Docs: https://opennext.js.org/cloudflare/get-started
//       https://opennext.js.org/cloudflare/caching
//       https://opennext.js.org/cloudflare/howtos/assets
//       https://opennext.js.org/cloudflare/howtos/skew
//
// Two complete configs follow: SMALL SITE and LARGE SITE.
// Reserved binding names — do not reuse for your own resources:
//   ASSETS, WORKER_SELF_REFERENCE, NEXT_INC_CACHE_R2_BUCKET, NEXT_CACHE_DO_QUEUE,
//   NEXT_TAG_CACHE_D1, NEXT_TAG_CACHE_DO_SHARDED, NEXT_CACHE_DO_PURGE, IMAGES

// ═══════════════════════════════════════════════════════════════════════════
// SMALL SITE — R2 incremental cache + DO queue + D1 tag cache (on-demand only)
// ═══════════════════════════════════════════════════════════════════════════
{
  "$schema": "node_modules/wrangler/config-schema.json",
  "main": ".open-next/worker.js",
  "name": "my-app",

  // Minimum for FinalizationRegistry support
  "compatibility_date": "2025-05-05",
  "compatibility_flags": [
    "nodejs_compat",            // Node.js APIs
    "global_fetch_strictly_public", // allow fetch() in app code
  ],

  "assets": {
    "directory": ".open-next/assets",
    "binding": "ASSETS",
    // run_worker_first: false (default) = most cost-efficient (assets bypass Worker).
    //   Cannot use middleware/rewrites/headers on assets in this mode.
    // run_worker_first: true  = all requests hit the Worker (billed); REQUIRED for
    //   middleware on assets, next.config rewrites/headers, or skew protection.
    "run_worker_first": false,
  },

  "services": [
    {
      // Pages Router res.revalidate + self-reference; recommended always
      "binding": "WORKER_SELF_REFERENCE",
      "service": "my-app",
    },
  ],

  // R2 incremental cache (storage)
  "r2_buckets": [
    {
      "binding": "NEXT_INC_CACHE_R2_BUCKET",
      "bucket_name": "<BUCKET_NAME>",
    },
  ],

  // DO queue (dedupes/synchronizes time-based revalidations)
  "durable_objects": {
    "bindings": [
      {
        "name": "NEXT_CACHE_DO_QUEUE",
        "class_name": "DOQueueHandler",
      },
    ],
  },
  "migrations": [
    {
      "tag": "v1",
      "new_sqlite_classes": ["DOQueueHandler"],
    },
  ],

  // D1 tag cache — ONLY required for on-demand revalidation (revalidateTag/revalidatePath)
  "d1_databases": [
    {
      "binding": "NEXT_TAG_CACHE_D1",
      "database_id": "<DATABASE_ID>",
      "database_name": "<DATABASE_NAME>",
    },
  ],

  // Image optimization (optional) — alternatively use a custom loader in next.config.ts
  // "images": {
  //   "binding": "IMAGES",
  // },

  // Your own bindings (any names NOT in the reserved list above) — examples:
  // "d1_databases": [{ "binding": "DB", "database_id": "...", "database_name": "app-db" }],
  // "r2_buckets":   [{ "binding": "UPLOADS", "bucket_name": "uploads" }],
  // "kv_namespaces":[{ "binding": "KV", "id": "..." }],
  // "ai": { "binding": "AI" },
  // "hyperdrive": [{ "binding": "HYPERDRIVE", "id": "<hyperdrive-id>" }],
}

// ═══════════════════════════════════════════════════════════════════════════
// LARGE SITE — regional cache + DO-sharded tag cache + cache purge
// Pair with open-next.config.ts Tier 3 (largeSiteConfig).
// ═══════════════════════════════════════════════════════════════════════════
// {
//   "$schema": "node_modules/wrangler/config-schema.json",
//   "main": ".open-next/worker.js",
//   "name": "my-app",
//   "compatibility_date": "2025-05-05",
//   "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
//   "assets": {
//     "directory": ".open-next/assets",
//     "binding": "ASSETS",
//     "run_worker_first": false,
//   },
//   "services": [
//     { "binding": "WORKER_SELF_REFERENCE", "service": "my-app" },
//   ],
//   "r2_buckets": [
//     { "binding": "NEXT_INC_CACHE_R2_BUCKET", "bucket_name": "<BUCKET_NAME>" },
//   ],
//   "durable_objects": {
//     "bindings": [
//       { "name": "NEXT_CACHE_DO_QUEUE",        "class_name": "DOQueueHandler" },
//       // Only required for on-demand revalidation
//       { "name": "NEXT_TAG_CACHE_DO_SHARDED",  "class_name": "DOShardedTagCache" },
//       { "name": "NEXT_CACHE_DO_PURGE",        "class_name": "BucketCachePurge" },
//     ],
//   },
//   "migrations": [
//     {
//       "tag": "v1",
//       "new_sqlite_classes": [
//         "DOQueueHandler",
//         "DOShardedTagCache", // only for on-demand
//         "BucketCachePurge",  // only for on-demand
//       ],
//     },
//   ],
//   // Cache purge secrets — only works on a zone (custom domain)
//   // Set via: wrangler secret put CACHE_PURGE_API_TOKEN / CACHE_PURGE_ZONE_ID
// }

// ═══════════════════════════════════════════════════════════════════════════
// OPTIONAL FLAGS
// ═══════════════════════════════════════════════════════════════════════════
// "keep_names": false   // Fixes "__name is not defined" (Wrangler >= 4.13.0).
//                       // Loses original fn names in debugging.
//
// SKEW PROTECTION (in addition to large-site config):
//   "assets": { ..., "run_worker_first": true }   // REQUIRED for skew protection
//   Env vars: CF_WORKER_NAME, CF_PREVIEW_DOMAIN, CF_WORKERS_SCRIPTS_API_TOKEN, CF_ACCOUNT_ID
//   DISABLED for workers with a Durable Object (move DOs to a separate worker).
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall