nts-add-cachelisted
Install: claude install-skill juncoding/nextjs-trpc-prisma-starter
# Add Redis cache to an existing project
For projects scaffolded with `nextjs-trpc-prisma-starter` that didn't enable cache at scaffold time and now want it.
## Use when
- User says "add Redis" / "add caching" / "speed up this query" with the implication that in-process cache isn't enough.
- A specific service method needs cross-process cache (multiple app containers / horizontal scaling).
- User invokes `/nts-add-cache`.
Do NOT use when:
- The project isn't scaffolded by this plugin — the file layout assumptions won't hold. Refuse gracefully and explain.
- The user wants Next.js's built-in `unstable_cache` / `cacheTag` — this plugin uses SPA mode, so those aren't relevant.
## What this skill does
Modifies the existing project in place. After running:
1. `ioredis` added to `package.json` dependencies.
2. `redis` service added to `docker-compose.yml`.
3. `REDIS_URL` added to `.env.example` and `src/env.ts`.
4. New file `src/server/lib/cache.ts` with a typed `cache.get<T>()` / `cache.set()` / `cache.invalidate()` helper.
5. `CLAUDE.md` updated to mention the new cache layer.
6. Optional: a sample service method wrapped in the cache helper, so the user has a worked example.
## Confirmation flow
Before writing anything, confirm:
1. Project root path (default: cwd).
2. Verify `package.json`, `CLAUDE.md`, and `docker-compose.yml` exist — refuse if they don't.
3. Show the user the list of files that will change.
4. Confirm.
## File changes
### `package.json`
Add to `de