hassanzohdy/atomic-query/cache
Claude Code and agent skill by hassanzohdy/atomic-query
- community
Checking that the SKILL.md file is still in the repository.
All cache management operations in @mongez/atomic-query — invalidation, refetch, optimistic writes, seeding, direct reads, destruction, GC, and non-React subscriptions.
Install
npx vskill@latest install hassanzohdy/atomic-query/cacheSKILL.md
Cache management
Operations on the cache itself — invalidation, refetch, optimistic writes, lifecycle.
Invalidation
Matching is segment-aware. invalidate({ queryKey: ["users", 1] }) matches:
["users", 1]✓ (exact)["users", 1, "profile"]✓ (child)
But NOT:
["users", 10]✗["users", 100]✗
Internally: queries are hashed via canonical JSON; prefix matching requires a , boundary after the parent's last element, so ["users",1] and ["users",10] differ at position 9.
exact: true only refetches the literal hash match.
Refetch
Refetches share the in-flight dedup map — calling refetchQuery(key) while a fetch is already running for that key joins the existing promise.
Optimistic writes
Replaces the cached value without triggering a refetch. Subscribers re-render. Use inside onMutate for optimistic patterns; pair with invalidate in onSettled to re-sync.
Seeding
Inserts a state: "success" entry into the cache. Consumers see it on first read, no refetch unless stale per freshFor / staleTime. The React wrapper is <HydrateQueries>.
Direct reads
Destruction
Removes the entry from the cache AND aborts any in-flight fetch for that key. Idempotent — no-op for unknown keys.
Wipes everything and aborts every in-flight fetch.
Stats and GC
setupAutoGC is called automatically on the first useQuery so consumers don't need to remember it. The default cadence is "every minute, evict anything unobserved for more than 5 minutes."
GC respects observer counts. A query with mounted consumers is never GC'd, even if its data is old. Only queries with zero observers (since gcTime ms ago) get evicted.
Subscribing without a hook
Fires on every slice change for the named key — including create (prev === undefined) and destroy (next === undefined). Returns { unsubscribe }.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cache/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hassanzohdy/atomic-query/cache)