pinia

antfu/skills · Agent Skill

Pinia state management best practices for type-safe Vue stores, getters, and actions.

Jump to install ↓

Overview

PublisherantfuCommunity
Repositoryantfu/skills ↗
Skill folderpinia
Stars6,011
Forks338
Bundled files11
LicenseMIT
Last updatedOctober 23, 2026
LinksSkill source ↗ · Repository ↗

Mozgi check

What we found in the skill files. Details come with a subscription.

Security
low risk · no obvious risks found — the full report shows the details
Compatibility
instructions only — works with most agents
Similar skills
62 similar skills found
Also with subscription

Installation

A skill is a folder with a SKILL.md file. Pick your agent and run the commands in a terminal (macOS, Linux or Git Bash on Windows) from your project root.

Copy the prompt into Claude, Codex or another assistant: it will review the skill and install it for you.

Install the “pinia” skill from mozgi.io (https://mozgi.io/skills/antfu-pinia/) for me.

1. Download the archive: https://mozgi.io/skills/antfu-pinia/download
   If it fails, take the skill folder from the source: https://github.com/antfu/skills/tree/main/skills/pinia
2. Read SKILL.md and the other files. Check the skill is safe: no hidden commands, no sending data elsewhere, no scripts doing something other than described. If anything looks suspicious, stop and tell me.
3. Put the “pinia” folder into your agent's skills folder: .claude/skills/ for Claude Code, .agents/skills/ for Codex, .cursor/skills/ for Cursor, .gemini/skills/ for Gemini CLI. Inside the project if we are in one, otherwise in the home folder (~/.claude/skills/ etc.).
4. Make sure <skills folder>/pinia/SKILL.md exists.
5. Briefly tell me what this skill does and offer to try it on my task.

If you cannot do a step yourself, tell me what to click or type.

Review the source files

11 files Download Zip

Read SKILL.md and any companion files before deciding whether to install. Click a file to preview it.

SKILL.md contents

Original author text · read-only

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 ↗ |

Features

Extensibility

| Topic | Description | Reference |

|-------|-------------|-----------|

| Plugins | Extend stores with custom properties, state, and behavior | features-plugins ↗ |

Composability

| Topic | Description | Reference |

|-------|-------------|-----------|

| Composables | Using Vue composables within stores (VueUse, etc.) | features-composables ↗ |

| Composing Stores | Store-to-store communication, avoiding circular dependencies | features-composing-stores ↗ |

Best Practices

| Topic | Description | Reference |

|-------|-------------|-----------|

| Testing | Unit testing with @pinia/testing, mocking, stubbing | best-practices-testing ↗ |

| Outside Components | Using stores in navigation guards, plugins, middlewares | best-practices-outside-component ↗ |

Advanced

| Topic | Description | Reference |

|-------|-------------|-----------|

| SSR | Server-side rendering, state hydration | advanced-ssr ↗ |

| Nuxt | Nuxt integration, auto-imports, SSR best practices | advanced-nuxt ↗ |

| HMR | Hot module replacement for development | advanced-hmr ↗ |

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

Frequently asked questions

What does the pinia skill do?

Pinia state management best practices for type-safe Vue stores, getters, and actions.

How do I install pinia?

Open the “Installation” block on this page and pick your agent — Claude Code, Codex, Cursor or Gemini CLI — for ready-made commands that copy the skill folder to the right place. Or copy the prompt from the “Via assistant” tab and let the assistant review and install the skill.

Which AI models work with pinia?

Skills are plain Markdown instructions (the Agent Skills format), so pinia works with any agent that reads SKILL.md: Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and more. The model loads the instructions only when a task matches the skill's description.

Is pinia free?

The skill is published openly by antfu under the MIT license. The skill itself costs nothing — you only pay your AI provider for the tokens you use.

Is it safe to install skills?

A skill is a set of instructions your agent will follow, so read SKILL.md and its companion files before installing. Scripts in the skill folder only run if your agent runs them — keep an eye on what it does and do not grant unnecessary permissions.

How is a skill different from an MCP server or a plugin?

An MCP server or plugin gives the model new tools — code that runs and returns a result. A skill gives it knowledge and process: how to approach a task, which steps to follow and what good output looks like. It needs no server or API key.

Related skills

All skills →