Skip to content
Back to skills

Vue Composition

ASecurity

Migrate a Vue Options API component to the Composition API with script setup

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsgoreactvueapi

Works with

  • api

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill vue-composition --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vue Composition?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vue Composition
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-vue-composition/badge)](https://www.skillsdirectory.com/skills/black141312-vue-composition)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vue-composition
description: Migrate a Vue Options API component to the Composition API with script setup
category: frameworks
---

# Vue Composition

Use when converting a Vue 2/3 Options API component to `<script setup>` with the Composition API, keeping reactivity and lifecycle behavior intact.

1. Replace the Options block with `<script setup>`; declare `defineProps` and `defineEmits` for the component's props and events.
2. Convert each `data()` field to `ref()` (primitives) or `reactive()` (objects); access `.value` for refs in script.
3. Turn `computed` options into `computed(() => ...)` and `watch`/`watchEffect` for the watchers.
4. Move `methods` to plain functions in setup; map lifecycle hooks (`mounted` → `onMounted`, `beforeUnmount` → `onBeforeUnmount`, etc.).
5. Extract reusable logic into composables (`useXxx()` functions returning refs) instead of mixins.
6. Run the app; verify reactivity (template updates), emitted events, and that hooks fire in order.

## Rules
- In the template, refs auto-unwrap — don't write `.value` there; in script you must.
- Destructuring a `reactive` object breaks reactivity; use `toRefs` if you need to spread it.
- `defineProps`/`defineEmits` are compiler macros — don't import them; they only work in `<script setup>`.
- Replace `this.$emit` with the function returned by `defineEmits`, and `this.$refs` with template `ref()`.
- Prefer composables over mixins; keep each composable focused on one concern and return only what's needed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…