Skip to content
Skillpedia
Websites & UI (frontend)6.0k · #14448

vue

What it does

This skill explains how to build user interfaces with Vue 3, using the modern Composition API and TypeScript. It is for developers making web pages and apps with Vue.

When to use it

  • ✓When you are writing or editing a Vue single-file component.
  • ✓When you need to define component props, emits or a two-way model.
  • ✓When you want to use transitions, watchers or built-in components such as Teleport.

Skill link

https://github.com/antfu/skills/blob/main/skills/vue/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/antfu/skills/blob/main/skills/vue/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Build a Vue component for a search box that emits the typed text and shows a clear button.”

5 new skills a week. 1 minute to read.

How it works

The agent follows Vue 3's Composition API style with script setup and TypeScript, using the current reactivity tools and simple, efficient data handling.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Vue

Based on Vue 3.5, generated at 2026-09-25. Always use Composition API with <script setup lang="ts">.

Preferences

  • Prefer TypeScript over JavaScript
  • Prefer <script setup lang="ts"> over <script>
  • 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

Topic Description Reference
Script Setup & Macros <script setup>, defineProps, defineEmits, defineModel, defineExpose, defineOptions, defineSlots, generics script-setup-macros
Reactivity & Lifecycle ref, shallowRef, computed, watch, watchEffect, effectScope, lifecycle hooks, composables core-new-apis

Features

Topic Description Reference
Built-in Components & Directives Transition, Teleport, Suspense, KeepAlive, v-memo, custom directives advanced-patterns

Quick Reference

Component Template

<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'

const props = defineProps<{
  title: string
  count?: number
}>()

const emit = defineEmits<{
  update: [value: string]
}>()

const model = defineModel<string>()

const doubled = computed(() => (props.count ?? 0) * 2)

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

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

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

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'
FAQ

Does it use the Options API?

No. It recommends the Composition API over the Options API.

Which script style does it prefer?

It prefers script setup with lang ts, which keeps components short and typed.

Does it cover built-in components?

Yes. It covers Transition, Teleport, Suspense and KeepAlive.

Details

Original description by the author

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.

repo: antfu/skills

Popularity

GitHub stars
6.0k
Ranking position
#14448
License
MIT
Updated
10/30/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills