agents-inc/skills/src/skills/api-database-vercel-kv/SKILL.md
api-database-vercel-kv
Serverless Redis-compatible key-value store via Upstash REST API -- edge-compatible, automatic JSON serialization, TTL-based caching
- Source repository stars
- 21
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-09
- Source checked
- 2026-08-25
Decision brief
What it does: where it fits
Quick Guide: Use @upstash/redis (the successor to @vercel/kv) for serverless, edge-compatible Redis via REST API. Key gotchas: REST adds 5-15ms latency per call vs TCP Redis, all values are auto-serialized as JSON (objects round-trip transparently but Date objects become strings…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/agents-inc/skills --skill "src/skills/api-database-vercel-kv"Inspect the Agent Skill "api-database-vercel-kv" from https://github.com/agents-inc/skills/blob/81d43a51211aca12c85dcc16085fa99014ec548e/src/skills/api-database-vercel-kv/SKILL.md at commit 81d43a51211aca12c85dcc16085fa99014ec548e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)(You MUST use @upstash/redis for new projects -- @vercel/kv was deprecated in December 2024 and all stores were migrated to Upstash Redis)(You MUST set TTLs on all cached data -- serverless Redis is billed per command and has storage limits per plan) - 02
Examples
Auto-detection: Vercel KV, @vercel/kv, @upstash/redis, Upstash Redis, KVRESTAPIURL, KVRESTAPITOKEN, UPSTASHREDISRESTURL, UPSTASHREDISRESTTOKEN, Redis.fromEnv, kv.set, kv.get, kv.hset, kv.hget, kv.incr, kv.expire, kv.del, createClient, automaticDeserialization, edge Redis, server…
Core Patterns -- Client setup, CRUD operations, TTL, hashes, pipelines, transactions, rate limiting, sessionsreference.md -- Command quick reference, environment variables, plan limitsCaching API responses or database queries in Vercel serverless/edge functions - 03
Philosophy
Upstash Redis (formerly Vercel KV) is a serverless, REST-based Redis designed for edge and serverless runtimes where TCP connections are unavailable or impractical. The core trade-off: HTTP compatibility everywhere, at the cost of per-request latency overhead.
REST-first -- Every Redis command is an HTTP request. This works everywhere (edge, serverless, browsers) but adds 5-15ms per call. Batch with pipelines.Auto-serialization -- Objects are JSON-serialized on write and deserialized on read. This is convenient but means Date objects, Map, Set, and functions are not preserved faithfully.Ephemeral by design -- Set TTLs on everything. Serverless Redis is billed per command and has storage caps. Treat it as a cache, not a database. - 04
Core Patterns
Full implementations with good/bad pairs: examples/core.md
Full implementations with good/bad pairs: examples/core.mdTwo approaches: Redis.fromEnv() (preferred on Vercel -- reads UPSTASHREDISRESTURL and UPSTASHREDISRESTTOKEN automatically) or new Redis({ url, token }) for explicit configuration. Never hardcode credentials.The SDK auto-serializes objects to JSON on write and deserializes on read. Never call JSON.stringify manually -- it causes double-serialization. Use get() for typed returns, satisfies for type-safe writes. Date objects… - 05
Pattern 1: Client Initialization
Two approaches: Redis.fromEnv() (preferred on Vercel -- reads UPSTASHREDISRESTURL and UPSTASHREDISRESTTOKEN automatically) or new Redis({ url, token }) for explicit configuration. Never hardcode credentials.
Two approaches: Redis.fromEnv() (preferred on Vercel -- reads UPSTASHREDISRESTURL and UPSTASHREDISRESTTOKEN automatically) or new Redis({ url, token }) for explicit configuration. Never hardcode credentials.
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 92/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 21 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- agents-inc/skills
- Skill path
- src/skills/api-database-vercel-kv/SKILL.md
- Commit
- 81d43a51211aca12c85dcc16085fa99014ec548e
- License
- MIT
- Collected
- 2026-08-25
- Default branch
- main
View the original SKILL.md
Vercel KV / Upstash Redis Patterns
Quick Guide: Use
@upstash/redis(the successor to@vercel/kv) for serverless, edge-compatible Redis via REST API. Key gotchas: REST adds ~5-15ms latency per call vs TCP Redis, all values are auto-serialized as JSON (objects round-trip transparently butDateobjects become strings), pipeline/multi execute as single HTTP requests but pipeline is NOT atomic. UseRedis.fromEnv()for automatic connection. Always set TTLs -- serverless Redis is billed per command.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST use @upstash/redis for new projects -- @vercel/kv was deprecated in December 2024 and all stores were migrated to Upstash Redis)
(You MUST set TTLs on all cached data -- serverless Redis is billed per command and has storage limits per plan)
(You MUST understand that this is a REST/HTTP client, NOT a TCP Redis client -- each command is an HTTP request with ~5-15ms overhead, so batch with pipelines when possible)
</critical_requirements>
Examples
- Core Patterns -- Client setup, CRUD operations, TTL, hashes, pipelines, transactions, rate limiting, sessions
Additional resources:
- reference.md -- Command quick reference, environment variables, plan limits
Auto-detection: Vercel KV, @vercel/kv, @upstash/redis, Upstash Redis, KV_REST_API_URL, KV_REST_API_TOKEN, UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN, Redis.fromEnv, kv.set, kv.get, kv.hset, kv.hget, kv.incr, kv.expire, kv.del, createClient, automaticDeserialization, edge Redis, serverless Redis
When to use:
- Caching API responses or database queries in Vercel serverless/edge functions
- Rate limiting at the edge (sliding window counters)
- Session storage for serverless applications
- Feature flags, A/B test assignments, or short-lived counters
- Any Redis use case on Vercel where TCP connections are unavailable (edge runtime)
Key patterns covered:
- Client initialization (
Redis.fromEnv(),new Redis()) - Basic CRUD with automatic JSON serialization
- TTL and expiration strategies
- Hash operations for structured data
- Pipelines (batched HTTP) and transactions (atomic MULTI/EXEC)
- Rate limiting with sorted sets
- Session storage patterns
When NOT to use:
- High-throughput, low-latency Redis workloads (use ioredis with TCP -- REST adds per-request overhead)
- Pub/Sub subscribers (REST is request-response, not persistent connections)
- Redis Streams consumers (requires TCP client like ioredis)
- Large value storage (>1 MB per record on free tier, billed by command count)
- Primary database (Redis is a cache/ephemeral store, not a source of truth)
Philosophy
Upstash Redis (formerly Vercel KV) is a serverless, REST-based Redis designed for edge and serverless runtimes where TCP connections are unavailable or impractical. The core trade-off: HTTP compatibility everywhere, at the cost of per-request latency overhead.
Core principles:
- REST-first -- Every Redis command is an HTTP request. This works everywhere (edge, serverless, browsers) but adds ~5-15ms per call. Batch with pipelines.
- Auto-serialization -- Objects are JSON-serialized on write and deserialized on read. This is convenient but means
Dateobjects,Map,Set, and functions are not preserved faithfully. - Ephemeral by design -- Set TTLs on everything. Serverless Redis is billed per command and has storage caps. Treat it as a cache, not a database.
- Zero connection management -- No connection pools, no reconnection logic, no
errorevent handlers. Each request is stateless HTTP.
Core Patterns
Full implementations with good/bad pairs: examples/core.md
Pattern 1: Client Initialization
Two approaches: Redis.fromEnv() (preferred on Vercel -- reads UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN automatically) or new Redis({ url, token }) for explicit configuration. Never hardcode credentials.
import { Redis } from "@upstash/redis";
const redis = Redis.fromEnv();
export { redis };
Pattern 2: Automatic JSON Serialization
The SDK auto-serializes objects to JSON on write and deserializes on read. Never call JSON.stringify manually -- it causes double-serialization. Use get<T>() for typed returns, satisfies for type-safe writes. Date objects become ISO strings on round-trip -- store timestamps as numbers instead.
await redis.set("user:123", data satisfies UserProfile, { ex: TTL_SECONDS });
const user = await redis.get<UserProfile>("user:123"); // UserProfile | null
Pattern 3: TTL and Expiration
Always set TTLs -- serverless Redis is billed per command. Use { ex: seconds } or { px: milliseconds } on set(). Use { nx: true } for distributed locks (returns "OK" or null). Keys without TTLs cause unbounded storage growth.
await redis.set("cache:key", data, { ex: CACHE_TTL_SECONDS });
Pattern 4: Hash Operations
Hashes enable partial field reads/writes without serializing entire objects. Use hset for multi-field writes, hget/hgetall for reads, hincrby for atomic counters. Note: hset does not accept TTL directly -- call expire() separately. hgetall returns null for missing keys (not {}).
Pattern 5: Pipelines and Transactions
Pipelines (redis.pipeline()) batch commands into a single HTTP request but are NOT atomic. Transactions (redis.multi()) provide atomic MULTI/EXEC, also as a single HTTP request. Avoid sequential calls when multiple commands can be batched -- each call is a separate HTTP round-trip.
const pipe = redis.pipeline();
pipe.set("k1", "v1", { ex: TTL });
pipe.incr("counter");
const results = await pipe.exec<[string, number]>();
Important: Upstash REST transactions do NOT support WATCH for optimistic locking.
Pattern 6: Rate Limiting (Sliding Window)
Sliding window via sorted set scores -- zadd with timestamp as score, zremrangebyscore to prune expired entries, zcard to count, all batched in a pipeline. For production rate limiting, consider @upstash/ratelimit which provides built-in algorithms.
Pattern 7: Cache-Aside Helper
Generic cacheAside<T>(key, fetcher, ttl) pattern: check cache first, fetch on miss, fire-and-forget cache write to avoid blocking responses on cache failures.
<decision_framework>
Decision Framework
Upstash Redis vs ioredis/node-redis?
Which Redis client should I use?
+-- Running in Vercel Edge Runtime? -> @upstash/redis (only option -- no TCP)
+-- Running in Vercel Serverless Functions? -> @upstash/redis (simpler) or ioredis (if you need TCP features)
+-- Need Pub/Sub subscribers? -> ioredis (REST cannot maintain subscriptions)
+-- Need Redis Streams consumers? -> ioredis (requires persistent TCP connection)
+-- Need lowest possible latency (<1ms)? -> ioredis with TCP (REST adds HTTP overhead)
+-- Simple caching/sessions/counters? -> @upstash/redis (zero connection management)
Pipeline vs Transaction vs Sequential?
How should I batch commands?
+-- Need atomicity (all-or-nothing)? -> redis.multi() (transaction)
+-- Just reducing HTTP round-trips? -> redis.pipeline() (non-atomic batch)
+-- Single independent command? -> Direct call (redis.set, redis.get, etc.)
</decision_framework>
<red_flags>
RED FLAGS
High Priority Issues:
- Using
@vercel/kvin new projects -- deprecated December 2024, use@upstash/redisinstead - Missing TTLs on cached keys -- causes unbounded storage growth and unexpected billing
- Manual
JSON.stringify/JSON.parsewith Upstash Redis -- causes double-serialization because the SDK auto-serializes all values - Assuming pipeline commands are atomic -- pipelines batch for HTTP efficiency but do NOT guarantee atomicity (use
multi()for atomic execution)
Medium Priority Issues:
- Making sequential Redis calls where a pipeline would work -- each call is a separate HTTP round-trip (~5-15ms each)
- Storing values >1 MB -- REST requests have size limits per plan (100 MB max on free/pay-as-you-go, but large values degrade performance)
- Using Upstash Redis as a primary database -- it's a cache/ephemeral store, always have a source of truth elsewhere
Common Mistakes:
- Expecting
hgetallto return an empty object{}for missing keys -- Upstash returnsnull(unlike ioredis which returns{}) - Forgetting that
get()returnsnull(notundefined) for missing keys - Passing
Dateobjects and expecting them to survive round-trip -- they serialize to ISO strings and come back as strings, notDateinstances
Gotchas & Edge Cases:
automaticDeserialization: falsebreaks many TypeScript types -- only disable if you need raw string responses and are prepared to handle typing manuallysetwithexoption resets TTL on overwrite (standard Redis behavior) -- if youseta key that already has a TTL, the newexvalue replaces it- REST latency is per-request, not per-command -- a pipeline with 10 commands has the same HTTP overhead as a single command (one round-trip)
- Free tier is limited to 500K commands/month and 256 MB storage -- monitor usage in production
nx(set-if-not-exists) returnsnullon failure,"OK"on success -- check the return value explicitly
</red_flags>
<critical_reminders>
CRITICAL REMINDERS
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST use @upstash/redis for new projects -- @vercel/kv was deprecated in December 2024 and all stores were migrated to Upstash Redis)
(You MUST set TTLs on all cached data -- serverless Redis is billed per command and has storage limits per plan)
(You MUST understand that this is a REST/HTTP client, NOT a TCP Redis client -- each command is an HTTP request with ~5-15ms overhead, so batch with pipelines when possible)
Failure to follow these rules will cause deprecated package usage, unbounded storage costs, and unnecessary latency in serverless functions.
</critical_reminders>
Frequently asked questions
What to verify before installation and use
What does the api-database-vercel-kv source document cover?
Quick Guide: Use @upstash/redis (the successor to @vercel/kv) for serverless, edge-compatible Redis via REST API. Key gotchas: REST adds 5-15ms latency per call vs TCP Redis, all values are auto-serialized as JSON (objects round-trip transparently but Date objects become strings…
How do I install api-database-vercel-kv?
The source record exposes this install command: npx skills add https://github.com/agents-inc/skills --skill "src/skills/api-database-vercel-kv". Inspect the command and pinned source before running it.
Alternatives
Compare before choosing
garrytan/gbrain
bulk-ingestion
End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
dotnet/skills
migrate-vstest-to-mtp
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing
oaustegard/claude-skills
featuring
Generate hierarchical _FEATURES.md files that describe what a codebase DOES from a user/consumer perspective, anchored to source symbols via tree-sitting. Supports large complex codebases through feature-driven decomposition into sub-feature files. Uses a multi-pass synthesis: orientation → detail → overview rewrite. Use when someone says "what does this do", "document features", "feature inventory", "_FEATURES.md", or needs to understand a codebase's purpose before modifying it. Complements tre