
tanstack-vue-store-skilld
Vue adapter for TanStack Store, a framework agnostic type-safe store. ALWAYS use when writing code importing "@tanstack/vue-store" in a Vue app. Covers the useSelector, useAtom, useStore (deprecated), and useStore hooks, the re-exported @tanstack/store core API (createStore, createAtom, createAsyncAtom, batch, flush, shallow), debugging, best practices, and migration between @tanstack/vue-store versions.
- Installs
- 99
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-vue-store-skilld- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads tanstack-vue-store-skilld automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
@tanstack/vue-store@0.11.1
Vue adapter for TanStack Store. Exact core dependency: @tanstack/store@0.11.1 (package.json:41). src/index.ts:1 re-exports the whole core, so Vue apps import everything from @tanstack/vue-store alone.
Quick start
import { createStore, createAtom, shallow, useAtom, useSelector } from '@tanstack/vue-store'
// Module scope: create once, import anywhere
const counter = createStore({ count: 0 })
const countAtom = createAtom(0)
// Inside <script setup>
const count = useSelector(counter, (s) => s.count) // slice
const pair = useSelector(counter, (s) => ({ n: s.count }), { compare: shallow }) // object slice
const [n, setN] = useAtom(countAtom) // read + write
setN((prev) => prev + 1)
Read refs in templates as {{ count }}, in script as count.value.
Hooks (this package's own exports)
| Hook | Signature | Use |
|---|---|---|
useSelector | (source, selector?, options?) => Readonly<Ref<TSelected>> | Primary read hook. Store, atom, or any { get, subscribe } source. Omit the selector to subscribe to the whole value. |
useAtom | (atom, options?) => [Readonly<Ref<TValue>>, atom.set] | Read plus write for one writable atom. The setter takes a value or an updater function (src/useAtom.ts:20-27). |
_useStore | (store, selector, options?) => [selected, actions or setState] | Experimental read+write tuple. The selector argument is required (src/_useStore.ts:30). Returns store.actions when the store has an actions factory, else store.setState (src/_useStore.ts:37-38). |
useStore | deprecated | Alias for useSelector. Third argument is a bare compare function, not an options object (src/useStore.ts:14-23). Prefer useSelector. |
options is UseSelectorOptions: { compare?: (a, b) => boolean } (src/useSelector.ts:4-6).
Details, behavior notes, and pitfalls: Vue hooks reference
Rules that prevent bugs
- Default compare is strict
===(src/useSelector.ts:15-17). When the selector builds a fresh object or array, pass{ compare: shallow }or the ref updates on every notification. Primitive selectors need no custom compare. - Call the hooks inside component setup or another effect scope.
useSelectorunsubscribes viaonScopeDispose(src/useSelector.ts:54-56); outside a scope, cleanup never runs. - Returned refs are
readonly. Write throughstore.setState,atom.set, storeactions, or the second tuple element ofuseAtom/_useStore. - Keep selectors cheap. The selector runs on every notification of the source (
src/useSelector.ts:46-52); move expensive computation into a derivedcreateStore. - Do not import
createStoreContextfrom this package. The 0.11.0 release notes list it, but the 0.11.1 source exports onlyuseSelector,useAtom,useStore,_useStoreplus the core re-export (src/index.ts,dist/index.d.ts). See release 0.11.0.
Core re-exports from @tanstack/store
createStore(initialValue)->Store<T>;createStore((prev?) => T)->ReadonlyStore<T>(derived);createStore(initialValue, actionsFactory)->Store<T, TActions>with typedstore.actions.Store:stategetter,get(),setState(updater),subscribe(observerOrFn)returning{ unsubscribe }, boundactions.ReadonlyStoreomitssetStateandactions.createAtom(initialValue)-> writableAtom<T>;createAtom(fn)-> computedReadonlyAtom<T>.AtomOptions.comparecontrols change detection.createAsyncAtom(() => Promise<T>)->ReadonlyAtomof a{ status }discriminated union:'pending' | 'done' | 'error'.batch(fn)groups updates into one notification cycle;flush()drains pending effects.shallow(a, b)comparesObject.is, then Map and Set contents, Date timestamps, and own keys including symbols.toObserver()normalizes callbacks or RxJS-style observers forsubscribe.- Types:
Observer,Subscription,Subscribable,Readable,Atom,ReadonlyAtom,AtomOptions,StoreActionMap,StoreActionsFactory, and others.
Full surface with cautions: core API reference
Best practices
- Use
useSelector, never the deprecateduseStore, for new code (src/useSelector.ts:39). - Define stores in plain modules outside components. This is the documented sharing pattern (Vue quick start).
- Select fine-grained slices. The component re-renders only when the selected value changes.
- Write state through
store.setState((prev) => next)updater functions; updates are immutable. - Group multiple updates in
batch(() => { ... })so subscribers notify once with the final state. - Derive with
createStore(() => ...); derived stores recompute when dependencies change, andprevaccumulates values. - Co-locate writes with an actions factory so
_useStorereturns typed actions (src/_useStore.ts:37-38). - Use
createAsyncAtomfor async data instead of hand-rolled pending and error flags. - Observe state outside components with
store.subscribe(() => ...); it returns{ unsubscribe }.
Recipes and full examples: patterns reference
Migration
Version-specific changes and upgrade steps, most recent first: migration reference
Highlights:
- 0.11.x:
useSelectorintroduced as primary hook;useStoredeprecated; default compare is===, replacing the pre-0.11shallowdefault and{ equal }option. - 0.9.0 breaking:
new Store()->createStore();new Derived()-> derivedcreateStore(fn);new Effect()removed in favor ofstore.subscribe().
Environment
- Vue
^3.0.0or^2.5.0throughvue-demi. Vue 2 needs the optional peer@vue/composition-api@^1.2.1(package.json:50-58). - Exact core pin
@tanstack/store@0.11.1; core APIs are re-exported, so no separate core install is needed in Vue apps. - Dual format: ESM via the
importcondition (dist/index.js), CJS viarequire(dist/index.cjs); types atdist/index.d.cts;sideEffects: false. - TypeScript 5.6 through 5.9 are tested (package.json:62-66).
FAQ
What does the tanstack-vue-store-skilld skill do?
Vue adapter for TanStack Store, a framework agnostic type-safe store. ALWAYS use when writing code importing "@tanstack/vue-store" in a Vue app. Covers the useSelector, useAtom, useStore (deprecated), and useStore hooks, the re-exported @tanstack/store core API (createStore, createAtom, createAsyncAtom, batch, flush, shallow), debugging, best practices, and migration between @tanstack/vue-store versions.
How do I install tanstack-vue-store-skilld?
Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-vue-store-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tanstack-vue-store-skilld/ (personal) or .claude/skills/tanstack-vue-store-skilld/ (project).
Which AI agents can use tanstack-vue-store-skilld?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is tanstack-vue-store-skilld safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains tanstack-vue-store-skilld?
It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 99 recorded installs.
More from skilld-dev/vue-ecosystem-skills
quasar-skilld
skilld-dev/vue-ecosystem-skills
Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.
vue-i18n-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vuetify-skilld
skilld-dev/vue-ecosystem-skills
Vue Material Component Framework. Use when writing, debugging, or configuring code that imports vuetify v4.x. Covers createVuetify setup, components and labs, composables, theming, icons, dates and locale, styles and SASS variables, treeshaking, and v3 to v4 migration.
pinia-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-router-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.