AI-powered development skills for building production-ready Valkey applications
This repository contains comprehensive, language-specific skills for developing with Valkey GLIDE - the official high-performance client library for Valkey. These skills are designed to be consumed by AI coding assistants (Claude, ChatGPT, Kiro, etc.) to help developers write correct, idiomatic Valkey code from the start.
Developers new to Valkey GLIDE face common challenges:
- API confusion: Different async patterns across languages (Promises, CompletableFuture, Task)
- Common pitfalls: Resource leaks, incorrect exception handling, cluster slot violations
- Anti-patterns: Using wrong clients, blocking async code, swallowing errors
- Language-specific gotchas: Binary data handling, batch API differences, type system quirks
Without guidance, developers spend hours debugging issues that could have been avoided with proper patterns.
These skills provide:
- ✅ Correct patterns for each language with ✅/❌ examples
- ✅ Anti-pattern demonstrations showing what NOT to do (and why)
- ✅ Working code examples validated against live Valkey
- ✅ Best practices distilled from production experience
- ✅ Quick-start guides to get productive immediately
- {LANGUAGE}.md - Comprehensive skill guide with patterns and examples
- LESSONS_LEARNED.md - Development insights and gotchas (retained for reference)
- Demonstrations of common mistakes
- Explanations of why they're wrong
- Correct alternatives with examples
- Basic operations (strings, hashes, lists, sets)
- Batch/pipeline operations (atomic vs non-atomic)
- Cluster operations (hash tags, slot management)
- Vector search (where supported)
- Production config templates (timeouts, retry, throughput, AZ affinity)
- Monitoring (OpenTelemetry, logging)
- Serverless/Lambda patterns
- Data structure optimization
- Performance checklist
For Developers:
- Get started with Valkey GLIDE in minutes, not hours
- Avoid common mistakes before they reach production
- Learn idiomatic patterns for your language
- Reference comprehensive examples for complex operations
For AI Assistants:
- Generate correct Valkey code on first attempt
- Understand language-specific nuances (async patterns, error handling)
- Provide accurate guidance on cluster operations, batching, vector search
- Avoid suggesting deprecated or incorrect APIs
Before (Without Skill):
# ❌ Resource leak - client never closed
client = GlideClient(config)
await client.set("key", "value")
# ❌ Expensive exception-based control flow
try:
value = await client.get("key")
except RequestException:
value = None
# ❌ Cluster CROSSSLOT error
batch = ClusterBatch(True)
batch.set("key1", "value1") # Different slots
batch.set("key2", "value2")
await client.exec(batch) # Fails!After (With Skill):
# ✅ Automatic cleanup with context manager
async with GlideClient(config) as client:
await client.set("key", "value")
# ✅ Efficient existence check
exists = await client.exists(["key"])
if exists:
value = await client.get("key")
# ✅ Hash tags for same slot
batch = ClusterBatch(True)
batch.set("{user}:1", "value1") # Same slot
batch.set("{user}:2", "value2")
await client.exec(batch) # Success!Measured Impact:
- Time to first working code: 5 minutes vs 2+ hours (debugging common pitfalls)
- Error reduction: 4 critical anti-patterns documented and avoided
- Code quality: Idiomatic patterns for 6 languages with ✅/❌ examples
- Validation: All examples tested against live Valkey instances
| Language | Status | Key Features |
|---|---|---|
| Python | Async/await, type hints, anti-patterns, performance optimization | |
| Java | CompletableFuture, try-with-resources, anti-patterns, performance optimization | |
| Node.js | Promises, GlideFt, Decoder.Bytes, performance optimization | |
| Go | context.Context, error handling, anti-patterns, performance optimization | |
| PHP | Synchronous API, SOLID principles, anti-patterns, performance optimization | |
| C# | Task, await using, StackExchange.Redis compatibility |
Each language guide includes a Performance Optimization section covering production tuning. Cross-cutting resources:
| Resource | Description |
|---|---|
| Config Templates | Production-ready client configurations for all languages |
| Server Configuration Guide | Cluster sizing, memory policy, ElastiCache node types, monitoring |
| Benchmarks | Measure performance impact of optimization patterns |
| SKILL.md — Performance | Universal anti-patterns and optimization checklist |
Setup:
# Install Valkey GLIDE
pip install valkey-glide
# Set Valkey host (optional)
export VALKEY_HOST=localhostBasic Example:
from glide import GlideClient, GlideClientConfiguration, NodeAddress
# Create client
config = GlideClientConfiguration([NodeAddress("localhost", 6379)])
async with GlideClient(config) as client:
# String operations
await client.set("key", "value")
result = await client.get("key")
print(f"Value: {result}")Key Patterns:
- Use
async withfor automatic cleanup - Avoid mutable default arguments
- Use
raise_on_error=Truefor batch operations - See python.md for complete guide
Setup:
# Add to pom.xml
<dependency>
<groupId>io.valkey</groupId>
<artifactId>valkey-glide</artifactId>
<version>2.+</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
# Or Gradle
implementation group: 'io.valkey', name: 'valkey-glide', version: '2.+', classifier: osdetector.classifierBasic Example:
import glide.api.GlideClient;
import glide.api.models.configuration.GlideClientConfiguration;
import glide.api.models.configuration.NodeAddress;
// Try-with-resources for automatic cleanup
try (GlideClient client = GlideClient.createClient(
GlideClientConfiguration.builder()
.address(NodeAddress.builder().host("localhost").port(6379).build())
.requestTimeout(10000)
.build()
).get()) {
// String operations
client.set("key", "value").get();
String value = client.get("key").get();
System.out.println("Value: " + value);
}Key Patterns:
- Use try-with-resources for cleanup
- Set explicit
requestTimeout() - Use
.get()for blocking,.thenCompose()for async - Unwrap
ExecutionExceptionwith.getCause() - See java.md for complete guide
Setup:
# Install Valkey GLIDE
npm install @valkey/valkey-glide
# Set Valkey host (optional)
export VALKEY_HOST=localhostBasic Example:
const { GlideClient } = require("@valkey/valkey-glide");
// Create client
const client = await GlideClient.createClient({
addresses: [{ host: "localhost", port: 6379 }],
});
// String operations
await client.set("key", "value");
const value = await client.get("key");
console.log(`Value: ${value}`);
// Always close
client.close();Key Patterns:
- All operations return Promises
- Use
Decoder.Bytesfor binary data - Use
GlideFtfor vector search - Always call
client.close() - See nodejs.md for complete guide
Setup:
# Install Valkey GLIDE
go get github.com/valkey-io/valkey-glide/go
# Set Valkey host (optional)
export VALKEY_HOST=localhostBasic Example:
import (
"context"
"github.com/valkey-io/valkey-glide/go/glide/api"
)
// Create client with context
config := api.NewGlideClientConfiguration().
WithAddress(&api.NodeAddress{Host: "localhost", Port: 6379})
client, err := api.NewGlideClient(config)
if err != nil {
return err
}
defer client.Close()
// String operations
ctx := context.Background()
err = client.Set(ctx, "key", "value")
value, err := client.Get(ctx, "key")
fmt.Printf("Value: %s\n", *value)Key Patterns:
- Always pass
context.Context - Check errors explicitly
- Use
defer client.Close() - Dereference pointers for values
- See go.md for complete guide
Setup:
# Install Valkey GLIDE (requires PHP 8.1+)
composer require valkey/valkey-glide
# Or use Docker
docker build -t php-glide .Basic Example:
<?php
require 'vendor/autoload.php';
use Valkey\Glide\GlideClient;
use Valkey\Glide\GlideClientConfiguration;
// Create client
$config = new GlideClientConfiguration(['localhost:6379']);
$client = new GlideClient($config);
// String operations
$client->set('key', 'value');
$value = $client->get('key');
echo "Value: $value\n";
// Always close
$client->close();Key Patterns:
- Synchronous API (no async complexity)
- PHPRedis compatibility layer available
- Use
multi()for transactions,pipeline()for pipelines - Separate repositories (avoid God Objects)
- See php.md for complete guide
Setup:
# Install Valkey GLIDE
dotnet add package Valkey.Glide
# Set Valkey host (optional)
export VALKEY_HOST=localhostBasic Example:
using Valkey.Glide;
using static Valkey.Glide.ConnectionConfiguration;
// Create client with await using
var config = new StandaloneClientConfigurationBuilder()
.WithAddress("localhost", 6379)
.WithRequestTimeout(TimeSpan.FromSeconds(10))
.Build();
await using var client = await GlideClient.CreateClient(config);
// String operations
await client.StringSetAsync("key", "value");
var value = await client.StringGetAsync("key");
Console.WriteLine($"Value: {value}");Key Patterns:
- Use
await usingfor automatic disposal - All methods are async (PascalCase naming)
- Use
isAtomic:parameter for batches - StackExchange.Redis compatibility available
- See csharp.md for complete guide
All code examples have been validated against live Valkey instances:
- Standalone mode (port 6379)
- Cluster mode (ports 7000-7002)
- Vector search (where supported)
These skills are maintained as part of the Valkey GLIDE project. To contribute:
- Test patterns against live Valkey
- Validate with AI assistants (Claude, ChatGPT, Kiro)
- Follow language-specific conventions
- Include ✅/❌ examples for clarity
These skills are provided as-is for educational and development purposes. Refer to individual language client licenses for usage terms.
Ready to build with Valkey? Choose your language above and start with the Quick Start guide!