Source profileQuality 91/100

agents-inc/skills/src/skills/web-framework-vue-composition-api/SKILL.md

web-framework-vue-composition-api

Vue 3 Composition API patterns, reactivity primitives, composables, lifecycle hooks

Source repository stars
23
Declared platforms
0
Static risk flags
1
Last source update
2026-08-09
Source checked
2026-08-28

Decision brief

What it does: where it fits

Quick Guide: Use for all components. ref() for primitives, reactive() for objects. Extract reusable logic into composables (use functions). Clean up side effects in onUnmounted. Use defineModel() for v-model (3.4+), useTemplateRef() for DOM refs (3.5+), onWatcherCleanup() to can…

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/agents-inc/skills --skill "src/skills/web-framework-vue-composition-api"
    Safe inspection promptEditorial

    Inspect the Agent Skill "web-framework-vue-composition-api" from https://github.com/agents-inc/skills/blob/81d43a51211aca12c85dcc16085fa99014ec548e/src/skills/web-framework-vue-composition-api/SKILL.md at commit 81d43a51211aca12c85dcc16085fa99014ec548e. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Pattern 1: Script Setup with Props and Emits

      All variables/functions in are automatically available in the template. Use TypeScript generics with defineProps and defineEmits for type-safe interfaces.

      All variables/functions in are automatically available in the template. Use TypeScript generics with defineProps and defineEmits for type-safe interfaces.Why good: No explicit return needed, TypeScript types flow naturally, named tuple emit syntax (Vue 3.3+) self-documents payloadsSee examples/core.md for a complete component with loading/error handling.
    2. 02

      CRITICAL: Before Using This Skill

      All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

      Building Vue 3 components using Composition APICreating reusable composables (use\ functions)Managing reactive state with ref/reactive
    3. 03

      Philosophy

      The Composition API enables organizing code by logical concern rather than by option type (data, methods, computed). This makes complex components more maintainable and enables powerful logic reuse through composables.

      Composition over configuration - Group related logic together instead of splitting across optionsExplicit reactivity - State is explicitly reactive via ref() and reactive()Logic reuse via composables - Extract and share stateful logic between components
    4. 04

      Core Patterns

      All variables/functions in are automatically available in the template. Use TypeScript generics with defineProps and defineEmits for type-safe interfaces.

      examples/core.md - Complete component, template refs, focus managementexamples/reactivity.md - ref, reactive, computed patterns and anti-patternsexamples/composables.md - useFetch, useLocalStorage, useDebounce, useIntersectionObserver
    5. 05

      Pattern 2: Reactivity - ref vs reactive

      ref() for primitives and reassignable values, reactive() for objects with nested properties. Access ref values via .value in script; templates unwrap automatically.

      ref() for primitives and reassignable values, reactive() for objects with nested properties. Access ref values via .value in script; templates unwrap automatically.Gotcha: Destructuring reactive() loses reactivity - use toRefs(state) if you need to destructure.See examples/reactivity.md for ref/reactive/computed patterns and anti-patterns.

    Permission review

    Static risk signals and limitations

    Network access

    medium · line 153

    The documentation includes network, browsing, or remote request actions.

    const res = await fetch(`/api/search?q=${query}`, {

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score91/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars23SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    agents-inc/skills
    Skill path
    src/skills/web-framework-vue-composition-api/SKILL.md
    Commit
    81d43a51211aca12c85dcc16085fa99014ec548e
    License
    MIT
    Collected
    2026-08-28
    Default branch
    main
    View the original SKILL.md

    Vue 3 Composition API

    Quick Guide: Use <script setup> for all components. ref() for primitives, reactive() for objects. Extract reusable logic into composables (use* functions). Clean up side effects in onUnmounted. Use defineModel() for v-model (3.4+), useTemplateRef() for DOM refs (3.5+), onWatcherCleanup() to cancel stale async work (3.5+). Destructured props require getter wrappers in watch().


    <critical_requirements>

    CRITICAL: Before Using This Skill

    All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

    (You MUST use <script setup> syntax for all new Vue components)

    (You MUST clean up all side effects (timers, listeners, subscriptions) in onUnmounted)

    (You MUST use ref() for primitives and reactive() for objects - access ref values via .value)

    (You MUST prefix all composable functions with use following Vue conventions)

    (You MUST wrap destructured props in a getter for watch() - watch(() => count, ...) not watch(count, ...))

    </critical_requirements>


    Auto-detection: Vue 3 Composition API, script setup, ref, reactive, computed, watch, watchEffect, composables, onMounted, onUnmounted, defineProps, defineEmits, defineExpose, defineModel, useTemplateRef, useId, onWatcherCleanup, provide, inject, Suspense

    When to use:

    • Building Vue 3 components using Composition API
    • Creating reusable composables (use* functions)
    • Managing reactive state with ref/reactive
    • Handling component lifecycle and side effects
    • TypeScript integration with Vue components

    Key patterns covered:

    • Script setup syntax and compiler macros (defineProps, defineEmits, defineExpose)
    • Reactivity primitives (ref, reactive, computed, watch, watchEffect)
    • Composables pattern for logic reuse
    • defineModel() for v-model binding (Vue 3.4+)
    • useTemplateRef(), useId(), onWatcherCleanup() (Vue 3.5+)
    • Reactive props destructure with getter requirement (Vue 3.5+)
    • Provide/Inject for dependency injection
    • Async components and Suspense

    When NOT to use:

    • Components that don't benefit from logic extraction
    • When team has no Composition API experience (consider gradual adoption)

    Philosophy

    The Composition API enables organizing code by logical concern rather than by option type (data, methods, computed). This makes complex components more maintainable and enables powerful logic reuse through composables.

    Core principles:

    1. Composition over configuration - Group related logic together instead of splitting across options
    2. Explicit reactivity - State is explicitly reactive via ref() and reactive()
    3. Logic reuse via composables - Extract and share stateful logic between components
    4. TypeScript-first - Types flow naturally without excessive annotations

    Core Patterns

    Pattern 1: Script Setup with Props and Emits

    All variables/functions in <script setup> are automatically available in the template. Use TypeScript generics with defineProps and defineEmits for type-safe interfaces.

    <script setup lang="ts">
    import { ref, computed } from "vue";
    
    const props = defineProps<{
      userId: string;
      initialCount?: number;
    }>();
    
    const emit = defineEmits<{
      update: [value: number];
      submit: [];
    }>();
    
    const count = ref(props.initialCount ?? 0);
    const doubleCount = computed(() => count.value * 2);
    
    function increment() {
      count.value++;
      emit("update", count.value);
    }
    </script>
    

    Why good: No explicit return needed, TypeScript types flow naturally, named tuple emit syntax (Vue 3.3+) self-documents payloads

    See examples/core.md for a complete component with loading/error handling.


    Pattern 2: Reactivity - ref vs reactive

    ref() for primitives and reassignable values, reactive() for objects with nested properties. Access ref values via .value in script; templates unwrap automatically.

    const count = ref(0); // Primitive -> ref
    count.value++; // .value in script
    
    const state = reactive({
      // Nested object -> reactive
      user: null as User | null,
      settings: { theme: "light" },
    });
    state.settings.theme = "dark"; // Direct access, no .value
    

    Gotcha: Destructuring reactive() loses reactivity - use toRefs(state) if you need to destructure.

    See examples/reactivity.md for ref/reactive/computed patterns and anti-patterns.


    Pattern 3: Watch and WatchEffect

    Skip if using Nuxt — use useFetch or useAsyncData instead.

    watch() for explicit sources with access to old values. watchEffect() for automatic dependency tracking that runs immediately. Use onWatcherCleanup() (Vue 3.5+) to cancel stale async work.

    // watch: explicit source, access to old value
    watch(searchQuery, async (newQuery, oldQuery) => {
      /* ... */
    });
    
    // watchEffect: auto-tracks dependencies, runs immediately
    watchEffect(async () => {
      if (userId.value) userData.value = await fetchUser(userId.value);
    });
    
    // Cleanup: cancel stale requests (Vue 3.5+)
    watch(searchQuery, async (query) => {
      const controller = new AbortController();
      onWatcherCleanup(() => controller.abort());
      const res = await fetch(`/api/search?q=${query}`, {
        signal: controller.signal,
      });
    });
    

    Gotcha: Watch reactive object properties with a getter: watch(() => state.count, ...) not watch(state.count, ...).

    See examples/vue-3-5-features.md for complete onWatcherCleanup patterns.


    Pattern 4: Lifecycle and Cleanup

    Always pair onMounted setup with onUnmounted cleanup. Timers, listeners, observers, WebSockets - anything opened must be closed.

    const POLL_INTERVAL_MS = 5000;
    let intervalId: ReturnType<typeof setInterval> | null = null;
    
    onMounted(() => {
      intervalId = setInterval(fetchData, POLL_INTERVAL_MS);
    });
    
    onUnmounted(() => {
      if (intervalId) {
        clearInterval(intervalId);
        intervalId = null;
      }
    });
    

    See examples/lifecycle.md for WebSocket reconnection and event listener cleanup patterns.


    Pattern 5: Composables

    Extract reusable stateful logic into use* functions. Return objects with refs (not bare values) so destructuring preserves reactivity.

    export function useCounter(options: UseCounterOptions = {}) {
      const { initialValue = 0, min = -Infinity, max = Infinity } = options;
      const count = ref(initialValue);
      const isAtMax = computed(() => count.value >= max);
    
      function increment() {
        if (count.value < max) count.value++;
      }
      function reset() {
        count.value = initialValue;
      }
    
      return { count, isAtMax, increment, reset }; // Return object with refs
    }
    

    Async composables should accept MaybeRefOrGetter<T> inputs (use toValue() to normalize) and return { data, error, isLoading } refs.

    See examples/composables.md for useFetch, useLocalStorage, useDebounce, and useIntersectionObserver implementations.


    Pattern 6: defineModel for v-model (Vue 3.4+)

    Replaces the defineProps + defineEmits boilerplate for two-way binding. Returns a ref-like value that syncs with the parent.

    <script setup lang="ts">
    const model = defineModel<string>(); // Single v-model
    const firstName = defineModel<string>("firstName"); // Named v-model
    const [model, modifiers] = defineModel<string>({
      // With modifiers
      set(value) {
        return modifiers.capitalize
          ? value.charAt(0).toUpperCase() + value.slice(1)
          : value;
      },
    });
    </script>
    

    See examples/vue-3-5-features.md for complete defineModel examples with named models and modifiers.


    Pattern 7: Template Refs (Vue 3.5+)

    useTemplateRef() separates template refs from reactive refs. Use for dynamic ref names and in composables. Traditional ref() still works for simple static refs.

    <script setup lang="ts">
    const inputRef = useTemplateRef<HTMLInputElement>("myInput");
    onMounted(() => inputRef.value?.focus());
    </script>
    <template>
      <input ref="myInput" type="text" />
    </template>
    

    For child component refs: Use defineExpose() to declare the public API, then ref<InstanceType<typeof Child>>() in the parent.

    See examples/define-expose.md for form validation with exposed methods and examples/vue-3-5-features.md for useTemplateRef in composables.


    Pattern 8: useId for Accessible IDs (Vue 3.5+)

    Generates SSR-safe unique IDs for form labels and ARIA attributes. Each call produces a different ID. Must be called in setup (not in computed).

    <script setup lang="ts">
    const id = useId();
    </script>
    <template>
      <label :for="id">Email</label>
      <input :id="id" type="email" />
    </template>
    

    See examples/vue-3-5-features.md for multi-field forms and ARIA patterns.


    Pattern 9: Reactive Props Destructure (Vue 3.5+)

    Destructured props are automatically reactive. Use JavaScript default syntax instead of withDefaults(). The critical gotcha: destructured props require a getter wrapper in watch().

    <script setup lang="ts">
    const {
      title,
      count = 0,
      items = () => [],
    } = defineProps<{
      title: string;
      count?: number;
      items?: string[];
    }>();
    
    // CORRECT: getter wrapper
    watch(
      () => count,
      (newCount) => {
        /* ... */
      },
    );
    
    // WRONG: passes value, not reactive source
    // watch(count, ...) // Never triggers!
    </script>
    

    See examples/vue-3-5-features.md for complete reactive destructure examples.


    Pattern 10: Provide/Inject

    Type-safe dependency injection to avoid prop drilling. Define InjectionKey<T> symbols in a separate file, provide in ancestor, inject in descendant with an explicit error for missing providers.

    // injection-keys.ts
    export const THEME_KEY: InjectionKey<ThemeContext> = Symbol("theme");
    
    // Provider: provide(THEME_KEY, { theme, toggleTheme });
    // Consumer: const ctx = inject(THEME_KEY);
    //           if (!ctx) throw new Error("Must be used within ThemeProvider");
    

    See examples/provide-inject.md for a complete theme provider/consumer pattern.


    Pattern 11: Async Components and Suspense

    defineAsyncComponent for code-splitting. Top-level await in <script setup> makes a component async (requires <Suspense> in parent). Use onErrorCaptured at the Suspense boundary for error handling.

    const LOADING_DELAY_MS = 200;
    const LOAD_TIMEOUT_MS = 10000;
    
    const HeavyChart = defineAsyncComponent({
      loader: () => import("@/components/HeavyChart.vue"),
      loadingComponent: LoadingSpinner,
      delay: LOADING_DELAY_MS,
      timeout: LOAD_TIMEOUT_MS,
    });
    

    See examples/async.md for Suspense boundaries with error handling.


    Detailed Resources:


    <red_flags>

    RED FLAGS

    High Priority Issues:

    • Missing cleanup in onUnmounted - timers, listeners, subscriptions, WebSockets cause memory leaks
    • Accessing ref.value in template - templates auto-unwrap refs, writing .value in templates is wrong
    • Destructuring reactive() without toRefs() - loses reactivity silently
    • Watching destructured prop directly - watch(count, ...) never triggers, use watch(() => count, ...)

    Medium Priority Issues:

    • Watch without async cleanup - causes race conditions; use onWatcherCleanup() (3.5+) or the cleanup callback
    • Using provide() with string keys instead of typed InjectionKey<T> symbols - loses type safety
    • Returning bare values from composables instead of an object with refs - breaks destructuring reactivity

    Gotchas & Edge Cases:

    • Refs in reactive objects are auto-unwrapped at root level, but NOT in arrays or Map/Set
    • watchEffect runs immediately; watch is lazy by default
    • Computed values are read-only by default; use getter/setter object for writable computed
    • Top-level await makes a component async and requires <Suspense> in parent
    • Provide values are not reactive by default - wrap in ref() or reactive() if consumers need reactivity
    • onUnmounted won't run if component errors during setup - use error boundaries for critical cleanup
    • useId() must not be called in computed - it generates a new ID each call
    • defineModel returns a ref - use .value in script, auto-unwrapped in template

    </red_flags>


    <critical_reminders>

    CRITICAL REMINDERS

    All code must follow project conventions in CLAUDE.md

    (You MUST use <script setup> syntax for all new Vue components)

    (You MUST clean up all side effects (timers, listeners, subscriptions) in onUnmounted)

    (You MUST use ref() for primitives and reactive() for objects - access ref values via .value)

    (You MUST prefix all composable functions with use following Vue conventions)

    (You MUST wrap destructured props in a getter for watch() - watch(() => count, ...) not watch(count, ...))

    Failure to follow these rules will cause memory leaks, broken reactivity, and unmaintainable component APIs.

    </critical_reminders>

    Frequently asked questions

    What to verify before installation and use

    What does the web-framework-vue-composition-api source document cover?

    Quick Guide: Use for all components. ref() for primitives, reactive() for objects. Extract reusable logic into composables (use functions). Clean up side effects in onUnmounted. Use defineModel() for v-model (3.4+), useTemplateRef() for DOM refs (3.5+), onWatcherCleanup() to can…

    How do I install web-framework-vue-composition-api?

    The source record exposes this install command: npx skills add https://github.com/agents-inc/skills --skill "src/skills/web-framework-vue-composition-api". Inspect the command and pinned source before running it.

    Which permission-related actions were detected?

    Static rules flagged network in the source; the page lists the matching lines and excerpts.

    Alternatives

    Compare before choosing

    Computed 10045,960

    coreyhaines31/marketingskills

    ab-testing

    When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

    Computed 10029,236

    garrytan/gbrain

    bulk-ingestion

    End-to-end discipline for turning any large data source (audio libraries, email takeouts, document corpora, chat exports, API dumps) into brain pages at scale. The lifecycle spine: SCHEMA → ACCESS → TRIAL → EVALUATE → IMPROVE → CODIFY → TEST → SKILLIFY → BULK → MONITOR. State is tracked in a durable JSON manifest (see MANIFEST-PATTERN.md) so any crash, session boundary, or subagent fan-out resumes from ground truth instead of memory.

    Computed 10025,136

    alirezarezvani/claude-skills

    app-store-optimization

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

    Computed 1005,277

    dotnet/skills

    migrate-vstest-to-mtp

    Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing