skills/vue-options/SKILL.md
Vue 3 Options API — data, props, computed, methods, watch, emits, provide/inject, lifecycle hooks, and mixins. Use when the project uses Options API style (Vue 2 legacy or explicit Vue 3 Options API preference).
npx skillsauth add vuluu2k/skills vue-optionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill for Vue projects written in Options API style. For new Vue 3 projects, prefer the
vueskill (Composition API with<script setup>).
| Topic | Description | Reference | |-------|-------------|-----------| | State: data, computed, methods, watch | Reactive state, derived values, event handlers, side effects | state | | Props & Emits | Receiving data from parent, emitting events to parent | props-emits | | Lifecycle Hooks | Component creation, mounting, updating, unmounting | lifecycle |
| Topic | Description | Reference | |-------|-------------|-----------| | provide / inject | Dependency injection across deep component trees | provide-inject | | Mixins | Reusable logic shared across components (use with caution) | mixins |
<script>
export default {
name: 'MyComponent',
props: {
title: {
type: String,
required: true
},
count: {
type: Number,
default: 0
}
},
emits: ['update'],
data() {
return {
localCount: this.count
}
},
computed: {
doubled() {
return this.localCount * 2
}
},
watch: {
count(newVal) {
this.localCount = newVal
}
},
methods: {
increment() {
this.localCount++
this.$emit('update', this.localCount)
}
},
mounted() {
console.log('Component mounted')
}
}
</script>
<template>
<div>
<h1>{{ title }}</h1>
<p>Count: {{ localCount }} | Doubled: {{ doubled }}</p>
<button @click="increment">Increment</button>
</div>
</template>
data must be a function (not an object) to avoid shared state across instances.computed properties are cached — only recompute when dependencies change.watch for side effects (API calls, logging), not for deriving state.emits explicitly to document the component's contract.mixins in new code — prefer composables (Composition API) for reuse.development
Vue 3 Composition API — <script setup>, reactivity (shallowRef/ref), props without destructure, computed, watch, provide/inject, and composables. Use when the project uses modern Vue 3 Composition API style.
tools
Best practices for mixing Ant Design Vue components with Tailwind CSS utility classes. Use this skill to keep styling consistent without custom CSS files.
development
Pinia state management for Vue 3 using Composition API (Setup Stores) — TypeScript-first, storeToRefs for reactivity, focused stores, and API calls in composables. Use when the project uses Vue 3 Composition API / <script setup>.
development
Pinia state management for Vue using Options API style — define stores with state, getters, actions, and use them in Options API components via mapState/mapWritableState/mapActions.