Skip to content
Back to skills

Vue Composition Api

ASecurity

Writes Vue 3 script setup components and composables with typed props, typed emits and reactivity that does not leak. Use it for any new or ported component.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 15, 2026
ai-agentsreactvueapi

Works with

  • api

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill vue-composition-api --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vue Composition Api?

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

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

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-api
description: Writes Vue 3 script setup components and composables with typed props, typed emits and reactivity that does not leak. Use it for any new or ported component.
---

# Vue Composition API

Write Vue 3 with `<script setup lang="ts">` and nothing else. No Options API, no `defineComponent` wrappers, no mixins.

## Component rules

1. Declare props with the type form: `const props = defineProps<{ id: string; items: Item[]; dense?: boolean }>()`. Use `withDefaults` only for real defaults.
2. Declare events with named payload types: `const emit = defineEmits<{ select: [id: string]; close: [] }>()`. Never emit an event that is not declared.
3. Use `v-model` through `defineModel<string>()` instead of a prop plus an update event.
4. Never destructure `props` into plain variables. Use `toRefs(props)`, `toRef(() => props.id)`, or read `props.id` inside a `computed`.

## Reactivity

- `ref` for primitives and replaceable objects, `reactive` only for a local object that never gets reassigned.
- Derived values are `computed`, never a `watch` that writes to another ref.
- `watch` is for side effects (fetching, storage). Give it an explicit source, and `{ immediate: true }` only when the first run matters.
- Anything started in the component (`addEventListener`, `setInterval`, subscriptions) is stopped in `onScopeDispose` or `onUnmounted`.

## Composables

Move logic out when two components need it or the script block passes 80 lines. A composable is named `useThing`, takes plain values or refs (accept `MaybeRefOrGetter` and unwrap with `toValue`), and returns an object of refs and functions, not a reactive object.

## Before you finish

Run `vue-tsc --noEmit` and the component tests. Report which logic you extracted and why.

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.