upstash
Upstashのエキスパートとして、RedisやKafkaなどのサーバーレスデータプラットフォームを活用し、HTTP APIを通じてキャッシュ、レート制限、メッセージキューイングなどをサーバーレス/エッジアプリケーションに組み込み、機能拡張を支援するSkill。
📜 元の英語説明(参考)
You are an expert in Upstash, the serverless data platform for Redis, Kafka, and QStash. You help developers add caching, rate limiting, session storage, message queuing, and scheduled jobs to serverless and edge applications — with HTTP-based APIs that work on Vercel Edge, Cloudflare Workers, and AWS Lambda without persistent connections.
🇯🇵 日本人クリエイター向け解説
Upstashのエキスパートとして、RedisやKafkaなどのサーバーレスデータプラットフォームを活用し、HTTP APIを通じてキャッシュ、レート制限、メッセージキューイングなどをサーバーレス/エッジアプリケーションに組み込み、機能拡張を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o upstash.zip https://jpskill.com/download/15521.zip && unzip -o upstash.zip && rm upstash.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15521.zip -OutFile "$d\upstash.zip"; Expand-Archive "$d\upstash.zip" -DestinationPath $d -Force; ri "$d\upstash.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
upstash.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
upstashフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Upstash — サーバーレス Redis、Kafka & QStash
Upstash、つまり Redis、Kafka、QStash 向けのサーバーレスデータプラットフォームのエキスパートとして、私は開発者がキャッシュ、レート制限、セッションストレージ、メッセージキューイング、およびスケジュールされたジョブを、永続的な接続なしで Vercel Edge、Cloudflare Workers、および AWS Lambda で動作する HTTP ベースの API を使用して、サーバーレスおよびエッジアプリケーションに追加するのを支援します。
主要な機能
サーバーレス Redis
import { Redis } from "@upstash/redis";
const redis = Redis.fromEnv(); // UPSTASH_REDIS_REST_URL + TOKEN を使用
// キャッシュ
async function getCachedUser(userId: string): Promise<User> {
const cached = await redis.get<User>(`user:${userId}`);
if (cached) return cached;
const user = await db.users.findById(userId);
await redis.set(`user:${userId}`, user, { ex: 3600 }); // 1 時間の TTL
return user;
}
// レート制限
import { Ratelimit } from "@upstash/ratelimit";
const ratelimit = new Ratelimit({
redis,
limiter: Ratelimit.slidingWindow(10, "10 s"), // 10 秒あたり 10 リクエスト
analytics: true,
});
// API ルート / ミドルウェア内
const { success, limit, remaining, reset } = await ratelimit.limit(userId);
if (!success) {
return new Response("Too Many Requests", {
status: 429,
headers: {
"X-RateLimit-Limit": limit.toString(),
"X-RateLimit-Remaining": remaining.toString(),
"X-RateLimit-Reset": reset.toString(),
},
});
}
// セッションストレージ
await redis.hset(`session:${sessionId}`, { userId: "42", role: "admin", cart: JSON.stringify(items) });
const session = await redis.hgetall(`session:${sessionId}`);
await redis.expire(`session:${sessionId}`, 86400); // 24 時間の TTL
QStash (サーバーレスメッセージキュー)
import { Client } from "@upstash/qstash";
const qstash = new Client({ token: process.env.QSTASH_TOKEN! });
// エンドポイントにメッセージを公開
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/process-order",
body: { orderId: "ord-123", action: "fulfill" },
retries: 3,
delay: "30s", // 30 秒遅延
});
// 定期的なスケジュール
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/daily-report",
cron: "0 9 * * *", // 毎日午前 9 時
});
// バッチ
await qstash.batchJSON([
{ url: "https://myapp.vercel.app/api/send-email", body: { to: "user1@example.com" } },
{ url: "https://myapp.vercel.app/api/send-email", body: { to: "user2@example.com" } },
]);
// コールバック URL (処理完了時の webhook)
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/long-task",
body: { taskId: "task-1" },
callback: "https://myapp.vercel.app/api/task-complete",
failureCallback: "https://myapp.vercel.app/api/task-failed",
});
Upstash Workflow
import { serve } from "@upstash/workflow/nextjs";
export const { POST } = serve(async (context) => {
const { orderId } = context.requestPayload;
// ステップ 1 (永続的)
const order = await context.run("fetch-order", async () => {
return await db.orders.findById(orderId);
});
// ステップ 2
await context.run("charge-payment", async () => {
await stripe.charges.create({ amount: order.total * 100, customer: order.customerId });
});
// スリープ (永続的)
await context.sleep("wait-for-fulfillment", 60 * 60); // 1 時間
// ステップ 3
await context.run("send-shipping-notification", async () => {
await resend.emails.send({ to: order.email, subject: "Order Shipped" });
});
});
インストール
npm install @upstash/redis @upstash/ratelimit @upstash/qstash
ベストプラクティス
- HTTP-based — Upstash Redis は TCP ではなく HTTP を使用します。接続プーリングなしでエッジ/サーバーレスで動作します。
- Rate limiting — スライディングウィンドウで
@upstash/ratelimitを使用します。エッジでの API 保護のために構築されています。 - QStash for async — サーバーレスでは SQS/BullMQ の代わりに QStash を使用します。任意の HTTP エンドポイントに配信します。
- Edge-compatible — すべての Upstash SDK は Vercel Edge、CF Workers、Deno Deploy で動作します。Node.js API は不要です。
- TTL on everything — キャッシュキーに有効期限を設定します。古いデータを防ぎ、コストを制御します。
- Pipeline for batch — 複数の操作には
redis.pipeline()を使用します。単一の HTTP ラウンドトリップです。 - Workflow for durable — 複数ステップのプロセスには Upstash Workflow を使用します。サーバーレスのタイムアウトを回避します。
- Free tier — 1 日あたり 10K コマンドが無料です。プロトタイピングや小規模プロジェクトに最適です。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Upstash — Serverless Redis, Kafka & QStash
You are an expert in Upstash, the serverless data platform for Redis, Kafka, and QStash. You help developers add caching, rate limiting, session storage, message queuing, and scheduled jobs to serverless and edge applications — with HTTP-based APIs that work on Vercel Edge, Cloudflare Workers, and AWS Lambda without persistent connections.
Core Capabilities
Serverless Redis
import { Redis } from "@upstash/redis";
const redis = Redis.fromEnv(); // Uses UPSTASH_REDIS_REST_URL + TOKEN
// Caching
async function getCachedUser(userId: string): Promise<User> {
const cached = await redis.get<User>(`user:${userId}`);
if (cached) return cached;
const user = await db.users.findById(userId);
await redis.set(`user:${userId}`, user, { ex: 3600 }); // 1 hour TTL
return user;
}
// Rate limiting
import { Ratelimit } from "@upstash/ratelimit";
const ratelimit = new Ratelimit({
redis,
limiter: Ratelimit.slidingWindow(10, "10 s"), // 10 requests per 10 seconds
analytics: true,
});
// In API route / middleware
const { success, limit, remaining, reset } = await ratelimit.limit(userId);
if (!success) {
return new Response("Too Many Requests", {
status: 429,
headers: {
"X-RateLimit-Limit": limit.toString(),
"X-RateLimit-Remaining": remaining.toString(),
"X-RateLimit-Reset": reset.toString(),
},
});
}
// Session storage
await redis.hset(`session:${sessionId}`, { userId: "42", role: "admin", cart: JSON.stringify(items) });
const session = await redis.hgetall(`session:${sessionId}`);
await redis.expire(`session:${sessionId}`, 86400); // 24h TTL
QStash (Serverless Message Queue)
import { Client } from "@upstash/qstash";
const qstash = new Client({ token: process.env.QSTASH_TOKEN! });
// Publish message to endpoint
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/process-order",
body: { orderId: "ord-123", action: "fulfill" },
retries: 3,
delay: "30s", // Delay delivery by 30s
});
// Schedule recurring
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/daily-report",
cron: "0 9 * * *", // Daily at 9 AM
});
// Batch
await qstash.batchJSON([
{ url: "https://myapp.vercel.app/api/send-email", body: { to: "user1@example.com" } },
{ url: "https://myapp.vercel.app/api/send-email", body: { to: "user2@example.com" } },
]);
// Callback URL (webhook when processing completes)
await qstash.publishJSON({
url: "https://myapp.vercel.app/api/long-task",
body: { taskId: "task-1" },
callback: "https://myapp.vercel.app/api/task-complete",
failureCallback: "https://myapp.vercel.app/api/task-failed",
});
Upstash Workflow
import { serve } from "@upstash/workflow/nextjs";
export const { POST } = serve(async (context) => {
const { orderId } = context.requestPayload;
// Step 1 (durable)
const order = await context.run("fetch-order", async () => {
return await db.orders.findById(orderId);
});
// Step 2
await context.run("charge-payment", async () => {
await stripe.charges.create({ amount: order.total * 100, customer: order.customerId });
});
// Sleep (durable)
await context.sleep("wait-for-fulfillment", 60 * 60); // 1 hour
// Step 3
await context.run("send-shipping-notification", async () => {
await resend.emails.send({ to: order.email, subject: "Order Shipped" });
});
});
Installation
npm install @upstash/redis @upstash/ratelimit @upstash/qstash
Best Practices
- HTTP-based — Upstash Redis uses HTTP, not TCP; works on edge/serverless without connection pooling
- Rate limiting — Use
@upstash/ratelimitwith sliding window; built for API protection on edge - QStash for async — Use QStash instead of SQS/BullMQ on serverless; delivers to any HTTP endpoint
- Edge-compatible — All Upstash SDKs work on Vercel Edge, CF Workers, Deno Deploy; no Node.js APIs needed
- TTL on everything — Set expiration on cache keys; prevent stale data and control costs
- Pipeline for batch — Use
redis.pipeline()for multiple operations; single HTTP round-trip - Workflow for durable — Use Upstash Workflow for multi-step processes; survives serverless timeouts
- Free tier — 10K commands/day free; great for prototyping and small projects