From create-adaptable-composable
Create a library-grade Vue composable that accepts maybe-reactive inputs (MaybeRef / MaybeRefOrGetter) and normalizes them with toValue()/toRef(). Use when building reusable composables.
How this skill is triggered — by the user, by Claude, or both
Slash command
/create-adaptable-composable:create-adaptable-composableThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
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:
toValue() or toRef() to normalize inputs inside reactive effects./**
* 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);
MaybeRefOrGetterMaybeRefMaybeRefOrGetter, or you may accidentally invoke it as a getter.MaybeRefOrGetter.When MaybeRefOrGetter or MaybeRef is used:
toRef() (e.g. watcher source)toValue()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 }
}
3plugins reuse this skill
First indexed Jun 27, 2026
npx claudepluginhub pythoughts-labs/vue3-best-practices --plugin vue-skills-bundleCreate a library-grade Vue composable that accepts maybe-reactive inputs (MaybeRef / MaybeRefOrGetter) and normalizes them with toValue()/toRef(). Use when building reusable composables.
Creates and manages reactive primitive values and objects using Vue 3's ref and reactive. Guides use of computed, avoids destructuring reactive objects, and covers shallowRef for performance.
Provides Vue 3 Composition API guidance on setup(), script setup syntax, ref vs reactive for scalable, maintainable apps.