Agent skill

Cloudflare Kv

by secondsky in secondsky/claude-skills

Cloudflare Workers KV global key-value storage. An agent skill from secondsky/claude-skills.

MITAuto-check passedBackend & APIs

Install Cloudflare Kv

skills CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-kv -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills cloudflare-kv --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/cloudflare-kv/skills/cloudflare-kv .claude/skills/cloudflare-kv && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-kv
GitHub stars
227
Token cost
~2.4k tokens
SKILL.md length
622 words
Files
34 (incl. scripts, references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Cloudflare Workers KV global key-value storage. An agent skill from secondsky/claude-skills.

  • Works in 3 steps: Create KV Namespace → Configure Binding → Basic Operations
  • Encountering KVERROR
  • SKILL.md covers What Is Workers KV?, Quick Start (5 Minutes), KV API Methods and Critical Rules, plus 6 more sections
  • Runs TypeScript scripts from its folder; calls bunx

What it does

Cloudflare Kv is an agent skill from secondsky/claude-skills. Cloudflare Workers KV global key-value storage. Use for namespaces, caching, TTL, or encountering KVERROR, 429 rate limits, consistency issues.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 40 other files, including scripts and reference files (for example `agents/kv-debugger.md`, `agents/kv-optimizer.md` and `commands/optimize-kv.md`).

It sits in Backend & APIs, covering Rate limiting and Caching. It works with Cloudflare and Cloudflare Workers. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Encountering KVERROR
  • 429 rate limits
  • Consistency issues

Example prompts

  • “/cloudflare-kv”

Requirements

  • Node.js

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Create KV Namespace
  2. Configure Binding
  3. Basic Operations

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (TypeScript, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • bunx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Kv loads about 2.4k tokens when it runs, and up to ~22k if it reads all its reference files. Until then it costs about 40 tokens; SKILL.md has 622 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~40
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~22k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 622 words, ~2,440 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-kv/SKILL.md (or your agent's skills folder). This skill also uses 33 other files; get the full folder from GitHub.
name
cloudflare-kv
description
Cloudflare Workers KV global key-value storage. Use for namespaces, caching, TTL, or encountering KV_ERROR, 429 rate limits, consistency issues.
license
MIT
metadata.version
3.0.0
metadata.last_verified
2025-12-27
metadata.production_tested
true
metadata.token_savings
~60%
metadata.errors_prevented
5
metadata.templates_included
5
metadata.references_included
7
metadata.keywords
kv storage, cloudflare kv, workers kv, kv namespace, kv bindings, kv cache, kv ttl, kv metadata, kv list, kv pagination, cache optimization, edge caching…

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 --preview
2. Configure Binding
jsonc
{
  "name": "my-worker",
  "main": "src/index.ts",
  "compatibility_date": "2025-10-11",
  "kv_namespaces": [
    {
      "binding": "MY_NAMESPACE",
      "id": "<PRODUCTION_ID>",
      "preview_id": "<PREVIEW_ID>"
    }
  ]
}
3. Basic Operations
typescript
export default {
  async fetch(request, env, ctx) {
    // Write
    await env.MY_NAMESPACE.put('key', 'value');

    // Read
    const value = await env.MY_NAMESPACE.get('key');

    // Delete
    await env.MY_NAMESPACE.delete('key');

    return new Response(value);
  }
};

Load references/setup-guide.md for complete setup.


KV API Methods

put() - Write
typescript
// Basic
await env.MY_NAMESPACE.put('key', 'value');

// With TTL (1 hour)
await env.MY_NAMESPACE.put('key', 'value', {
  expirationTtl: 3600
});

// With expiration timestamp
await env.MY_NAMESPACE.put('key', 'value', {
  expiration: Math.floor(Date.now() / 1000) + 3600
});

// With metadata
await env.MY_NAMESPACE.put('key', 'value', {
  metadata: { role: 'admin', created: Date.now() }
});
get() - Read
typescript
// Simple get
const value = await env.MY_NAMESPACE.get('key');

// With type
const text = await env.MY_NAMESPACE.get('key', 'text');
const json = await env.MY_NAMESPACE.get('key', 'json');
const buffer = await env.MY_NAMESPACE.get('key', 'arrayBuffer');
const stream = await env.MY_NAMESPACE.get('key', 'stream');

// With metadata
const { value, metadata } = await env.MY_NAMESPACE.getWithMetadata('key');
delete() - Remove
typescript
await env.MY_NAMESPACE.delete('key');
list() - List Keys
typescript
// Basic list
const { keys } = await env.MY_NAMESPACE.list();

// With prefix
const { keys } = await env.MY_NAMESPACE.list({
  prefix: 'user:',
  limit: 100
});

// Pagination
const { keys, cursor } = await env.MY_NAMESPACE.list({
  cursor: previousCursor
});

Critical Rules

Always Do ✅
  1. Use TTL for temporary data
  2. Handle null (key might not exist)
  3. Use metadata for small data
  4. Paginate lists (max 1000 keys)
  5. Use prefixes for organization
  6. Cache in Worker (avoid multiple KV calls)
  7. Use waitUntil() for async writes
  8. Handle eventual consistency
  9. Monitor rate limits
  10. Use JSON.stringify for objects
Never Do ❌
  1. Never assume instant consistency
  2. Never exceed 25MB per value
  3. Never list all keys without pagination
  4. Never skip error handling
  5. Never use for real-time data
  6. Never exceed rate limits (1000 writes/second)
  7. Never store secrets unencrypted
  8. Never use as database (no transactions)
  9. Never ignore metadata limits (1024 bytes)
  10. Never skip TTL for temporary data

Common Use Cases

Use Case 1: API Response Caching
typescript
const cacheKey = `api:${url}`;
let cached = await env.MY_NAMESPACE.get(cacheKey, 'json');

if (!cached) {
  cached = await fetch(url).then(r => r.json());
  await env.MY_NAMESPACE.put(cacheKey, JSON.stringify(cached), {
    expirationTtl: 300  // 5 minutes
  });
}

return Response.json(cached);
Use Case 2: User Preferences
typescript
const userId = '123';
const preferences = {
  theme: 'dark',
  language: 'en'
};

await env.MY_NAMESPACE.put(
  `user:${userId}:preferences`,
  JSON.stringify(preferences),
  {
    metadata: { updated: Date.now() }
  }
);
Use Case 3: Rate Limiting
typescript
const key = `ratelimit:${ip}`;
const count = parseInt(await env.MY_NAMESPACE.get(key) || '0');

if (count >= 100) {
  return new Response('Rate limit exceeded', { status: 429 });
}

await env.MY_NAMESPACE.put(key, String(count + 1), {
  expirationTtl: 60  // 1 minute window
});
Use Case 4: List with Prefix
typescript
const { keys } = await env.MY_NAMESPACE.list({
  prefix: 'user:',
  limit: 100
});

const users = await Promise.all(
  keys.map(({ name }) => env.MY_NAMESPACE.get(name, 'json'))
);
Use Case 5: waitUntil() Pattern
typescript
export default {
  async fetch(request, env, ctx) {
    // Don't wait for KV write
    ctx.waitUntil(
      env.MY_NAMESPACE.put('analytics', JSON.stringify(data))
    );

    return new Response('OK');
  }
};

Limits (Summary)

Key Limits:

  • Key size: 512 bytes max
  • Value size: 25 MB max
  • Metadata: 1024 bytes max

Rate Limits:

  • Writes: 1000/sec per key
  • List: 100/sec per namespace
  • Reads: Unlimited

For detailed limits, pricing, and optimization strategies, load references/limits-quotas.md


Eventual Consistency

KV is eventually consistent:

  • Writes propagate globally (~60 seconds)
  • Not suitable for real-time data
  • Use D1 for strong consistency

Pattern:

typescript
// Write
await env.MY_NAMESPACE.put('key', 'value');

// May not be visible immediately in other regions
const value = await env.MY_NAMESPACE.get('key');  // Might be null

When to Load References

Load specific reference files based on task context:

For Setup & Configuration:

  • Load references/setup-guide.md when creating namespaces or configuring bindings

For Performance Optimization:

  • Load references/best-practices.md when implementing caching or optimizing performance
  • Load references/performance-tuning.md for advanced optimization scenarios, cacheTtl strategies, or benchmarking

For API Usage:

  • Load references/workers-api.md when implementing KV operations or need method signatures

For Troubleshooting:

  • Load references/troubleshooting.md when debugging errors or consistency issues

For Limits & Quotas:

  • Load references/limits-quotas.md when planning capacity or encountering quota errors

For Migration:

  • Load references/migration-guide.md when migrating from localStorage, Redis, D1, R2, or other storage solutions

Show full SKILL.md (250 more words)Show less

Resources

References (references/):

  • best-practices.md - Production patterns, caching strategies, rate limit handling, error recovery
  • setup-guide.md - Complete setup with Wrangler CLI commands, namespace creation, bindings configuration
  • workers-api.md - Complete API reference, consistency model (eventual consistency), limits & quotas, performance optimization
  • troubleshooting.md - Comprehensive error catalog with solutions
  • limits-quotas.md - Detailed limits, quotas, pricing, and optimization tips
  • migration-guide.md - Complete migration guides from localStorage, Redis, D1, R2, and other storage solutions
  • performance-tuning.md - Advanced cacheTtl strategies, bulk operations, key design, benchmarking techniques

Templates (templates/):

  • kv-basic-operations.ts - Basic KV operations (get, put, delete, list)
  • kv-caching-pattern.ts - HTTP caching with KV
  • kv-list-pagination.ts - List with cursor pagination
  • kv-metadata-pattern.ts - Metadata usage patterns
  • wrangler-kv-config.jsonc - KV namespace bindings

Scripts (scripts/):

  • check-versions.sh - Validate KV API endpoints and package versions
  • test-kv-connection.sh - Test KV namespace connection and operations
  • setup-kv-namespace.sh - Interactive namespace setup wizard
  • validate-kv-config.sh - Validate wrangler.jsonc configuration
  • analyze-kv-usage.sh - Analyze code for KV usage patterns and optimizations

Commands:

  • /cloudflare-kv:setup - Interactive KV namespace setup wizard
  • /cloudflare-kv:test - Test KV operations and connection
  • /cloudflare-kv:optimize - Analyze and optimize KV usage

Agents:

  • kv-optimizer - Analyzes KV usage and suggests performance optimizations
  • kv-debugger - Helps debug KV errors and consistency issues

Examples (examples/):

  • rate-limiting/ - Complete rate limiting implementation (fixed window, sliding window, token bucket, multi-tier)
  • session-management/ - Production session store with TTL expiration, metadata tracking, and admin controls
  • api-caching/ - HTTP response caching patterns (cache-aside, stale-while-revalidate, conditional caching, ETag)
  • config-management/ - Feature flags, A/B testing, environment configs, version tracking, hot-reload

Official Documentation


Questions? Issues?

  1. Check references/setup-guide.md for complete setup
  2. Verify namespace binding configured
  3. Handle eventual consistency
  4. Check rate limits

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 33 other files (scripts, references) in plugins/cloudflare-kv/skills/cloudflare-kv of secondsky/claude-skills.

  • SKILL.md
  • agents/kv-debugger.md
  • agents/kv-optimizer.md
  • commands/optimize-kv.md
  • commands/setup-kv.md
  • commands/test-kv.md
  • examples/api-caching/index.ts
  • examples/api-caching/wrangler.jsonc
  • examples/config-management/index.ts
  • examples/config-management/wrangler.jsonc
  • examples/rate-limiting/index.ts
  • examples/rate-limiting/wrangler.jsonc
  • examples/session-management/index.ts
  • examples/session-management/wrangler.jsonc
  • … and 20 more

Open the folder on GitHubat commit 8837836

Compare with similar skills

Cloudflare Kv next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Kv compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Kv this skillsecondsky/claude-skills227—~2.4kAutomated safety check: PassMIT
Cloudflare Worker Devcuriositech/some_claude_skills243—~3.4kAutomated safety check: NotesMIT
Apikerhodgef/apiker127—~1.4kAutomated safety check: PassMIT
Olore Opennext Latestolorehq/olore103—~825Automated safety check: PassMIT
Durable Objectscloudflare/skills3k2 repos~1.5kAutomated safety check: PassApache-2.0
Durable Objectshodgef/apiker1274 repos~1.5kAutomated safety check: PassMIT

Similar skills

  • Cloudflare Worker Dev

    curiositech/some_claude_skills

    Cloudflare Workers, KV, Durable Objects, and edge computing development.

    243 GitHub stars~3.4k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes
  • Apiker

    hodgef/apiker

    Develop, review, and extend the Apiker library — a framework for building serverless REST APIs on Cloudflare Workers + Durable Objects.

    127 GitHub stars~1.4k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Local opennext documentation reference (latest). An agent skill from olorehq/olore.

    103 GitHub stars~825 tokensUpdated today
    Backend & APIsAuto-check passed
  • Durable Objects

    cloudflare/skills

    Official

    Build, debug, or review Cloudflare Durable Objects code for persistent state and coordination.

    3k GitHub starsUsed in 2 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Durable Objects

    hodgef/apiker

    Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 4 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing).

    127 GitHub starsUsed in 3 repos~2k tokens
    Backend & APIsAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Categories

Questions about Cloudflare Kv

What does Cloudflare Kv do?

Cloudflare Workers KV global key-value storage. An agent skill from secondsky/claude-skills. Cloudflare Kv is an agent skill from secondsky/claude-skills. Cloudflare Workers KV global key-value storage.

When should I use Cloudflare Kv?

Cloudflare Kv fits situations like: encountering KVERROR; 429 rate limits; consistency issues.

How do I install Cloudflare Kv in Claude Code?

Run `npx skills add secondsky/claude-skills --skill cloudflare-kv -a claude-code`. Or copy the skill folder (plugins/cloudflare-kv/skills/cloudflare-kv in secondsky/claude-skills) into .claude/skills/cloudflare-kv in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Kv in Codex?

Run `npx skills add secondsky/claude-skills --skill cloudflare-kv -a codex`. Or copy the skill folder (plugins/cloudflare-kv/skills/cloudflare-kv in secondsky/claude-skills) into .agents/skills/cloudflare-kv in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Kv in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill cloudflare-kv -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-kv, .gemini/skills/cloudflare-kv, .github/skills/cloudflare-kv and .opencode/skills/cloudflare-kv in your project.

What does Cloudflare Kv need to run?

Going by SKILL.md and its folder, Cloudflare Kv needs TypeScript for the scripts in its folder and the command-line tools its instructions call (bunx). Our summary lists: Node.js.

Does Cloudflare Kv access the network?

SKILL.md names 1 domain. As links in the text: developers.cloudflare.com. This is read from the text; nothing was executed.

Is Cloudflare Kv safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Cloudflare Kv use?

Cloudflare Kv is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Kv use?

About 2.4k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 20k tokens, read only when the agent opens those files.

What are the alternatives to Cloudflare Kv?

Skills that share tags, products or a category with Cloudflare Kv: Cloudflare Worker Dev (curiositech/some_claude_skills, 243 stars), Apiker (hodgef/apiker, 127 stars), Olore Opennext Latest (olorehq/olore, 103 stars) and Durable Objects (cloudflare/skills, 3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Kv?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.