用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill vue-component命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | vue-component |
| description | | Use when this capability is needed. |
Quand l'utilisateur demande de créer un composant Vue, applique ce template et ces règles.
templates/CardItem.vue — composant carte fidélité complet (modes merchant + client)templates/CardForm.vue — formulaire avec validation Zod, UForm, UInputNumber<script setup lang="ts">
// 1. Types importés (import type uniquement)
import type { Card } from '~/composables/useDB'
// 2. Props typées avec générics
const props = defineProps<{
requiredProp: string
optionalProp?: number
complexProp: Card
}>()
// 3. Emits typés avec tuple syntax
const emit = defineEmits<{
updated: [id: string, value: number]
deleted: [id: string]
}>()
// 4. Composables Nuxt (auto-importés, pas d'import manuel)
const toast = useToast()
// 5. State local
const isLoading = ref(false)
// 6. Computed (logique hors template)
const displayValue = computed(() => props.optionalProp ?? 0)
// 7. Fonctions (async avec try/catch + feedback toast)
async function handleAction() {
isLoading.value = true
try {
// logique métier
emit('updated', 'id', displayValue.value)
toast.add({ title: 'Succès', color: 'success' })
}
catch {
toast.add({ title: 'Erreur', color: 'error' })
}
finally {
isLoading.value = false
}
}
</script>
<template>
<UCard class="w-full">
<!-- Contenu principal -->
<p class="font-semibold text-lg">{{ props.requiredProp }}</p>
<!-- Actions : UButton avec size="lg" (min touch target 48px) -->
<UButton
color="primary"
size="lg"
:loading="isLoading"
@click="handleAction"
>
Action
</UButton>
</UCard>
</template>
Structure complète, ordre des blocs, props/emits, composables et JSDoc dans
coding-standards.
Composants Nuxt UI disponibles :
UCard, UContainer, USeparatorUButton, UButtonGroupUForm, UFormField, UInput, UInputNumber, UTextarea, USelect, UCheckboxUAlert, UBadge, UProgress, UIconUModal, UDrawer, UTooltipi-lucide-* en priorité (ex: i-lucide-trash-2, i-lucide-plus, i-lucide-gift)UX mobile :
size="lg" minimum (touch target 48px)truncateflex flex-col gap-4 ou flex gap-2SSR safety :
localStorage, indexedDB, document, ou window → envelopper dans onMountedqrcode ou html5-qrcode → <ClientOnly> + import dynamique dans onMountedSi la logique dépasse ~20 lignes ou est réutilisable, extraire dans app/composables/useNomFeature.ts :
// app/composables/useNomFeature.ts
export function useNomFeature() {
const state = ref<Type>(initialValue)
async function doSomething(): Promise<void> {
// logique
}
return { state, doSomething }
}
PascalCase.vue → app/components/MonComposant.vuekebab-case.vue → app/pages/ma-page.vue[param].vue → app/pages/client/[id].vue✅ vue-component appliqué
- Structure : [
- Props/Emits : [générics, tuple syntax]
- UX mobile : [size="lg" sur boutons interactifs, truncate sur textes longs]
- SSR safety : [ClientOnly / onMounted si browser API]
- Tests : [fichier .test.ts co-localisé créé ou mis à jour]
Source: chawkitariq/fidely — distributed by TomeVault.