Pinia — Claude Code skill: Vue state management
Pinia skill adds reference documentation to Claude Code for the official Vue state management library. Use it when defining stores, managing state, getters, and actions in Vue apps.
npx skills add antfu/skills --skill pinia -a claude-codeWhat pinia does
Pinia is Vue's official state management library, built with TypeScript support and compatibility for both Options API and Composition API. The skill equips the agent with guides on store definition, reactive state destructuring via storeToRefs(), action creation, and plugin-based extensibility.
The skill includes references on core concepts (stores, state, getters, actions, subscriptions), plugins, composables integration, store-to-store communication, unit testing with @pinia/testing, and Nuxt integration. For SSR, always call stores inside functions rather than at module scope.
Available on Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode. Installation uses npx skills add with a platform flag.
What it helps with
- set up a store with state and actions
- destructure state while keeping reactivity intact
- coordinate communication between multiple stores
- test components with mocked Pinia stores
- integrate Pinia with Nuxt and server-side rendering
Example prompts for the agent
- Create a user store with state and an action to fetch user data
- Show me how to destructure state from a store without breaking reactivity
- Write a test for a Vue component that uses a Pinia store
How to install pinia
1Skills CLI (Vercel)
npx skills add antfu/skills --skill pinia -a claude-code2Manually: put the files in place
~/.claude/skills/pinia/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pinia/
1Skills CLI (Vercel)
npx skills add antfu/skills --skill pinia -a codex2Manually: put the files in place
.agents/skills/pinia/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add antfu/skills --skill pinia -a cursor2Manually: put the files in place
.cursor/skills/pinia/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install antfu/skills pinia2Manually: put the files in place
.github/skills/pinia/SKILL.md1Skills CLI (Vercel)
npx skills add antfu/skills --skill pinia -a gemini-cli2Platform CLI
gemini skills install https://github.com/antfu/skills --path skills/piniaManually: put the files in place
.devin/skills/pinia/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add antfu/skills --skill pinia -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set7
The whole set →Similar
Questions about pinia
How do I install Pinia skill in Claude Code?
Run npx skills add antfu/skills --skill pinia -a claude-code. The skill loads into ~/.claude/skills/pinia/SKILL.md and becomes available to the agent.
What does the Pinia skill do?
The skill provides reference docs for Pinia v4.0.3: how to define stores, work with state and actions, extend with plugins, test components, and integrate with Nuxt and SSR.
Do I need to set anything up before using the skill?
The skill is documentation only. To use Pinia in your project, install Vue and Pinia as npm packages.
Source text
SKILL.md · MIT
--- name: pinia description: 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. metadata: author: Anthony Fu version: "2026.9.25" source: Generated from https://github.com/vuejs/pinia, scripts located at https://github.com/antfu/skills --- # Pinia Pinia is the official state management library for Vue, designed to be intuitive and type-safe. It supports both Options API and Composition API styles, with first-class TypeScript support and devtools integration. > The skill is based on Pinia v4.0.3, generated at 2026-09-25. ## Core References | Topic | Description | Reference | |-------|-------------|-----------| | Stores | Defining stores, state, getters, actions, storeToRefs, subscriptions | [core-stores](references/core-stores.md) | ## Features ### Extensibility | Topic | Description | Reference | |-------|-------------|-----------| | Plugins | Extend stores with custom properties, state, and behavior | [features-plugins](references/features-plugins.md) | ### Composability | Topic | Description | Reference | |-------|-------------|-----------| | Composables | Using Vue composables within stores (VueUse, etc.) | [features-composables](references/features-composables.md) | | Composing Stores | Store-to-store communication, avoiding circular dependencies | [features-composing-stores](references/features-composing-stores.md) | ## Best Practices | Topic | Description | Reference | |-------|-------------|-----------| | Testing | Unit testing with @pinia/testing, mocking, stubbing | [best-practices-testing](references/best-practices-testing.md) | | Outside Components | Using stores in navigation guards, plugins, middlewares | [best-practices-outside-component](references/best-practices-outside-component.md) | ## Advanced | Topic | Description | Reference | |-------|-------------|-----------| | SSR | Server-side rendering, state hydration | [advanced-ssr](references/advanced-ssr.md) | | Nuxt | Nuxt integration, auto-imports, SSR best practices | [advanced-nuxt](references/advanced-nuxt.md) | | HMR | Hot module replacement for development | [advanced-hmr](references/advanced-hmr.md) | ## Key Recommendations - **Prefer Setup Stores** for complex logic, composables, and watchers - **Use `storeToRefs()`** when destructuring state/getters to preserve reactivity - **Actions can be destructured directly** - they're bound to the store - **Call stores inside functions** not at module scope, especially for SSR - **Add HMR support** to each store for better development experience - **Use `@pinia/testing`** for component tests with mocked stores
© Anthony Fu · MIT · antfu/skills