vue3-composition
Skill0 starsChanged 18 days agoMITView on GitHub
Vue3 组合式 API 编码规范。编写或重构 .vue / composable 文件时使用:<script setup lang="ts">、defineProps/defineEmits 类型、ref/reactive 选择、computed/watch、composable 拆分。
2 other projects use a version of this.
Adopted by
Most recently taken up by
- caiqianha/vue-skillstheir own version, first seen Oct 11, 2026
- LeonxLJX/web-engineer-skillstheir own version, first seen Sep 3, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- caiqianha/vue-skills★ 2same name
- LeonxLJX/web-engineer-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- pinia-storeSkill
- release-checklistSkill
- uniapp-cross-platformSkill
- uniapp-loginSkill
- uniapp-paymentSkill
- uniapp-performanceSkill
- uniapp-permissionsSkill
- uniapp-project-structureSkill
- uniapp-requestSkill
- uniapp-subpackagesSkill
- uniapp-ui-libsSkill
The file
Files
Vue3 组合式 API 规范
必须
- 一律
<script setup lang="ts">,顺序:import → props/emits → 状态 → computed → watch → 方法 → 生命周期。 - Props 用类型声明 +
withDefaults;Vue ≥3.5 可直接解构 props(响应式解构)。
const props = withDefaults(defineProps<{ title: string; size?: 'sm' | 'md' }>(), { size: 'md' })
const emit = defineEmits<{ change: [value: string]; close: [] }>()
const model = defineModel<string>({ default: '' }) // v-model 双向绑定- 基本类型和需要整体替换的对象用
ref;不要解构reactive(会丢响应式),需要时用toRefs。 - 派生数据用
computed,不要用watch去同步赋值。 watch监听 props 字段要写 getter:watch(() => props.id, load, { immediate: true })。- 逻辑复用抽到
composables/useXxx.ts,返回 ref,命名useXxx,内部自己清理副作用(onUnmounted/onScopeDispose)。
禁止
- 混用 Options API;在模板里写复杂表达式(超过一个三元就抽 computed)。
v-if与v-for同一元素;v-for不写稳定:key(禁止用 index 作为可变列表的 key)。- 直接修改 props;用
any逃避类型。
自检清单
- 每个组件 < 300 行,超出拆子组件或 composable
- 异步函数都有 loading / error 状态
- 定时器、事件监听在卸载时清除
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

