trove-vue
Vue 3 Composition API conventions and best practices. Auto-activates when working with Vue single-file components. Covers reactivity, component patterns, Vue Router, and Pinia state management. Use when: vue component; composition api; pinia store.
- License 许可
- MIT
- 所属仓库
- bravew/trove
- 最近更新
- 2026-11-12
- Stars
- ★ 10
- Forks
- 1
01 前言 Front Matter
- name
- trove-vue
- description
- Vue 3 Composition API conventions and best practices. Auto-activates when working with Vue single-file components. Covers reactivity, component patterns, Vue Router, and Pinia state management. Use when: vue component; composition api; pinia store.
03 SKILL.md 正文
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly --> <!-- Regenerate: bun run build:skills -->
Session Init
This skill ships Trove conventions. Prefer existing project patterns over generic best practices when they conflict.
Vue 3 Composition API Conventions
Script Setup
Always use <script setup lang="ts"> for single-file components:
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
const count = ref(0)
const doubled = computed(() => count.value * 2)
onMounted(() => {
console.log('Component mounted')
})
</script>
Reactivity (CRITICAL)
- Use
ref()for primitives,reactive()for objects - Always access
.valueon refs in script (auto-unwrapped in template) - Use
computed()for derived state — never compute in template - Use
watchEffect()for side effects that depend on reactive state
// BAD — reactive object loses reactivity on destructure
const { name, age } = reactive(user)
// GOOD — use toRefs to keep reactivity
const { name, age } = toRefs(reactive(user))
// BEST — use ref for individual values
const name = ref(user.name)
Component Props & Emits
// Type-safe props with defaults
const props = withDefaults(defineProps<{
title: string
count?: number
}>(), {
count: 0,
})
// Type-safe emits
const emit = defineEmits<{
update: [value: string]
delete: [id: number]
}>()
API Calls
Use composables for API integration:
// composables/useUser.ts
export function useUser(userId: Ref<string>) {
const user = ref<User | null>(null)
const loading = ref(false)
async function fetchUser() {
loading.value = true
try {
const { data } = await api.get(`/users/${userId.value}`)
user.value = data
} finally {
loading.value = false
}
}
watch(userId, fetchUser, { immediate: true })
return { user, loading, fetchUser }
}
AI Gotchas
- Template refs: Use
ref<HTMLElement | null>(null)for DOM element refs - v-model: Use
defineModel()for two-way binding in custom components - Async components: Use
defineAsyncComponent()for code splitting - Provide/Inject: Type with
InjectionKey<T>for type safety
04 同仓库更多 Skills
using-trove
Skill discipline anchor for the Trove marketplace. Loaded once per session; routes the agent to the right trove-* skill before code, planning, review, or git actions.
trove-write-skill
Skill authoring workflow. Use when creating or updating a Codex or Trove skill, including rubrics, tasks, metadata, and validation.
trove-worktree
Git worktree workflow for spikes, risky experiments, and broad refactors that should not disturb the user's current branch.
trove-why
Reconstruct design rationale and decision history from evidence — source control, issue tracker (Linear), docs (Notion), chat (Slack), error tracking (Sentry) — with calibrated confidence. Use for "why does X work this way", "why did we pick Y", regressions, and postmortems. Use trove-explain for how it works now.
trove-verify
Completion verification workflow. Use before claiming done, fixed, complete, ready, or shipped.
trove-unslop
Cut AI tells from writing — PR descriptions, release notes, specs, commit bodies, and replies. Use before finalizing prose, or when the user asks to clean up, de-slop, or make text sound human.