{"id":"baa5a048-ca74-4741-bf36-6b3abb819c86","shortId":"JL4VYU","kind":"skill","title":"Pinia","tagline":"Skills skill by Antfu","description":"# Pinia\n\nPinia 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.\n\n> The skill is based on Pinia v3.0.4, generated at 2026-01-28.\n\n## Core References\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| Stores | Defining stores, state, getters, actions, storeToRefs, subscriptions | [core-stores](references/core-stores.md) |\n\n## Features\n\n### Extensibility\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| Plugins | Extend stores with custom properties, state, and behavior | [features-plugins](references/features-plugins.md) |\n\n### Composability\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| Composables | Using Vue composables within stores (VueUse, etc.) | [features-composables](references/features-composables.md) |\n| Composing Stores | Store-to-store communication, avoiding circular dependencies | [features-composing-stores](references/features-composing-stores.md) |\n\n## Best Practices\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| Testing | Unit testing with @pinia/testing, mocking, stubbing | [best-practices-testing](references/best-practices-testing.md) |\n| Outside Components | Using stores in navigation guards, plugins, middlewares | [best-practices-outside-component](references/best-practices-outside-component.md) |\n\n## Advanced\n\n| Topic | Description | Reference |\n|-------|-------------|-----------|\n| SSR | Server-side rendering, state hydration | [advanced-ssr](references/advanced-ssr.md) |\n| Nuxt | Nuxt integration, auto-imports, SSR best practices | [advanced-nuxt](references/advanced-nuxt.md) |\n| HMR | Hot module replacement for development | [advanced-hmr](references/advanced-hmr.md) |\n\n## Key Recommendations\n\n- **Prefer Setup Stores** for complex logic, composables, and watchers\n- **Use `storeToRefs()`** when destructuring state/getters to preserve reactivity\n- **Actions can be destructured directly** - they're bound to the store\n- **Call stores inside functions** not at module scope, especially for SSR\n- **Add HMR support** to each store for better development experience\n- **Use `@pinia/testing`** for component tests with mocked stores","tags":["pinia","skills","antfu"],"capabilities":["skill","source-antfu","category-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/antfu/skills/pinia","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"install_from":"skills.sh"}},"qualityScore":"0.300","qualityRationale":"deterministic score 0.30 from registry signals: · indexed on skills.sh · published under antfu/skills","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill:v1","enrichmentVersion":1,"enrichedAt":"2026-04-23T22:40:13.962Z","embedding":null,"createdAt":"2026-04-18T20:25:28.146Z","updatedAt":"2026-04-23T22:40:13.962Z","lastSeenAt":"2026-04-23T22:40:13.962Z","tsv":"'-01':52 '-28':53 '2026':51 'action':64,209 'add':231 'advanc':152,164,177,187 'advanced-hmr':186 'advanced-nuxt':176 'advanced-ssr':163 'antfu':5 'api':28,31 'auto':171 'auto-import':170 'avoid':112 'base':45 'behavior':84 'best':120,133,147,174 'best-practices-outside-compon':146 'best-practices-test':132 'better':238 'bound':216 'call':220 'category-skills' 'circular':113 'class':36 'communic':111 'complex':196 'compon':138,150,244 'compos':89,93,96,103,105,117,198 'composit':30 'core':54,68 'core-stor':67 'custom':80 'defin':60 'depend':114 'descript':57,74,91,123,154 'design':16 'destructur':204,212 'develop':185,239 'devtool':40 'direct':213 'especi':228 'etc':100 'experi':240 'extend':77 'extens':72 'featur':71,86,102,116 'features-compos':101 'features-composing-stor':115 'features-plugin':85 'first':35 'first-class':34 'function':223 'generat':49 'getter':63 'guard':143 'hmr':180,188,232 'hot':181 'hydrat':162 'import':172 'insid':222 'integr':41,169 'intuit':19 'key':190 'librari':13 'logic':197 'manag':12 'middlewar':145 'mock':130,247 'modul':182,226 'navig':142 'nuxt':167,168,178 'offici':10 'option':27 'outsid':137,149 'pinia':1,6,7,47 'pinia/testing':129,242 'plugin':76,87,144 'practic':121,134,148,175 'prefer':192 'preserv':207 'properti':81 're':215 'reactiv':208 'recommend':191 'refer':55,58,75,92,124,155 'references/advanced-hmr.md':189 'references/advanced-nuxt.md':179 'references/advanced-ssr.md':166 'references/best-practices-outside-component.md':151 'references/best-practices-testing.md':136 'references/core-stores.md':70 'references/features-composables.md':104 'references/features-composing-stores.md':119 'references/features-plugins.md':88 'render':160 'replac':183 'safe':23 'scope':227 'server':158 'server-sid':157 'setup':193 'side':159 'skill':2,3,43 'source-antfu' 'ssr':156,165,173,230 'state':11,62,82,161 'state/getters':205 'store':59,61,69,78,98,106,108,110,118,140,194,219,221,236,248 'store-to-stor':107 'storetoref':65,202 'stub':131 'style':32 'subscript':66 'support':25,38,233 'test':125,127,135,245 'topic':56,73,90,122,153 'type':22 'type-saf':21 'typescript':37 'unit':126 'use':94,139,201,241 'v3.0.4':48 'vue':15,95 'vueus':99 'watcher':200 'within':97","prices":[{"id":"ae47c10b-d389-4eb8-ac8c-e54f4d79e719","listingId":"baa5a048-ca74-4741-bf36-6b3abb819c86","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"antfu","category":"skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:25:28.146Z"}],"sources":[{"listingId":"baa5a048-ca74-4741-bf36-6b3abb819c86","source":"github","sourceId":"antfu/skills/pinia","sourceUrl":"https://github.com/antfu/skills/tree/main/skills/pinia","isPrimary":false,"firstSeenAt":"2026-04-18T21:53:47.615Z","lastSeenAt":"2026-04-23T18:53:29.398Z"},{"listingId":"baa5a048-ca74-4741-bf36-6b3abb819c86","source":"skills_sh","sourceId":"antfu/skills/pinia","sourceUrl":"https://skills.sh/antfu/skills/pinia","isPrimary":true,"firstSeenAt":"2026-04-18T20:25:28.146Z","lastSeenAt":"2026-04-23T22:40:13.962Z"}],"details":{"listingId":"baa5a048-ca74-4741-bf36-6b3abb819c86","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"antfu","slug":"pinia","source":"skills_sh","category":"skills","skills_sh_url":"https://skills.sh/antfu/skills/pinia"},"updatedAt":"2026-04-23T22:40:13.962Z"}}