-
Notifications
You must be signed in to change notification settings - Fork 88
DX-2363: add redis-js skills #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a comprehensive set of “skills” documentation for the @upstash/redis JavaScript/TypeScript SDK, covering data structures, patterns, performance, advanced features, and migrations from other Redis clients. The goal is to give developers (and AI assistants) ready-to-use patterns and API examples for common Redis use cases on Upstash.
Changes:
- Add a top-level
skills/SKILL.mdindex describing the newredis-jsskill set and linking to all individual skill files. - Add detailed guides for core Redis data structures, advanced features (pipelining, scripting, auto-pipelining), and optimization/performance topics specific to Upstash Redis.
- Add pattern and migration guides (caching, rate limiting, sessions, locks, leaderboards, and migrations from
ioredisandnode-redis) with TypeScript examples using@upstash/redis.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/SKILL.md | Introduces the redis-js skill, indexing all other skill documents and providing quick-start usage and best practices. |
| skills/performance/ttl-expiration.md | Documents TTL usage and key expiration patterns with @upstash/redis examples. |
| skills/performance/redis-replicas.md | Explains Upstash Redis global replication and when additional read regions help performance. |
| skills/performance/pipeline-optimization.md | Details manual vs auto pipelining, including performance comparisons and batching patterns (one helper example currently misuses the operations callbacks). |
| skills/performance/error-handling.md | Shows retry configuration and request cancellation (AbortSignal) patterns for robust Redis calls. |
| skills/performance/data-serialization.md | Describes automatic (de)serialization behavior and edge cases; includes several examples, though the code block currently reuses the const retrieved identifier in ways that won’t compile. |
| skills/performance/batching-operations.md | Covers batching commands (MGET/MSET, HMGET/HSET, pipelines) for reduced round trips. |
| skills/patterns/session-management.md | Provides session, cart, multi-device, “remember me”, and activity-tracking patterns implemented on Redis. |
| skills/patterns/rate-limiting.md | Implements fixed window, sliding window, token bucket (Lua), and @upstash/ratelimit-based examples, plus per-tier and per-endpoint policies. |
| skills/patterns/leaderboard.md | Shows a full leaderboard pattern on top of sorted sets, including rank context and percentile calculations. |
| skills/patterns/distributed-locks.md | Documents simple locks, token-based safe unlock, retries, and webhook de-duplication using Redis keys. |
| skills/patterns/caching.md | Demonstrates cache-aside, write-through, and cache invalidation flows for a generic database layer. |
| skills/migrations/from-redis-node.md | Guides migration from node-redis to @upstash/redis, comparing connection, commands, serialization, pipelines, and error handling. |
| skills/migrations/from-ioredis.md | Guides migration from ioredis, with side-by-side examples for connection, commands, pipelines, hashes, and a migration checklist. |
| skills/data-structures/strings.md | Documents string usage (including numeric counters, TTLs, and batch operations) using the JS/TS SDK. |
| skills/data-structures/streams.md | Explains stream operations, consumer groups, pending/claim flows, trimming, and a worker example. |
| skills/data-structures/sorted-sets.md | Describes sorted set APIs and patterns such as leaderboards and time-series-like access. |
| skills/data-structures/sets.md | Covers set operations, membership checks, and unions/intersections/differences. |
| skills/data-structures/lists.md | Shows list commands for queues, stacks, trims, and element updates. |
| skills/data-structures/json.md | Details JSON data type usage with path operations, arrays, objects, numeric ops, and type inspection. |
| skills/data-structures/hashes.md | Documents hash usage with field operations; one example comment currently conflicts with other docs about numeric type preservation. |
| skills/advanced-features/scripting.md | Provides Lua scripting examples (conditional updates, rate limiting, purchases) and use of SCRIPT LOAD/EVALSHA. |
| skills/advanced-features/pipeline-and-transactions.md | Explains manual pipelines and MULTI/EXEC transactions in the Upstash client. |
| skills/advanced-features/auto-pipeline.md | Introduces automatic pipelining behavior; mentions enableAutoPipelining but the sample shows only automaticDeserialization, which could confuse readers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const start2 = Date.now(); | ||
| const retrieved = await redis.get("big"); | ||
| const retrieved = Date.now() - start2; | ||
|
|
||
| console.log(`Store: ${stored}ms, Retrieve: ${retrieved}ms`); |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example code block, the identifier retrieved is declared multiple times as a const (earlier for a class instance, again for the binary value, and here for the performance timing). Re-declaring the same const in the same scope will cause a TypeScript compilation error; consider giving each usage a distinct, descriptive name (e.g., instance, binaryData, retrievedTime) to avoid shadowing and make the examples copy-pasteable.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.