neo-vue
Skill7 starsChanged 6 months agoMITView on GitHub
Use this skill when building, debugging, refactoring, or reviewing Vue 3 applications, SFCs, Composition API, Pinia stores, Vue Router, Vite, or Vue+TypeScript code. Trigger when the project has *.vue files or the user mentions Vue, Pinia, Composition API, Router, reactivity, or component architecture.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- generate-skillSkill
- neo-azure-pipelinesSkill
- neo-clarificationSkill
- neo-clean-architectureSkill
- neo-code-reviewSkill
- neo-csharp-interface-generatorSkill
- neo-csharpSkill
- neo-dotnet-ef-coreSkill
- neo-dotnet-minimal-apisSkill
- neo-dotnet-mvcSkill
- neo-dotnetSkill
- neo-dotnet-tag-helperSkill
- neo-dotnet-webapiSkill
- neo-harness-projectSkill
- neo-harnessSkill
- neo-javascriptSkill
- neo-opentelemetrySkill
- neo-prSkill
- neo-python-managerSkill
- neo-pythonSkill
- neo-rabbitmqSkill
- neo-rustSkill
- neo-stop-slopSkill
- neo-sub-agentSkill
- neo-swiftSkill
- neo-swift-uiSkill
- neo-typescriptSkill
The file
Files
Modern Vue 3 & Pinia 開發專家 (neo-vue)
本技能為 Agent 提供 Vue 3 (Composition API) 與 Pinia 狀態管理的開發與審查指南。它協助產出符合 Vue Style Guide 優先級 A/B 規則的程式碼,避開常見響應式陷阱,並生成一致、強型別的單一檔案元件(SFC)。
Gotchas
- 解構 reactive 物件導致響應性丟失:禁止直接解構
props或由reactive()定義的物件(例如:const { name } = props或const { x } = state),這會徹底失去 Vue 響應式追蹤!- 防錯機制:必須使用
toRefs(props)或toRef(props, 'name')來保持其響應性。
- 防錯機制:必須使用
- 解構 Pinia Store 導致狀態響應性丟失:直接解構 Pinia store 的 state(如
const { user } = useAuthStore())會使 state 失去雙向響應!- 防錯機制:必須使用
storeToRefs(store)來解構 state;而 action 則可以直接正常解構。
- 防錯機制:必須使用
- v-model 手動繁瑣綁定:在 Vue 3.4 之前,自定義雙向綁定需要手動宣告
modelValue屬性並觸發update:modelValue事件,容易寫錯。- 防錯機制:在 Vue 3.4+ 專案中,優先使用
defineModel()巨集宣告雙向綁定,降低屬性與事件不一致的風險。
- 防錯機制:在 Vue 3.4+ 專案中,優先使用
- v-if 與 v-for 在同一節點混用:在 Vue 3 中,
v-if的優先級高於v-for,這意味著v-if的條件判斷無法存取到v-for迴圈中的變數,會直接導致編譯或執行期報錯!- 防錯機制:永遠使用
<template>標籤包裹v-for,再於內部子節點使用v-if,或者預先使用computed計算屬性對陣列進行過濾。
- 防錯機制:永遠使用
Workflow Checklist
Progress:
- 步驟 1:感知專案環境與依賴 (Perceive Setup & Tooling)
- 步驟 2:載入編碼規範與踩坑指南 (Load Guides & Best Practices)
- 步驟 3:架構推理與響應式規劃 (Reasoning & Architecture)
- 步驟 4:套用範本生成一致的程式碼 (Generate SFC & Stores)
- 步驟 5:程式碼健檢與自我校對 (Code Quality Review)
Detailed Guidelines
步驟 1 — 感知專案環境與依賴 (Perceive)
- 檢查依賴配置:讀取
package.json,確定 Vue 版本(確認為 Vue 3.x)以及是否安裝了pinia、vue-router。 - 識別建置工具與語言:確認是否為 Vite 專案,以及是否啟用了 TypeScript(
lang="ts")與 Scoped CSS。
步驟 2 — 載入編碼規範與踩坑指南 (Reason)
在進行 Vue 3 開發或審查前,必須動態載入深度知識庫:
- 讀取
references/coding-style.md以確認組件命名(必須為多字詞 PascalCase)、屬性定義等官方優先級規範。 - 讀取
references/anti-patterns.md以避開 props mutation、computed 副作用等反模式。 - 讀取
references/patterns.md以獲得 Composables 的合理拆分與 Pinia Setup Stores 的架構設計。
步驟 3 — 架構推理與響應式規劃 (Reason)
在編寫程式碼前,先思考以下設計:
- Reactivity 選擇:除非是多個屬性需要高度關聯的複雜物件,否則優先使用
ref()而不是reactive(),以確保存取.value的一致性並避免解構失活。 - 狀態下沉:評估狀態是屬於組件局部狀態(用
ref)還是全局狀態(用Pinia Setup Store)。
步驟 4 — 套用範本生成一致的程式碼 (Act)
- SFC 結構:新建立的元件必須使用
<script setup>語法,並依專案設定優先加入lang="ts"。 - 套用範本:讀取並參考
assets/Vue3SFCComponentTemplate.vue作為標準 Vue 3 元件的排版範例。 - 強制語言與風格:所有程式碼註解、說明必須使用 Traditional Chinese (Taiwan)。專用術語需對齊(例如:元件、屬性、狀態管理、響應式、雙向綁定、計算屬性)。
步驟 5 — 程式碼健檢與自我校對 (Act)
- 確認沒有在
computed中做任何 state 修改或 API 調用等 Side Effects。 - 確認沒有直接對
props進行賦值與修改。 - 確認
v-for的key綁定使用了穩定的唯一 ID,而不是陣列索引index。
Output Templates
生成新元件時,依照以下一致結構輸出;更多實作細節請參閱 assets/Vue3SFCComponentTemplate.vue:
<template>
<div class="vue-expert-component">
<!-- 模板內容 -->
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
// 1. 定義屬性與事件 (Props, Emits, Models)
const props = defineProps<{
title: string;
}>();
const emit = defineEmits<{
(e: 'change', value: string): void;
}>();
// Vue 3.4+ 雙向綁定巨集
const modelValue = defineModel<string>();
// 2. 狀態定義 (State)
const count = ref(0);
// 3. 計算屬性 (Computed)
const doubleCount = computed(() => count.value * 2);
// 4. 方法定義 (Methods)
function handleAction() {
emit('change', 'action-triggered');
}
</script>
<style scoped>
/* 必須使用 scoped 以免全域樣式污染,並優先選用 class 選擇器 */
.vue-expert-component {
display: flex;
flex-direction: column;
}
</style>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

