vue

Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "vue" with this command: npx skills add sonvee/ai-skills/sonvee-ai-skills-vue

Vue

Based on Vue 3.5. Always use Composition API with <script setup>.

Preferences

  • Prefer JavaScript over TypeScript
  • Prefer <script setup> over <script setup lang="ts">
  • Strictly follow the <template> tag at the top, the <script> tag in the middle, and the <style> tag at the bottom.
  • For performance, prefer shallowRef over ref if deep reactivity is not needed
  • Always use Composition API over Options API
  • Discourage using Reactive Props Destructure

Core

TopicDescriptionReference
Script Setup & Macros<script setup>, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, genericsscript-setup-macros
Reactivity & Lifecycleref, shallowRef, computed, watch, watchEffect, effectScope, lifecycle hooks, composablescore-new-apis

Features

TopicDescriptionReference
Built-in Components & DirectivesTransition, Teleport, Suspense, KeepAlive, v-memo, custom directivesadvanced-patterns

Quick Reference

Page Structure Convention (Mandatory)

When generating a new Vue page, ALWAYS use a folder-per-page structure:

  • src/views/<page-name>/index.vue

Rules:

  • <page-name> must be kebab-case.
  • NEVER create pages directly under src/views as a single file (forbidden: src/views/home.vue).
  • If the user only provides a page name (without a path), infer and create the folder structure automatically.
  • Place related files in the same folder when needed (e.g. index.ts, types.ts, style.scss, __tests__).

Example:

  • Request: "Create Home page" or "Create AboutMe page"
  • Output path: src/views/home/index.vue or src/views/about-me/index.vue
  • Not allowed: src/views/home.vue or src/views/about-me.vue

Component Structure Convention (Mandatory)

When generating a new Vue component, ALWAYS use a folder-per-component structure:

  • src/components/<ComponentName>/<ComponentName>.vue

Rules:

  • <ComponentName> must be PascalCase.
  • NEVER create components directly under src/components as a single file (forbidden: src/components/HelloWorld.vue).
  • If the user only provides a component name (without a path), infer and create the folder structure automatically.
  • Place related files in the same folder when needed (e.g. index.ts, types.ts, style.scss, __tests__).

Example:

  • Request: "Create HelloWorld component"
  • Output path: src/components/HelloWorld/HelloWorld.vue
  • Not allowed: src/components/HelloWorld.vue

Component Template

<template>
  <div>{{ title }} - {{ count }}</div>
</template>

<script setup>
import { ref, computed, watch, onMounted } from 'vue'

const props = defineProps({
  title: {
    type: String,
    default: 'Hello Vue'
  }
})

const emit = defineEmits(['change'])

const count = defineModel('value', {
  type: Number,
  default: 0
})

watch(
  () => props.title,
  (newVal) => {
    console.log('Title:', newVal)
  }
)

onMounted(() => {
  console.log('Component mounted')
})
</script>

<style lang="scss" scoped></style>

Key Imports

// Reactivity
import { ref, shallowRef, computed, reactive, readonly, toRef, toRefs, toValue } from 'vue'

// Watchers
import { watch, watchEffect, watchPostEffect, onWatcherCleanup } from 'vue'

// Lifecycle
import { onMounted, onUpdated, onUnmounted, onBeforeMount, onBeforeUpdate, onBeforeUnmount } from 'vue'

// Utilities
import { nextTick, defineComponent, defineAsyncComponent } from 'vue'

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

fullstack-init

No summary provided by upstream source.

Repository SourceNeeds Review
General

vueuse-functions

No summary provided by upstream source.

Repository SourceNeeds Review
General

ui-ux-pro-max

No summary provided by upstream source.

Repository SourceNeeds Review
General

my-coding-style

No summary provided by upstream source.

Repository SourceNeeds Review
vue | V50.AI