Create and maintain Pinia stores using the Setup Stores pattern with TypeScript. Use when creating state management stores, defining store state/getters/actions, composing stores, or integrating with Vue components. Handles store architecture, type safety, and reactive state patterns.
Use this skill when you need to:
storeName.ts: Store definition with state, getters, and actionsstores/ directory (e.g., stores/user.ts, stores/cart.ts)use<Name>Store naming convention (e.g., useUserStore, useCartStore)Follow these steps to create a new Pinia store:
Create store file: stores/storeName.ts
Define the store using Setup Store pattern:
defineStore from Piniaref, computed from Vueref() valuescomputed() propertiesAdd TypeScript types:
Handle async operations (if needed):
Understand current state:
Make changes:
Update consumers:
<script setup lang="ts">
import { useCounterStore } from '@/stores/counter'
import { storeToRefs } from 'pinia'
const store = useCounterStore()
// Destructure reactive state/getters with storeToRefs
const { count, doubleCount } = storeToRefs(store)
// Actions can be destructured directly
const { increment, reset } = store
</script>
Before completing work on any store, verify:
computed() for reactivityuse<Name>Store)storeToRefs() for destructuring stateNaming:
'user-settings')use<Name>Store pattern (useUserSettingsStore)items, currentUser, isLoading)is/has/get (isLoggedIn, totalItems)fetchUser, addItem, reset)State Management:
shallowRef() for large objects that don't need deep reactivityComposition:
Type Safety:
any and unknown typesNote:
references/ directory.assets/ directory.Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer