Community程式設計與開發github.com

hyf0/create-adaptable-composable

建立一個可接受可能為響應式輸入(MaybeRef / MaybeRefOrGetter)的函式庫級 Vue composable,讓呼叫者可以傳入純值、ref 或 getter。在響應式效果(watch/watchEffect)中使用 toValue()/toRef() 標準化輸入,以保持行為可預測且具響應性。當使用者要求建立可適應或可重複使用的 composable 時,使用此技能。

create-adaptable-composable 是什麼?

此技能用於建立一個函式庫級的 Vue composable,特別設計來處理可能為響應式的輸入,包括 MaybeRef 和 MaybeRefOrGetter 類型。這讓呼叫者能靈活地傳入純值、ref 或 getter 函式,而 composable 內部則透過 toValue() 或 toRef() 在 watch 或 watchEffect 中標準化輸入,確保行為一致且可預測。此技能適合開發者需要建立可重複使用、適應性強的 composable 時使用,常見於 Vue 3 的 Composition API 生態系,並支援在 Cursor、Claude Code 等 AI 輔助開發工具中套用。其核心優勢在於簡化響應式資料的處理邏輯,提升 composable 的通用性與維護性。

相容平台~Claude Code~Codex CLI~Cursor
Part ofReact
npx skills add https://github.com/hyf0/vue-skills/tree/main/skills/create-adaptable-composable

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

create-adaptable-composable 是做什麼的?

建立一個函式庫級的 Vue composable,可接受可能為響應式的輸入(MaybeRef / MaybeRefOrGetter),以便呼叫者傳入純值、ref 或 getter。在響應式效果(watch/watchEffect)內部使用 toValue()/toRef() 標準化輸入,以保持行為可預測且具響應性。當使用者要求建立可適應或可重複使用的 composable 時,請使用此技能。

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

相關技能