---
name: pinia-store-47edfcbc5267
description: >-
  Use when 新增或修改 Pinia store。NOT for server 端狀態或 API handler（走 server-api），NOT for
  單一元件內的區域狀態（直接用 ref／reactive）。
---


# Pinia Store

標準 setup store、`storeToRefs`、命名 `use<Name>Store` 照 Pinia 官方寫法即可；本 skill 只放與預設不同的慣例。

# SOP

## Phase 1 -- 判定是否需要全域 store

1. READ 讀取任務需求與 `app/stores/` 既有 store。
2. THINK 判定狀態歸屬：單一元件內的狀態用 ref／reactive，server 資料的寫入與授權轉 server-api skill；確認本次是新增、修改，還是補登入後的全域初始化。

## Phase 2 -- 撰寫與自查

1. READ 讀取 `rules/Store慣例判準.md`。
2. WRITE 依已載入規則新增或修改 `app/stores/<name>.ts`；需要登入後自動載入時，依規則建立 `app/plugins/<name>-init.client.ts`。
3. READ 回頭逐條對照已載入規則；不符就修正。


---
Source attribution: YuDefine
Original project: https://github.com/YuDefine/nuxt-supabase-starter/blob/2987d936c8a6ea7f676c42528192416901bb3ee3/template/.claude/skills/pinia-store/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025-present YuDefine - 域定資訊工作室

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: YuDefine
Original project: https://github.com/YuDefine/nuxt-supabase-starter/blob/2987d936c8a6ea7f676c42528192416901bb3ee3/template/.claude/skills/pinia-store/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Design
Roles: Frontend Developer, Full-Stack Developer, UX Designer
Specialties: Frontend, API, Cross Platform
Tools: Pinia
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: e4a2bc043b51f5e4e7b9dc99da20a5649de66ca0394e9bd056b3bca7182c6f48
