vue-composition-api
/vue-composition-api
Use this skill when building reactive applications with Vue 3 Composition API, <script setup>, ref, reactive, computed, and composables.
- Author
- nextboxis ↗
- Repository
- library-skill-agents ↗
- Licence
- MIT
- Last repository change
- 28.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when building reactive applications with Vue 3 Composition API, <script setup>, ref, reactive, computed, and composables.
Original author description
Use this skill when building reactive applications with Vue 3 Composition API, <script setup>, ref, reactive, computed, and composables.
How it works
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
SKILL.md preview
---
name: vue-composition-api
description: Use this skill when building reactive applications with Vue 3 Composition API, <script setup>, ref, reactive, computed, and composables.
---
# Vue Composition API
## When to use
Use this skill when building modular, scalable Vue 3 applications, writing reusable composables, or refactoring legacy Options API components.
## Prerequisites
- Node.js 18+ and Vite with `@vitejs/plugin-vue`.
- Understanding of Vue 3 template syntax and reactivity system.
## Step-by-step workflow
1. **Adopt `<script setup>` syntax**: Structure Single-File Components (SFCs) using `<script setup lang="ts">` for concise, type-safe code.
2. **Declare reactive state**: Use `ref()` for primitive values and references; use `reactive()` for unified state objects.
3. **Derive computed state**: Wrap pure derived calculations with `computed()` to leverage automatic caching.
4. **Extract custom composables**: Create reusable `useFeature()` functions returning reactive refs and methods.
5. **Manage component lifecycle**: Hook into `onMounted`, `onUnmounted`, or `watchEffect` for side-effect synchronization.
## Commands / code examples
```vue
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue';
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
function increment() {
count.value++;
}
const timer = ref<number | null>(null);
onMounted(() => {
timer.value = window.setInterval(() => count.value++, 1000);
});
onUnmounted(() => {
if (timer.value) clearInterval(timer.value);
});
</script>
<template>
<div class="counter-card">
<p>Current count: {{ count }} (Double: {{ doubleCount }})</p>
<button @click="increment">Increment</button>
</div>
</template>
```
## Common mistakes & pitfalls
- Destructuring a `reactive()` object directly, which breaks reactivity (use `toRefs()` or `toRef()` instead).
- Forgetting `.value` when accessing or modifying `ref` variables in JavaScript/TypeScript script blocks.
- Creating memory leaks by neglecting to clean up event listeners or timers in `onUnmounted`.
## Verification checklist
- [ ] State is defined using `ref()` or `reactive()` with proper TypeScript typing.
- [ ] Composable functions return explicit objects with reactive properties.
- [ ] Computed properties are side-effect free.
- [ ] Subscriptions and event listeners are cleaned up on unmount.
## Related skills
- nuxt-fullstack
- javascript-es2024-deep-dive
- typescript-advanced-type-system
- unit-testing-principles-aaa-pattern
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · nextboxis/library-skill-agents | 100 | MIT |
| TheBushidoCollective/han | 95 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 96eb4c8166da (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90vue
Vue.js progressive JavaScript framework. Use when building Vue components, working with reactivity (ref, reactive, computed, watch), or implementing Vue Composition API patterns. - 100vue
Expert Vue 3 assistance covering Composition API (<script setup>), reactivity (ref, reactive), Pinia, and Vue Router. Use when developing modern, progressive web interfaces and single-page applications. - 95vue-composition
Vue 3 with Composition API. Covers reactivity, composables, lifecycle hooks, and component patterns. USE WHEN: user mentions "Vue", "Composition API", "composables", "ref", "reactive", "v-model", "v-if", "v-for", asks about "Vue 3 patterns", "reactive state in Vue" DO NOT USE… - 95vue-development
Vue.js 3 development with Composition API, TypeScript, Pinia state management, and Nuxt 3 full-stack. Use when building Vue applications, implementing reactive patterns, creating composables, or working with the Vue ecosystem. - 95vue-reactivity-system
Use when Vue reactivity system with refs, reactive, computed, and watchers. Use when managing complex state in Vue applications. - 100vue3-composition
Use when writing Vue 3 components or composables, choosing Options vs Composition API, handling reactivity, provide/inject, or script setup patterns.