skillfed

cloudflare-kv

This skill streamlines setup and configuration of Cloudflare Workers KV storage namespaces, handling bindings and environment integration for Claude Code CLI. Part of a vetted collection of 142 production-ready skills designed for immediate deployment in Claude Code and Factory Droid environments.

cloudflare-kv streamlines the setup and configuration of Cloudflare Workers KV storage namespaces. To set up a KV namespace, you first create it using Wrangler with `wrangler kv:namespace create "my-namespace"`, then add the binding to your `wrangler.toml` file under the `[[kv_namespaces]]` section, specifying both the binding name and namespace ID. In your Worker code, access the namespace through the binding (e.g., `NAMESPACE.get()`, `NAMESPACE.put()`, `NAMESPACE.delete()`) to perform key-value operations. Proper bindings and environment integration ensure your namespace is correctly connected for immediate deployment in Claude Code and Factory Droid environments.

AI-generated summary based on this skill's SKILL.md

196 29 MIT updated by secondsky

Install

secondsky/claude-skills/cloudflare-kv · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/secondsky/claude-skills
cp -r claude-skills/plugins/cloudflare-kv/skills/cloudflare-kv ~/.claude/skills/cloudflare-kv

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I set up a KV namespace in Cloudflare Workers?

cloudflare-kv streamlines the setup and configuration of Cloudflare Workers KV storage namespaces. To set up a KV namespace, you first create it using Wrangler with `wrangler kv:namespace create "my-namespace"`, then add the binding to your `wrangler.toml` file under the `[[kv_namespaces]]` section, specifying both the binding name and namespace ID. In your Worker code, access the namespace through the binding (e.g., `NAMESPACE.get()`, `NAMESPACE.put()`, `NAMESPACE.delete()`) to perform key-value operations. Proper bindings and environment integration ensure your namespace is correctly connected for immediate deployment in Claude Code and Factory Droid environments.

What is the best way to implement caching with TTL expiration in KV?

cloudflare-kv supports implementing caching and TTL patterns for API responses and temporary data. When storing data, use the `expirationTtl` parameter in your `put()` call to set an automatic expiration time in seconds—for example, `await NAMESPACE.put(key, value, { expirationTtl: 3600 })` caches data for one hour. This pattern is ideal for API response caching, session tokens, and temporary computation results. By leveraging TTL expiration, you reduce storage costs and ensure stale data is automatically removed without manual cleanup, making your edge caching strategy both efficient and maintainable.

How do I troubleshoot KV rate limiting and 429 errors?

cloudflare-kv helps debug KV errors, rate limits, and eventual consistency issues that may arise in production. Rate limiting (HTTP 429 errors) typically occurs when you exceed Cloudflare's request limits per namespace. To troubleshoot, implement exponential backoff retry logic in your Worker, batch multiple operations where possible, and distribute requests across multiple namespaces if your workload permits. Monitor your request patterns and consider caching frequently accessed keys in memory within your Worker to reduce KV calls. If errors persist, verify your namespace quota and review Cloudflare's current rate limit documentation for your plan tier.

What are the key limits and best practices for optimizing KV performance?

cloudflare-kv optimizes KV performance and helps you understand limits, quotas, and best practices for production use. Key limits include a 25MB maximum value size per key, eventual consistency across Cloudflare's global network, and rate limits that vary by plan. Best practices include: batch operations to reduce round trips, use metadata storage patterns for indexing, implement pagination with cursors when listing keys, and design your schema to avoid hot keys. For session management and edge caching of API responses, structure your data to minimize lookups and leverage TTL expiration to keep your namespace lean and performant.

How do I handle eventual consistency issues in KV storage?

cloudflare-kv addresses eventual consistency issues that arise because KV is a globally distributed, eventually consistent store. After a write operation, the new value may not be immediately available at all edge locations; reads may temporarily return stale or missing data. To handle this, design your application to tolerate brief inconsistencies—for example, add a small retry delay or cache-aside pattern. For critical data, consider using Cloudflare D1 (a distributed SQL database) instead of KV, or structure your workflow so that immediate read-after-write consistency is not required. Document your consistency expectations and test failover scenarios to ensure your Worker behaves correctly during propagation delays.

How do I migrate from other storage solutions to Cloudflare KV?

cloudflare-kv facilitates migration from other storage solutions to Cloudflare KV by providing clear setup and configuration guidance. Begin by exporting your existing data in a format compatible with KV (key-value pairs), then use a migration Worker or script to batch-import data using `put()` operations, respecting the 25MB value limit. Create a new KV namespace alongside your existing storage, run a parallel test phase to validate data integrity, then gradually shift traffic to KV. Plan for eventual consistency during the transition—reads may hit the old system briefly while KV propagates globally. This phased approach minimizes downtime and lets you verify performance before fully committing to KV as your primary store.

SKILL.md

rendered from the published skill — quoted content, verbatim

Cloudflare Workers KV

Status: Production Ready ✅ | Last Verified: 2025-12-27


What Is Workers KV?

Global key-value storage on Cloudflare edge: - Eventually consistent - Low latency worldwide - 1GB+ values supported - TTL expiration - Metadata support


Quick Start (5 Minutes)

1. Create KV Namespace

```bash bunx wrangler kv namespace create MY_NAMESPACE bunx wrangler kv namespace create MY_NAMESPACE

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
plugins/cloudflare-kv/skills/cloudflare-kv/SKILL.md
plugins/cloudflare-kv/skills/cloudflare-kv/agents/kv-debugger.md
plugins/cloudflare-kv/skills/cloudflare-kv/agents/kv-optimizer.md
plugins/cloudflare-kv/skills/cloudflare-kv/commands/optimize-kv.md
plugins/cloudflare-kv/skills/cloudflare-kv/commands/setup-kv.md
plugins/cloudflare-kv/skills/cloudflare-kv/commands/test-kv.md
plugins/cloudflare-kv/skills/cloudflare-kv/examples/api-caching/index.ts
plugins/cloudflare-kv/skills/cloudflare-kv/examples/api-caching/wrangler.jsonc
plugins/cloudflare-kv/skills/cloudflare-kv/examples/config-management/index.ts
plugins/cloudflare-kv/skills/cloudflare-kv/examples/config-management/wrangler.jsonc
plugins/cloudflare-kv/skills/cloudflare-kv/examples/rate-limiting/index.ts
plugins/cloudflare-kv/skills/cloudflare-kv/examples/rate-limiting/wrangler.jsonc
plugins/cloudflare-kv/skills/cloudflare-kv/examples/session-management/index.ts
plugins/cloudflare-kv/skills/cloudflare-kv/examples/session-management/wrangler.jsonc
plugins/cloudflare-kv/skills/cloudflare-kv/references/best-practices.md

Related skills

Tags

edge-storage distributed-cache serverless-kv eventual-consistency rate-limit-handling ttl-expiration key-organization global-replication response-caching worker-bindings