All skills
onmax avatar

/pinia

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/pinia

This session only. Nothing lands on disk.

referencesadvanced-hmr.md

≈347 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Hot Module Replacement (HMR)

Pinia supports HMR to edit stores without page reload, preserving existing state.

Setup

Add this snippet after each store definition:

import { defineStore, acceptHMRUpdate } from 'pinia'

export const useAuth = defineStore('auth', {
  // store options...
})

if (import.meta.hot) {
  import.meta.hot.accept(acceptHMRUpdate(useAuth, import.meta.hot))
}

Setup Store Example

import { defineStore, acceptHMRUpdate } from 'pinia'

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const increment = () => count.value++
  return { count, increment }
})

if (import.meta.hot) {
  import.meta.hot.accept(acceptHMRUpdate(useCounterStore, import.meta.hot))
}

Bundler Support

  • Vite: Officially supported via import.meta.hot
  • Webpack: Uses import.meta.webpackHot
  • Any bundler implementing the import.meta.hot spec should work

Nuxt

With @pinia/nuxt, acceptHMRUpdate is auto-imported but you still need to add the HMR snippet manually.

Benefits

  • Edit store logic without losing state
  • Add/remove state, actions, and getters on the fly
  • Faster development iteration
<!-- Source references: - https://pinia.vuejs.org/cookbook/hot-module-replacement.html -->

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The skill provides comprehensive documentation and best practices for the Pinia state management library. It covers defining stores, using plugins, SSR hydration, and unit testing. No malicious patterns or security risks were identified; the skill includes security-conscious recommendations like using 'devalue' for XSS-safe serialization during server-side rendering.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Anthony Fu",
  "version": "2026.1.28",
  "source": "Generated from https://github.com/vuejs/pinia, scripts located at https://github.com/antfu/skills"
}

README badge

README badge for onmax/nuxt-skills/pinia