upstash-redis-js
БесплатноБез исполняемых скриптовНе проверенWork with the @upstash/redis TypeScript/JavaScript SDK, a serverless HTTP-based Redis client for Next.js, Vercel, Cloudflare Workers, edge runtimes, and…
от upstash★ 37 звёзд на GitHubОб этом скилле
Upstash Redis SDK - Complete Skills Guide
This directory contains comprehensive guides for using the @upstash/redis SDK. These skill files are designed to help developers and AI assistants understand and use the SDK effectively.
Bundled docs and source
Before writing or debugging SDK code, check node_modules/@upstash/redis/docs/ for bundled docs and node_modules/@upstash/redis/src/ for readable TypeScript source. Read and search the relevant files when present; otherwise use the references in this skill.
Installation
npm install @upstash/redis
Quick Start
Basic Initialization
import { Redis } from "@upstash/redis";
// Initialize with explicit credentials
const redis = new Redis({
url: "UPSTASH_REDIS_REST_URL",
token: "UPSTASH_REDIS_REST_TOKEN",
});
// Or initialize from environment variables
const redis = Redis.fromEnv();
Environment Variables
Set these in your .env file:
UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-token-here
Redis.fromEnv() also reads KV_REST_API_URL and KV_REST_API_TOKEN as a fallback.
Other Runtimes
// Cloudflare Workers: pass the env binding
import { Redis } from "@upstash/redis/cloudflare";
const redis = Redis.fromEnv(env);
// Fastly Compute: needs the name of a backend defined on the service
import { Redis } from "@upstash/redis/fastly";
const redis = new Redis({ url: "<URL>", token: "<TOKEN>", backend: "upstash-db" });
Client Options
Defaults shown; all are optional.
const redis = new Redis({
url: "<URL>",
token: "<TOKEN>",
automaticDeserialization: true, // performance/data-serialization.md
responseEncoding: false, // or "base64", performance/data-serialization.md
enableAutoPipelining: true, // advanced-features/auto-pipeline.md
readYourWrites: true, // performance/redis-replicas.md
retry: { retries: 5 }, // or false, performance/error-handling.md
cache: "no-store", // fetch cache setting
keepAlive: true,
latencyLogging: false, // true logs the latency of every command
// signal: () => AbortSignal.timeout(5000), performance/error-handling.md
});
Branches: test against a copy of real data
A branch is a point-in-time copy of a database with its own endpoint and token. Later changes on either side stay separate, and a branch cannot be merged back. The SDK has no call that creates one: a branch is created on the account, then used like any other database.
- MCP (when Upstash MCP tools are in the session): call
redis_create_branchwithdatabaseIdandname, then pollredis_get_databasewith the returneddatabase_iduntilstateisactive. Leaveinclude_credentialsoff: with it, the REST token comes back into the conversation. The response has the endpoint; for the token, use the CLI below if it is installed, or ask the user to copy the branch's REST token from the console into the env file. - CLI (no MCP):
upstash redis create-branch --db-id <id> --name <branch-name>, thenupstash redis get --db-id <branch database_id> --hide-credentialsuntilstateisactive. Runredis getwithout--hide-credentialsonly to pipeendpointandrest_tokenthroughjqinto the app's env file, so the token never shows in your output.
Neither writes the credentials anywhere, so point the client at the branch yourself, preferably by setting UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN in the env file to the branch's values, or explicitly:
const redis = new Redis({
url: "https://<branch endpoint>",
token: "<branch rest_token>",
});
A branch is billed as pay-as-you-go whatever the source's plan, so tell the user before copying a large database. The account needs a payment method and the source must be a global database on a pay-as-you-go, fixed or enterprise plan (free databases are refused). Delete a branch like a database: redis_delete_database, or upstash redis delete --db-id <id>. Delete only branches you created for the task, and check the id with the user first, since the same call deletes a production database.
Skill Files Overview
Data Structures (data-structures/)
Redis data types with auto-serialization examples:
- strings.md - GET, SET, INCR, DECR, APPEND with automatic type handling
- hashes.md - HSET, HGET, HMGET with object serialization, per-field expiration (HEXPIRE, HTTL)
- lists.md - LPUSH, RPUSH, LRANGE with array handling
- sets.md - SADD, SMEMBERS, set operations
- sorted-sets.md - ZADD, ZRANGE, ZRANK, leaderboard patterns
- json.md - JSON.SET, JSON.GET, JSONPath queries for nested objects
- streams.md - XADD, XREAD, XGROUP, consumer groups
- arrays.md - ARSET, ARINSERT, ARSCAN, ARGREP, AROP, ring buffers with ARRING on sparse index-addressed arrays
- vector-indexes.md - VECTOR.CREATE, VECTOR.ADD, VECTOR.QUERY nearest-neighbour search inside Redis via redis.vect
Установить upstash-redis-js в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл upstash-redis-js?
Work with the @upstash/redis TypeScript/JavaScript SDK, a serverless HTTP-based Redis client for Next.js, Vercel, Cloudflare Workers, edge runtimes, and Node.js. Use when adding a cache (cache-aside, TTL strategies), session storage, a key-value store, leaderboards with sorted sets, counters, distributed locks, queues, streams and consumer groups, ring buffers and sparse arrays (ARSET, ARRING), vector search inside Redis (redis.vector), JSON documents, pipelines and transactions, Lua scripting, read replicas, or full-text and hybrid search, facets and aggregations with Upstash Redis Search (not FT.SEARCH; TCP clients use @upstash/search-redis or @upstash/search-ioredis). Also use when migrating from ioredis or node-redis, connecting from serverless without pooling, building AI agents with Upstash AgentKit (agent memory, chat history, RAG tools, resumable streams) for the Vercel AI SDK, TanStack AI, or Vercel Eve, or when the user says Redis cache, KV store, session store, serverless Redis, or Upstash Redis.
Как установить скилл upstash-redis-js?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл upstash-redis-js запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic