Test KV namespace connection and operations - validates configuration, performs CRUD tests, and reports diagnostics
Tests Cloudflare KV namespace connection with CRUD operations and configuration validation.
/plugin marketplace add secondsky/claude-skills/plugin install cloudflare-kv@claude-skillscloudflare-kv/commands/This command validates KV namespace configuration and tests basic operations to ensure everything is working correctly.
Validates Configuration
Tests CRUD Operations
Reports Diagnostics
Test a specific namespace binding:
/cloudflare-kv:test MY_NAMESPACE
Replace MY_NAMESPACE with your actual binding name from wrangler.jsonc.
If no namespace provided, the command will:
/cloudflare-kv:test
Execute the test script from the cloudflare-kv skill:
${CLAUDE_PLUGIN_ROOT}/scripts/test-kv-connection.sh <NAMESPACE_BINDING>
The script performs:
Wrangler CLI Installed
npm install -g wrangler
Authenticated
wrangler whoami # Verify authentication
Namespace Configured
Cloudflare Workers KV - Connection Tester
==========================================
Testing namespace: MY_KV_NAMESPACE
Step 1: Checking namespace configuration...
✓ Namespace binding found in wrangler.jsonc
✓ Namespace ID: a1b2c3d4e5f6789012345678901234ab
Step 2: Testing KV operations...
Test key: __test_connection_1735300800
Testing PUT operation... ✓ Success
Testing GET operation... ✓ Success (value matches)
Testing DELETE operation... ✓ Success
Verifying deletion... ✓ Success (key removed)
Summary:
========
✓ All tests passed!
Your KV namespace 'MY_KV_NAMESPACE' is working correctly.
Testing namespace: BROKEN_NAMESPACE
Step 1: Checking namespace configuration...
✗ Namespace binding 'BROKEN_NAMESPACE' not found in wrangler.jsonc
Add it to your wrangler.jsonc:
"kv_namespaces": [
{
"binding": "BROKEN_NAMESPACE",
"id": "your-namespace-id"
}
]
This command tests:
✅ Configuration
✅ Operations
❌ Not Tested
For comprehensive testing, see references/troubleshooting.md.
Cause: Missing or incorrect configuration
Solution:
/cloudflare-kv:setup to create namespace"kv_namespaces": [{
"binding": "MY_NAMESPACE",
"id": "your-id"
}]
Possible causes:
Solution:
# Re-authenticate
wrangler login
# Verify namespace ID is correct
wrangler kv namespace list
# Check wrangler.jsonc configuration
${CLAUDE_PLUGIN_ROOT}/scripts/validate-kv-config.sh
Cause: Eventual consistency delay
Solution: This is rare in local testing. If persistent:
If tests pass:
Start Development
wrangler dev
Optimize Usage
/cloudflare-kv:optimize src/index.ts
Deploy to Production
wrangler deploy
If tests fail:
Validate Configuration
${CLAUDE_PLUGIN_ROOT}/scripts/validate-kv-config.sh
Check Troubleshooting Guide
references/troubleshooting.md for detailed error solutionsVerify Account Status
/cloudflare-kv:setup - Create and configure new namespace/cloudflare-kv:optimize - Analyze KV usage patternsFor more details:
references/troubleshooting.md for error diagnosticsreferences/setup-guide.md for configuration help