Agent skill

Vue Pinia

by Mindrally in Mindrally/skills

Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing.

Apache-2.0Auto-check passedDevelopment

Install Vue Pinia

skills CLI
$ npx skills add Mindrally/skills --skill vue-pinia -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Mindrally/skills vue-pinia --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Mindrally/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/vue-pinia .claude/skills/vue-pinia && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
vue-pinia
GitHub stars
271
Token cost
~2.4k tokens
SKILL.md length
1,004 words
Files
1
Skills in repo
34
Repo updated
First seen
Licence
Apache-2.0

At a glance

Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing.

  • Works in 7 steps: Decide if Pinia is the right tool —… → Create the store file — Add one file per… → Define state, getters, and actions —… → …
  • Refactoring Pinia stores
  • SKILL.md covers Workflow for Adding a Pinia…, State Ownership, Store Structure and Component Usage, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Vue Pinia is an agent skill from Mindrally/skills. Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing. Use when creating or refactoring Pinia stores, deciding what state belongs in a store versus a component, wiring stores into router guards, persisting store state to storage, or testing store actions with @pinia/testing.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering State management and Refactoring. It works with Vue.js and Nuxt. The repository describes itself as: 265+ Claude Code skills for every major framework and language. Install with: npx skills add Mindrally/skills. The licence is Apache-2.0.

When your agent uses it

  • Refactoring Pinia stores
  • Deciding what state belongs in a store versus a component
  • Wiring stores into router guards
  • Persisting store state to storage

Example prompts

  • “/vue-pinia”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Decide if Pinia is the right tool — Confirm the state is shared across routes/components, not server cache data, and not purely local UI…
  2. Create the store file — Add one file per domain under stores/, e.g. stores/cart.ts, using defineStore('cart', () => { ... }).
  3. Define state, getters, and actions — Declare state with ref/reactive, derive values with computed, and put all writes/side effects in…
  4. Return everything from the setup function — Return every piece of state, every getter, and every action so Pinia devtools, SSR, and…
  5. Consume in components — Call the store at the top of , destructure reactive state with storeToRefs()`, and destructure actions directly.
  6. Handle SSR/router-guard usage — Call the store from inside setup, a getter, an action, or pass the active Pinia instance explicitly…
  7. Add persistence and tests — Allowlist persisted fields, validate rehydrated data, and test actions directly with @pinia/testing.

What it can do on your machine

Read from SKILL.md and the folder at commit 7682ca7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript and vue).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Vue Pinia loads about 2.4k tokens when it runs. Until then it costs about 91 tokens; SKILL.md has 1,004 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~91
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Mindrally/skills at commit 7682ca7, republished under its Apache-2.0 licence (© Mindrally). 1,004 words, ~2,427 tokens.

Download SKILL.mdSave it as .claude/skills/vue-pinia/SKILL.md (or your agent's skills folder).
name
vue-pinia
description
Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing. Use when creating or refactoring Pinia stores, deciding what state belongs in a store versus a component, wiring stores into router guards, persisting store state to storage, or testing store actions with @pinia/testing.
metadata.maintainer
Mindrally
metadata.source
https://github.com/Mindrally/skills

Vue + Pinia

Pinia is the standard state management library for Vue 3, and setup stores built with the Composition API give shared application state the same ergonomics as local ref/computed state.

Workflow for Adding a Pinia Store

  1. Decide if Pinia is the right tool — Confirm the state is shared across routes/components, not server cache data, and not purely local UI state (see State Ownership below).
  2. Create the store file — Add one file per domain under stores/, e.g. stores/cart.ts, using defineStore('cart', () => { ... }).
  3. Define state, getters, and actions — Declare state with ref/reactive, derive values with computed, and put all writes/side effects in functions (actions).
  4. Return everything from the setup function — Return every piece of state, every getter, and every action so Pinia devtools, SSR, and plugins can track them.
  5. Consume in components — Call the store at the top of <script setup>, destructure reactive state with storeToRefs(), and destructure actions directly.
  6. Handle SSR/router-guard usage — Call the store from inside setup, a getter, an action, or pass the active Pinia instance explicitly outside setup contexts.
  7. Add persistence and tests — Allowlist persisted fields, validate rehydrated data, and test actions directly with @pinia/testing.

State Ownership

  • Keep component-only state in the component with ref, reactive, or computed.
  • Use Pinia for shared client state that spans routes, layouts, or unrelated component trees.
  • Use route params and query strings for shareable navigation state — don't duplicate it into a store.
  • Use Nuxt useFetch / useAsyncData, TanStack Query for Vue, or the existing API layer for server state — Pinia is for client state, not a data-fetching cache.
  • Do not copy server cache data into Pinia unless it is an intentional editable draft, offline cache, or workflow snapshot with its own lifecycle.

Store Structure

  • Prefer setup stores with defineStore('name', () => { ... }) for Vue 3 Composition API projects over the older options-API defineStore({ state, getters, actions }) form.
  • Use one store file per domain under stores/, such as stores/cart.ts or stores/session.ts.
  • Keep state, computed getters, and actions together when they represent one cohesive domain.
  • Return every state property from setup stores so Pinia can track it for devtools, SSR, and plugins — an un-returned ref is invisible to the rest of the system.
  • Keep getters pure and side-effect free; put writes, I/O, and orchestration in actions.
ts
// stores/cart.ts
import { computed, ref } from 'vue'
import { defineStore } from 'pinia'

interface CartLine {
  id: string
  name: string
  quantity: number
  unitPrice: number
}

export const useCartStore = defineStore('cart', () => {
  const lines = ref<CartLine[]>([])

  const itemCount = computed(() =>
    lines.value.reduce((total, line) => total + line.quantity, 0),
  )

  const subtotal = computed(() =>
    lines.value.reduce((total, line) => total + line.quantity * line.unitPrice, 0),
  )

  function addLine(line: CartLine) {
    const existing = lines.value.find((item) => item.id === line.id)
    if (existing) {
      existing.quantity += line.quantity
      return
    }
    lines.value.push(line)
  }

  function removeLine(id: string) {
    lines.value = lines.value.filter((line) => line.id !== id)
  }

  function clearCart() {
    lines.value = []
  }

  return {
    lines,
    itemCount,
    subtotal,
    addLine,
    removeLine,
    clearCart,
  }
})

Component Usage

  • Call stores at the top of <script setup> or inside setup functions, getters, and actions — never conditionally, and never inside a plain .js/.ts module loaded at import time.
  • Use storeToRefs() when destructuring store state or getters in components, so reactivity is preserved.
  • Destructure actions directly when useful; actions remain bound to the store and don't need storeToRefs().
  • Avoid writing large business workflows in components; move them to store actions or composables so they're testable and reusable.
  • Prefer computed values over watchers when deriving state — a watch that just recomputes a value should usually be a computed.
vue
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { useCartStore } from '@/stores/cart'

const cart = useCartStore()
const { itemCount, subtotal } = storeToRefs(cart)
const { clearCart } = cart
</script>

<template>
  <div>
    <p>{{ itemCount }} items — ${{ subtotal.toFixed(2) }}</p>
    <button type="button" :disabled="itemCount === 0" @click="clearCart">
      Clear cart
    </button>
  </div>
</template>

TypeScript

  • Type store state, action payloads, and API responses explicitly.
  • Avoid any; use unknown and narrow external inputs (API responses, persisted storage) before committing them to state.
  • Use interfaces for object state that is shared across components or API boundaries.
  • Prefer discriminated unions for workflow status and error state, e.g. { status: 'idle' } | { status: 'loading' } | { status: 'error'; error: string }.
  • Keep store IDs (the first argument to defineStore) stable and descriptive because they appear in devtools and persistence keys.

Actions and Side Effects

  • Actions may be sync or async; keep each action focused on one user or domain workflow.
  • Validate action inputs at the boundary before mutating store state.
  • Represent async workflows with explicit status, error, and lastUpdatedAt fields when the UI depends on them.
  • Reset stale errors before retrying an async action so a previous failure doesn't linger in the UI.
  • Keep subscriptions, intervals, sockets, and browser listeners outside stores unless the store owns their lifecycle and cleanup (e.g. an explicit connect()/disconnect() action pair).
Show full SKILL.md (369 more words)Show less

SSR, Nuxt, and Router Guards

  • In SSR contexts, use the store inside setup, getters, or actions so Pinia can resolve the active app instance.
  • When using a store outside setup, such as in a router guard, pass the active Pinia instance if the framework requires it (Nuxt's auto-imports handle this automatically).
  • Do not read browser-only storage (localStorage, window) during server rendering — guard with import.meta.client (Nuxt) or an onMounted check.
  • In Nuxt, prefer the @pinia/nuxt integration and SSR-safe composables for data fetching instead of manually wiring a Pinia instance.
  • Avoid singleton state leaks across requests by relying on the framework-created Pinia instance per request rather than a module-level singleton.
ts
// router guard example (outside setup)
router.beforeEach((to) => {
  const auth = useAuthStore(pinia) // pass the active Pinia instance explicitly
  if (to.meta.requiresAuth && !auth.isAuthenticated) {
    return { name: 'login' }
  }
})

Persistence

  • Persist only the fields that must survive reloads, such as preferences or incomplete local drafts.
  • Never persist secrets, access tokens, refresh tokens, raw PII, or authorization decisions in browser storage.
  • Use field allowlists and versioned migrations for persisted store schemas so old persisted shapes don't crash a new store version.
  • Treat persisted state as untrusted input and validate it before using it for critical workflows — a user can edit localStorage directly.
  • Account for hydration timing before rendering UI that depends on persisted values, especially under SSR where the server has no access to browser storage.

Testing and Tooling

  • Use @pinia/testing (createTestingPinia()) for component tests that need stores, with actions stubbed by default.
  • Test store actions directly for domain behavior and edge cases, independent of any component.
  • Reset Pinia between tests to avoid shared state leakage across test cases.
  • Add HMR support with acceptHMRUpdate() in stores when the project uses Vite HMR patterns.
  • Keep stores easy to inspect in Vue Devtools by using clear state names and focused, single-domain stores.
ts
import { setActivePinia, createPinia } from 'pinia'
import { describe, it, expect, beforeEach } from 'vitest'
import { useCartStore } from '@/stores/cart'

describe('cart store', () => {
  beforeEach(() => {
    setActivePinia(createPinia())
  })

  it('merges quantities for duplicate line items', () => {
    const cart = useCartStore()
    cart.addLine({ id: '1', name: 'Widget', quantity: 1, unitPrice: 10 })
    cart.addLine({ id: '1', name: 'Widget', quantity: 2, unitPrice: 10 })
    expect(cart.itemCount).toBe(3)
  })
})

Anti-Patterns

  • Do not use Pinia as a dumping ground for every reactive value — most component state should stay local.
  • Do not destructure state directly from a store without storeToRefs(); this breaks reactivity silently.
  • Do not mutate props or route objects through store actions.
  • Do not put server-only objects, request instances, DOM nodes, or timers in store state — they don't serialize and break SSR/devtools.
  • Do not create circular reads between stores in setup functions; compose stores through actions or computed values instead of having two stores read each other at module scope.

© Mindrally, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in vue-pinia of Mindrally/skills.

Open the folder on GitHubat commit 7682ca7

Compare with similar skills

Vue Pinia next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Vue Pinia compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Vue Pinia this skillMindrally/skills271—~2.4kAutomated safety check: PassApache-2.0
Vue Best Practicesvinayakkulkarni/nxui213—~871Automated safety check: PassMIT
PiniaJetBrains/skills3669 repos~682Automated safety check: PassNone
Enforce Rules For Unocssmoeru-ai/airi50k—~525Automated safety check: PassMIT
Frontend UI Foundryjiushiwon/wg-skills114—~1.4kAutomated safety check: PassApache-2.0
Cabloy Frontend Scaffoldcabloy/cabloy982—~4.1kAutomated safety check: PassMIT

Similar skills

  • Vue Best Practices

    vinayakkulkarni/nxui

    Vue.js performance optimization guidelines for building fast, maintainable applications.

    213 GitHub stars~871 tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Pinia

    JetBrains/skills

    Official

    Pinia official Vue state management library, type-safe and extensible.

    366 GitHub starsUsed in 9 repos~682 tokens
    Frontend & DesignAuto-check passed
  • Enforce AIRI's UnoCSS, Vue styling, shared UI component, animation, icon, and color-mode practices.

    50k GitHub stars~525 tokensUpdated today
    DevelopmentAuto-check passed
  • Frontend UI Foundry

    jiushiwon/wg-skills

    A skill your agent uses when generating UI for a specific scenario (mobile/PC/官网/管理端/营销页/文档/金融/原生/3D), when refactoring an existing HTML/Vue/React project to a unified design system, when extracting…

    114 GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • A skill your agent uses whenever the user wants the Zova frontend path in this Cabloy repo: create or extend pages, components, api or model beans, route/query/params work, metadata refresh…

    982 GitHub stars~4.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Vue Expert

    Jeffallan/claude-skills

    Builds Vue 3 apps with the Composition API and script setup, Pinia state, Nuxt 3, Vite tuning and Quasar or Capacitor mobile builds, checked with vue-tsc and Vitest.

    12k GitHub stars~1.1k tokensUpdated 7 days ago
    Frontend & DesignAuto-check passed

More from Mindrally/skills

All 34 skills in this repo
  • Analytics Data Analysis

    Mindrally/skills

    Best practices for analytics, data analysis, and visualization using Python, pandas, matplotlib, seaborn, and Jupyter notebooks.

    271 GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed
  • Best practices for AutoML and hyperparameter search with Optuna, Ray Tune, and PyCaret, covering search-space design, validation splits, and leakage prevention.

    271 GitHub stars~2.5k tokensUpdated 2 days ago
    Auto-check passed
  • Blender Python Addon

    Mindrally/skills

    Best practices for writing Blender Python add-ons using the bpy API, covering operators, panels, properties, registration, and API-safe scripting.

    271 GitHub stars~2.2k tokensUpdated 2 days ago
    Auto-check passed
  • Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices.

    271 GitHub stars~1.7k tokensUpdated 2 days ago
    Auto-check passed
  • Clean Code

    Mindrally/skills

    Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested.

    271 GitHub stars~1.8k tokensUpdated 2 days ago
    Auto-check passed
  • Design Systems

    Mindrally/skills

    Comprehensive design system guidelines for building consistent, accessible, and scalable component libraries.

    271 GitHub stars~1.8k tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Vue Pinia

What does Vue Pinia do?

Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing. Vue Pinia is an agent skill from Mindrally/skills. Vue 3 state management with Pinia using the Composition API, covering setup stores, SSR/Nuxt integration, persistence, and testing.

When should I use Vue Pinia?

Vue Pinia fits situations like: refactoring Pinia stores; deciding what state belongs in a store versus a component; wiring stores into router guards; persisting store state to storage.

How do I install Vue Pinia in Claude Code?

Run `npx skills add Mindrally/skills --skill vue-pinia -a claude-code`. Or copy the skill folder (vue-pinia in Mindrally/skills) into .claude/skills/vue-pinia in your project. Claude Code loads it when a task matches its description.

How do I install Vue Pinia in Codex?

Run `npx skills add Mindrally/skills --skill vue-pinia -a codex`. Or copy the skill folder (vue-pinia in Mindrally/skills) into .agents/skills/vue-pinia in your project. Codex loads it when a task matches its description.

Can I use Vue Pinia in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Mindrally/skills --skill vue-pinia -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/vue-pinia, .gemini/skills/vue-pinia, .github/skills/vue-pinia and .opencode/skills/vue-pinia in your project.

What does Vue Pinia need to run?

SKILL.md names no scripts, command-line tools or credentials: Vue Pinia is instructions for the agent only.

Does Vue Pinia access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Vue Pinia safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Vue Pinia use?

Vue Pinia is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Vue Pinia use?

About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Vue Pinia?

Skills that share tags, products or a category with Vue Pinia: Vue Best Practices (vinayakkulkarni/nxui, 213 stars), Pinia (JetBrains/skills, 366 stars), Enforce Rules For Unocss (moeru-ai/airi, 50k stars) and Frontend UI Foundry (jiushiwon/wg-skills, 114 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Vue Pinia?

Mindrally (a GitHub organization) maintains it in Mindrally/skills, which has 271 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on October 8, 2026.

Source: Mindrally/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.