Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Adding local data

Teaches how to populate local development resources including KV namespaces, R2 buckets, and D1 databases using the Wrangler CLI with the --local flag.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Adding local data

Teaches how to populate local development resources including KV namespaces, R2 buckets, and D1 databases using the Wrangler CLI with the --local flag.

When To Use

Use when you need to seed local KV, R2, or D1 data for testing Cloudflare Workers in a local development environment using Wrangler.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-development-testing-local-data-adding-workflow-guide.mdA guide explaining how to populate local development resources like KV namespaces using the Wrangler CLI.Questions about a guide explaining how to populate local development resources like KV namespaces using the Wrangler CLI.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle.textA CLI command using wrangler to add a key-value pair to a local KV namespace binding.Exact payloads, commands, or snippets shown in A CLI command using wrangler to add a key-value pair to a local KV namespace binding.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-2.textA CLI command using wrangler to add a key-value pair to a local KV namespace binding.Exact payloads, commands, or snippets shown in A CLI command using wrangler to add a key-value pair to a local KV namespace binding.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-3.textA CLI command using wrangler to add a key-value pair to a local KV namespace binding.Exact payloads, commands, or snippets shown in A CLI command using wrangler to add a key-value pair to a local KV namespace binding.
examples/workers-development-testing-local-data-adding-cloudflare-workers-kv-bulk.textA CLI command demonstrating how to use wrangler to bulk upload data to a local KV namespace.Exact payloads, commands, or snippets shown in A CLI command demonstrating how to use wrangler to bulk upload data to a local KV namespace.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-4.textA command line instruction using wrangler to bulk upload data to a local KV namespace.Exact payloads, commands, or snippets shown in A command line instruction using wrangler to bulk upload data to a local KV namespace.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-5.textA CLI command using wrangler to bulk upload data to a local KV namespace binding.Exact payloads, commands, or snippets shown in A CLI command using wrangler to bulk upload data to a local KV namespace binding.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-6.textA CLI command using wrangler to upload a file to a local R2 bucket for Workers development.Exact payloads, commands, or snippets shown in A CLI command using wrangler to upload a file to a local R2 bucket for Workers development.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-7.textA CLI command using Wrangler to upload a file to a local R2 bucket for Workers development testing.Exact payloads, commands, or snippets shown in A CLI command using Wrangler to upload a file to a local R2 bucket for Workers development testing.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-8.textA CLI command using wrangler to upload a file to a local R2 bucket for development testing.Exact payloads, commands, or snippets shown in A CLI command using wrangler to upload a file to a local R2 bucket for development testing.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca.textA command line example demonstrating how to execute a SQL query against a local D1 database using Wrangler.Exact payloads, commands, or snippets shown in A command line example demonstrating how to execute a SQL query against a local D1 database using Wrangler.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca-2.textA command line example demonstrating how to execute a SQL query against a local D1 database using the Wrangler CLI.Exact payloads, commands, or snippets shown in A command line example demonstrating how to execute a SQL query against a local D1 database using the Wrangler CLI.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca-3.textA command line example using wrangler d1 execute with the local flag to run SQL queries against a local D1 database.Exact payloads, commands, or snippets shown in A command line example using wrangler d1 execute with the local flag to run SQL queries against a local D1 database.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca-4.textA SQL schema file used to initialize a local D1 database instance via the Wrangler CLI.Exact payloads, commands, or snippets shown in A SQL schema file used to initialize a local D1 database instance via the Wrangler CLI.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca-5.textA wrangler command used to execute a SQL schema file against a local D1 database instance.Exact payloads, commands, or snippets shown in A wrangler command used to execute a SQL schema file against a local D1 database instance.
examples/workers-development-testing-local-data-adding-cloudflare-workers-d1-loca-6.textA command line instruction using wrangler to execute a SQL schema file against a local D1 database instance.Exact payloads, commands, or snippets shown in A command line instruction using wrangler to execute a SQL schema file against a local D1 database instance.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-9.textA command line instruction demonstrating how to use the wrangler dev flag to persist local data to a specific directory.Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the wrangler dev flag to persist local data to a specific directory.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-10.textA text command demonstrating how to use the wrangler dev flag to persist local data to a specific directory.Exact payloads, commands, or snippets shown in A text command demonstrating how to use the wrangler dev flag to persist local data to a specific directory.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-11.textA command line instruction demonstrating how to use the wrangler dev flag to persist local data to a specific directory.Exact payloads, commands, or snippets shown in A command line instruction demonstrating how to use the wrangler dev flag to persist local data to a specific directory.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-12.textA wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.Exact payloads, commands, or snippets shown in A wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-13.textA wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.Exact payloads, commands, or snippets shown in A wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.
examples/workers-development-testing-local-data-adding-cloudflare-workers-wrangle-14.textA wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.Exact payloads, commands, or snippets shown in A wrangler command to add a key-value pair to a local KV namespace using the persist-to flag.
examples/workers-development-testing-local-data-adding-cloudflare-workers-vite-pe.textA vite configuration file demonstrating how to use the cloudflare plugin to persist local state in a custom directory.Exact payloads, commands, or snippets shown in A vite configuration file demonstrating how to use the cloudflare plugin to persist local state in a custom directory.

What This Skill Covers

  • Whether you are using Wrangler or the Cloudflare Vite plugin ↗, your workflow for accessing data during local development remains the same. However, you can...
  • Main sections: How it works, Populating local resources with data, KV namespaces, Add a single key-value pair, Bulk upload.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/development-testing/local-data