create-adaptable-composable

Normalize plain values, Ref, or Getter inputs in Vue 3 composables.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/hello-lizhihua/skills_zh-CN --skill create-adaptable-composable-hello-lizhihua
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-adaptable-composable
Source: https://github.com/hello-lizhihua/skills_zh-CN/tree/main/vue-skills/cn/skills/create-adaptable-composable
Command: npx skills add https://github.com/hello-lizhihua/skills_zh-CN --skill create-adaptable-composable-hello-lizhihua

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers create reusable, adaptable Vue composables that gracefully handle both reactive and non-reactive inputs, simplifying API design and improving predictability across components.

Core Features & Use Cases

  • Adaptive input handling: Accept MaybeRef, MaybeRefOrGetter, or plain values and normalize with toValue/toRef inside reactive effects.
  • Reusable composables: Build library-grade utilities that work in Vue 3, Vue/Nuxt 3 contexts.
  • Use Case: When exposing a composable like useFetch or useCounter, ensure it accepts an arbitrary input form and remains deterministic.

Quick Start

Initialize an adaptable composable that consumes a MaybeRef<number> and increments via a local method, demonstrating toRef/toValue normalization.

Frequently Asked Questions about create-adaptable-composable

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make a Vue composable accept both reactive refs and plain values?

To make a Vue composable accept mixed inputs, normalize the arguments using Vue 3 APIs like toRef and toValue inside reactive effects. This allows your composable to gracefully handle plain values, Refs, and Getters predictably.

What is the difference between toValue and toRef for normalizing composable inputs?

Normalizing composable inputs with toValue unwraps MaybeRefOrGetter to a plain value, while toRef creates a reactive reference from the input. Using them inside reactive effects ensures your composable remains deterministic across different input types.

How to create a library-grade composable in Vue 3 that handles MaybeRefOrGetter?

Create a library-grade composable in Vue 3 by accepting MaybeRefOrGetter arguments and normalizing them with toValue or toRef. This adaptive input handling ensures your utility works predictably whether consumers pass static values, refs, or getter functions.

Does this composable input normalization approach work with Nuxt 3 projects?

Yes, normalizing composable inputs with toValue and toRef works across both Vue 3 and Nuxt 3 projects. It applies to library-like utilities and components that rely on predictable, reactive-safe input normalization within the Vue ecosystem.

When should I use adaptive input handling in my Vue composables?

Use adaptive input handling when exposing reusable composables like useFetch or useCounter. It ensures the composable accepts arbitrary input forms, including plain values and Refs, while remaining deterministic and reactive-safe for the consumer.

Why does my Vue composable lose reactivity when accepting plain values and refs?

A Vue composable loses reactivity when inputs are not properly normalized inside reactive effects. Applying toRef or toValue ensures that mixed inputs like plain values, Refs, and Getters are handled in a predictable, reactive-safe way.