Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
hyf0 avatar

Create Adaptable Composable

  • 2.4k installs
  • 2.8k repo stars
  • Updated May 30, 2026
  • hyf0/vue-skills

This is a copy of create-adaptable-composable by vuejs-ai - installs and ranking accrue to the original listing.

create-adaptable-composable is a Vue 3 agent skill that scaffolds library-grade composables accepting MaybeRef and MaybeRefOrGetter inputs so developers can ship reusable reactive utilities without brittle caller contrac

About

create-adaptable-composable is a Vue 3 agent skill (metadata version 17.0.0) for building reusable composables that accept plain values, refs, or getters from calling code. The skill guides normalization with toValue() and toRef() inside reactive effects such as watch and watchEffect, producing predictable behavior whether inputs are static or reactive. It targets Vue 3 or Nuxt 3 projects where composables must work like published library APIs rather than one-off component helpers. Developers reach for create-adaptable-composable when implementing shared state, async data hooks, or DOM utilities that multiple components will call with inconsistent input shapes. The workflow emphasizes MaybeRef typing patterns so downstream callers are not forced to wrap literals in ref() before use. Output is production-ready TypeScript composable code aligned with Vue ecosystem conventions for adaptable, testable reactive modules.

  • Creates adaptable Vue composables using MaybeRef and MaybeRefOrGetter types
  • Normalizes inputs with toValue() and toRef() inside watch and watchEffect
  • 4-step design process: confirm purpose, identify reactive params, normalize inputs, implement core logic
  • Produces reusable, predictable, library-grade Vue composables compatible with Vue 3 and Nuxt 3
  • Hard-gate: always confirm API design and expected inputs before generating code

Create Adaptable Composable by the numbers

  • 2,359 all-time installs (skills.sh)
  • +27 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hyf0/vue-skills --skill create-adaptable-composable

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.4k
repo stars2.8k
Security audit3 / 3 scanners passed
Last updatedMay 30, 2026
Repositoryhyf0/vue-skills

How do Vue composables accept refs or plain values?

Generate library-grade Vue 3 composables that gracefully accept plain values, refs, or getters from calling code.

Who is it for?

Vue or Nuxt developers publishing reusable composables that must accept both reactive and non-reactive caller inputs.

Skip if: Teams on Vue 2, non-Vue frameworks, or one-off component logic that never leaves a single file.

When should I use this skill?

The user asks to create an adaptable, reusable, or library-grade Vue composable with flexible reactive inputs.

What you get

A library-grade Vue 3 composable with MaybeRef/MaybeRefOrGetter typing and normalized reactive effects.

  • Adaptable Vue composable source
  • MaybeRef/MaybeRefOrGetter typings

By the numbers

  • Skill metadata version 17.0.0
  • Requires Vue 3+ or Nuxt 3+

Files

SKILL.mdMarkdownGitHub ↗

Create Adaptable Composable

Adaptable composables are reusable functions that can accept both reactive and non-reactive inputs. This allows developers to use the composable in a variety of contexts without worrying about the reactivity of the inputs.

Steps to design an adaptable composable in Vue.js: 1. Confirm the composable's purpose and API design and expected inputs/outputs. 2. Identify inputs params that should be reactive (MaybeRef / MaybeRefOrGetter). 3. Use toValue() or toRef() to normalize inputs inside reactive effects. 4. Implement the core logic of the composable using Vue's reactivity APIs.

Core Type Concepts

Type Utilities

/**
 * value or writable ref (value/ref/shallowRef/writable computed)
 */
export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;

/**
 * MaybeRef<T> + ComputedRef<T> + () => T
 */
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);

Policy and Rules

  • Read-only, computed-friendly input: use MaybeRefOrGetter
  • Needs to be writable / two-way input: use MaybeRef
  • Parameter might be a function value (callback/predicate/comparator): do not use MaybeRefOrGetter, or you may accidentally invoke it as a getter.
  • DOM/Element targets: if you want computed/derived targets, use MaybeRefOrGetter.

When MaybeRefOrGetter or MaybeRef is used:

  • resolve reactive value using toRef() (e.g. watcher source)
  • resolve non-reactive value using toValue()

Examples

Adaptable useDocumentTitle Composable: read-only title parameter

import { watch, toRef } from 'vue'
import type { MaybeRefOrGetter } from 'vue'

export function useDocumentTitle(title: MaybeRefOrGetter<string>) {
  watch(toRef(title), (t) => {
    document.title = t
  }, { immediate: true })
}

Adaptable useCounter Composable: two-way writable count parameter

import { watch, toRef } from 'vue'
import type { MaybeRef } from 'vue'

function useCounter(count: MaybeRef<number>) {
  const countRef = toRef(count)
  function add() {
    countRef.value++
  }
  return { add }
}

Related skills

How it compares

Choose create-adaptable-composable over generic Vue snippets when composables must behave like published library APIs with mixed reactive inputs.

FAQ

What Vue versions does create-adaptable-composable support?

create-adaptable-composable requires Vue 3 or above or Nuxt 3 or above per skill metadata version 17.0.0. The patterns rely on Vue 3 reactivity APIs such as toValue(), toRef(), watch, and watchEffect.

Why use MaybeRefOrGetter in a Vue composable?

create-adaptable-composable uses MaybeRefOrGetter so callers pass a literal, ref, or getter without wrapping everything in ref(). Normalizing with toValue() inside effects keeps library-grade composables flexible and predictable.

Is Create Adaptable Composable safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.