remix-cache
A type-safe, Redis-backed caching library for Remix applications with SSE-based real-time invalidation, stale-while-revalidate, pattern matching, and automatic React revalidation. Use when working with Remix caching, Redis, cache invalidation, implementing caching strategies, or real-time data synchronization in Remix apps.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o remix-cache.zip https://jpskill.com/download/17820.zip && unzip -o remix-cache.zip && rm remix-cache.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17820.zip -OutFile "$d\remix-cache.zip"; Expand-Archive "$d\remix-cache.zip" -DestinationPath $d -Force; ri "$d\remix-cache.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
remix-cache.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
remix-cacheフォルダができる - 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
- 同梱ファイル
- 2
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Remix Cache Skill
Expert guidance for using remix-cache, a production-ready caching library for Remix applications.
When to use this skill
Use this skill when the user asks about:
- Implementing caching in Remix applications
- Redis-backed caching strategies
- Cache invalidation (by key, tag, or pattern)
- Real-time cache synchronization with SSE
- Stale-while-revalidate patterns
- Type-safe cache definitions
- React hooks for automatic revalidation
- Performance optimization with caching
- Server vs serverless caching modes
- Circuit breaker patterns for cache failures
Quick reference
Basic setup
// app/cache.server.ts
import { createCache } from 'remix-cache/server'
export const cache = createCache({
redis: { host: process.env.REDIS_HOST, port: 6379 },
prefix: 'myapp',
})
export const userCache = cache.define({
name: 'user',
key: (userId: string) => userId,
fetch: async (userId: string) => db.user.findUnique({ where: { id: userId } }),
ttl: 300,
})
Use in loaders
export async function loader({ params }: LoaderFunctionArgs) {
const user = await userCache.get(params.userId)
return json({ user })
}
Invalidation
// By key
await cache.invalidate({ key: 'myapp:user:123' })
// By tag
await cache.invalidateByTag('product')
// By pattern
await cache.invalidateByPattern('user:*')
Real-time React revalidation
// app/root.tsx
<CacheProvider endpoint="/api/cache-events">
<Outlet />
</CacheProvider>
// Component
useCache({ tags: ['user'], debounce: 200 })
Detailed documentation
For comprehensive guidance on specific topics, see:
- GETTING_STARTED.md - Installation, setup, and first cache definition
- API_REFERENCE.md - Complete API documentation for all methods and options
- PATTERNS.md - Common caching patterns and best practices
- REACT_INTEGRATION.md - SSE setup and React hooks for real-time invalidation
- EXAMPLES.md - Real-world examples (e-commerce, sessions, API caching)
- TROUBLESHOOTING.md - Common issues and solutions
- TESTING.md - Testing strategies and patterns
Key capabilities
1. Type-safe cache definitions
Perfect TypeScript inference for cache keys and values. See API_REFERENCE.md.
2. Advanced TTL strategies
- Stale-while-revalidate: Serve stale data while fetching fresh
- Sliding window: Reset TTL on each access
- Conditional TTL: Dynamic TTL based on data See PATTERNS.md.
3. Multi-level invalidation
- By key: Invalidate specific entries
- By tag: Invalidate groups of related entries
- By pattern: Invalidate using glob patterns
- Cascading: Automatic dependent invalidation See API_REFERENCE.md.
4. Real-time synchronization
- SSE endpoint: Stream invalidation events to clients
- React hooks: Automatic revalidation on cache changes
- Filtering: Revalidate only for specific keys/tags/patterns See REACT_INTEGRATION.md.
5. Resilience features
- Circuit breaker: Graceful degradation when Redis fails
- Request deduplication: Prevent cache stampede
- Error events: Monitor and track failures See PATTERNS.md.
6. Deployment flexibility
- Server mode: Two-tier caching (local LRU + Redis)
- Serverless mode: Redis-only with versioned keys See API_REFERENCE.md.
File structure in this repository
The remix-cache library is organized as:
src/
├── server/ # Server-side cache implementation
│ ├── cache.ts # Main cache class
│ ├── definition.ts # Cache definition implementation
│ ├── sse-handler.ts # SSE endpoint generator
│ ├── local-cache.ts # In-memory LRU cache
│ ├── circuit-breaker.ts # Circuit breaker pattern
│ └── deduplicator.ts # Request deduplication
├── react/ # React integration
│ ├── provider.tsx # CacheProvider component
│ ├── use-cache.ts # useCache hook
│ └── context.tsx # React context
├── types/ # TypeScript type definitions
│ ├── cache.ts
│ ├── definition.ts
│ └── events.ts
└── utils/ # Utility functions
├── key-builder.ts # Cache key generation
├── pattern-match.ts # Glob pattern matching
└── env-detect.ts # Environment detection
Common workflows
Setting up a new cache
- Read GETTING_STARTED.md for basic setup
- Create cache instance in
app/cache.server.ts - Define cache definitions for your data types
- Use in loaders/actions
- Set up SSE endpoint for real-time invalidation (see REACT_INTEGRATION.md)
- Add React hooks to components that need auto-revalidation
Implementing cache invalidation
- Identify invalidation strategy (key/tag/pattern)
- Add tags to cache definitions if needed
- Call invalidation methods in actions
- Verify invalidation events are fired
- Test React components revalidate correctly
Debugging cache issues
- Check TROUBLESHOOTING.md for common issues
- Enable event listeners to monitor cache behavior
- Verify Redis connection and configuration
- Check circuit breaker state
- Inspect SSE connection in browser DevTools
Writing tests
See TESTING.md for:
- Unit testing cache definitions
- Integration testing with Redis
- Mocking cache in tests
- Testing invalidation logic
- Testing React components with cache
Environment variables
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your-password
CACHE_PREFIX=myapp
CACHE_DEFAULT_TTL=300
NODE_ENV=production
Implementation notes
When helping users implement remix-cache:
- Always ensure type safety: The library provides perfect TypeScript inference
- Consider deployment mode: Ask if serverless or server-based
- Plan invalidation strategy: Tags are more flexible than keys
- Set appropriate TTLs: Balance freshness with performance
- Monitor errors: Always set up error event listeners
- Test thoroughly: Cache bugs can be subtle, see TESTING.md
- Close connections: Especially important in tests
Getting help
For specific topics:
- New to the library? → GETTING_STARTED.md
- Looking for API details? → API_REFERENCE.md
- Need implementation patterns? → PATTERNS.md and EXAMPLES.md
- Setting up React integration? → REACT_INTEGRATION.md
- Encountering issues? → TROUBLESHOOTING.md
- Writing tests? → TESTING.md
Version
This skill covers remix-cache v0.1.0 with complete implementation of Phases 1-5:
- ✅ Core caching with Redis backend
- ✅ Type-safe cache definitions
- ✅ Stale-while-revalidate
- ✅ Sliding window TTL
- ✅ Pattern & tag-based invalidation
- ✅ Circuit breaker pattern
- ✅ Request deduplication
- ✅ Server/serverless modes
- ✅ SSE real-time invalidation
- ✅ React hooks for auto-revalidation
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (7,840 bytes)
- 📎 README.md (2,960 bytes)