Interactive KV namespace setup wizard - creates namespaces, configures bindings, and generates Worker code
Sets up Cloudflare Workers KV namespaces with bindings and TypeScript types.
/plugin marketplace add secondsky/claude-skills/plugin install cloudflare-kv@claude-skillscloudflare-kv/commands/This command guides through the complete setup process for Cloudflare Workers KV namespaces.
Creates KV Namespaces
Configures wrangler.jsonc
Generates TypeScript Types
Tests Connection
Run the command and follow prompts:
/cloudflare-kv:setup
The command will:
Provide namespace name upfront:
/cloudflare-kv:setup MY_NAMESPACE
Execute the setup script from the cloudflare-kv skill:
${CLAUDE_PLUGIN_ROOT}/scripts/setup-kv-namespace.sh [namespace-name]
The script will:
Before running this command, ensure:
Wrangler CLI Installed
npm install -g wrangler
Authenticated with Cloudflare
wrangler login
Active Cloudflare Account
Cloudflare Workers KV - Namespace Setup Wizard
================================================
Creating KV namespaces for: MY_KV_NAMESPACE
Step 1: Creating production namespace...
✓ Production namespace created
ID: a1b2c3d4e5f6789012345678901234ab
Step 2: Creating preview namespace...
✓ Preview namespace created
ID: b2c3d4e5f6789012345678901234abc1
✓ Namespaces created successfully!
Step 3: Generating wrangler.jsonc configuration...
Add this to your wrangler.jsonc:
"kv_namespaces": [
{
"binding": "MY_KV_NAMESPACE",
"id": "a1b2c3d4e5f6789012345678901234ab",
"preview_id": "b2c3d4e5f6789012345678901234abc1"
}
]
Step 4: TypeScript type definition example...
Add this to your Worker code for TypeScript support:
type Env = {
MY_KV_NAMESPACE: KVNamespace;
};
✓ Setup complete!
Next steps:
1. Ensure wrangler.jsonc has the KV namespace configuration
2. Use env.MY_KV_NAMESPACE in your Worker code
3. Test with: wrangler dev
Once setup completes:
Verify Configuration
${CLAUDE_PLUGIN_ROOT}/scripts/validate-kv-config.sh
Test Connection
/cloudflare-kv:test MY_KV_NAMESPACE
Start Developing
export default {
async fetch(request, env: Env) {
await env.MY_KV_NAMESPACE.put('key', 'value');
const value = await env.MY_KV_NAMESPACE.get('key');
return new Response(value);
}
};
Run Locally
wrangler dev
Solution: Authenticate first
wrangler login
Possible causes:
Solution: Check Cloudflare dashboard and account settings
The script won't overwrite existing configs. You'll need to manually add the KV namespace configuration shown in the output.
/cloudflare-kv:test - Test KV operations and connection/cloudflare-kv:optimize - Analyze KV usage patternsFor more details:
references/setup-guide.md for complete setup documentationreferences/best-practices.md for production configuration