Vue Expert Js

作者 jeffallan1be15d8064f8MIT11K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 天前更新

Creates Vue 3 components, builds vanilla JS composables, configures Vite projects, and sets up routing and state management using JavaScript only — no TypeScript. Generates JSDoc-typed code with @typedef, @param, and @returns annotations for full type coverage without a TS compiler. Use when building Vue 3 applications with JavaScript only (no TypeScript), when projects require JSDoc-based type hints, when migrating from Vue 2 Options API to Composition API in JS, or when teams prefer vanilla JavaScript, .mjs modules, or need quick prototypes without TypeScript setup.

AI 產生的概覽

只用 JavaScript 建置 Vue 3 應用程式,以 JSDoc 註解取代 TypeScript。

功能
引導代理設計、實作、加上註解並測試以純 JavaScript 撰寫的 Vue 3 應用程式。產出包括使用 script setup 且不帶 TypeScript 語言屬性的元件、位於 .mjs 模組中的組合式函式,以及用於型別涵蓋的 JSDoc typedef、param、returns 與 type 註解。內容也涵蓋 Vite 設定、Vue Router、Pinia 狀態管理與 Vitest 測試,並為每個主題提供參考檔案。
適用情境
適用於只用 JavaScript、不引入 TypeScript 編譯器來建置 Vue 3 應用程式的情境。適合依賴 JSDoc 型別提示的專案、從 Vue 2 選項式 API 遷移到 JavaScript 組合式 API 的工作,以及跳過 TypeScript 設定的快速原型。
執行需求
不附帶指令碼,只有指示與參考文件。假定已有使用 Vite 的 Vue 3 專案,並在工作流程中提到 ESLint 及其 eslint-plugin-jsdoc 外掛、Vitest、Pinia、Vue Router 4 與 VueUse。

Vue Expert (JavaScript)

Senior Vue specialist building Vue 3 applications with JavaScript and JSDoc typing instead of TypeScript.

Core Workflow

  1. Design architecture — Plan component structure and composables with JSDoc type annotations
  2. Implement — Build with <script setup> (no lang="ts"), .mjs modules where needed
  3. Annotate — Add comprehensive JSDoc comments (@typedef, @param, @returns, @type) for full type coverage; then run ESLint with the JSDoc plugin (eslint-plugin-jsdoc) to verify coverage — fix any missing or malformed annotations before proceeding
  4. Test — Verify with Vitest using JavaScript files; confirm JSDoc coverage on all public APIs; if tests fail, revisit the relevant composable or component, correct the logic or annotation, and re-run until the suite is green

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
JSDoc Typingreferences/jsdoc-typing.mdJSDoc types, @typedef, @param, type hints
Composablesreferences/composables-patterns.mdcustom composables, ref, reactive, lifecycle hooks
Componentsreferences/component-architecture.mdprops, emits, slots, provide/inject
Statereferences/state-management.mdPinia, stores, reactive state
Testingreferences/testing-patterns.mdVitest, component testing, mocking

For shared Vue concepts, defer to vue-expert:

  • ../vue-expert/references/composition-api.md - Core reactivity patterns
  • ../vue-expert/references/components.md - Props, emits, slots
  • ../vue-expert/references/state-management.md - Pinia stores

Code Patterns

Component with JSDoc-typed props and emits

vue
<script setup>/** * @typedef {Object} UserCardProps * @property {string} name - Display name of the user * @property {number} age - User's age * @property {boolean} [isAdmin=false] - Whether the user has admin rights */
/** @type {UserCardProps} */const props = defineProps({  name:    { type: String,  required: true },  age:     { type: Number,  required: true },  isAdmin: { type: Boolean, default: false },})
/** * @typedef {Object} UserCardEmits * @property {(id: string) => void} select - Emitted when the card is selected */const emit = defineEmits(['select'])
/** @param {string} id */function handleSelect(id) {  emit('select', id)}</script>
<template>  <div @click="handleSelect(props.name)">    {{ props.name }} ({{ props.age }})  </div></template>

Composable with @typedef, @param, and @returns

js
// composables/useCounter.mjsimport { ref, computed } from 'vue'
/** * @typedef {Object} CounterState * @property {import('vue').Ref<number>} count - Reactive count value * @property {import('vue').ComputedRef<boolean>} isPositive - True when count > 0 * @property {() => void} increment - Increases count by step * @property {() => void} reset - Resets count to initial value */
/** * Composable for a simple counter with configurable step. * @param {number} [initial=0] - Starting value * @param {number} [step=1]    - Amount to increment per call * @returns {CounterState} */export function useCounter(initial = 0, step = 1) {  /** @type {import('vue').Ref<number>} */  const count = ref(initial)
  const isPositive = computed(() => count.value > 0)
  function increment() {    count.value += step  }
  function reset() {    count.value = initial  }
  return { count, isPositive, increment, reset }}

@typedef for a complex object used across files

js
// types/user.mjs
/** * @typedef {Object} User * @property {string}   id       - UUID * @property {string}   name     - Full display name * @property {string}   email    - Contact email * @property {'admin'|'viewer'} role - Access level */
// Import in other files with:// /** @type {import('./types/user.mjs').User} */

Constraints

MUST DO

  • Use Composition API with <script setup>
  • Use JSDoc comments for type documentation
  • Use .mjs extension for ES modules when needed
  • Annotate every public function with @param and @returns
  • Use @typedef for complex object shapes shared across files
  • Use @type annotations for reactive variables
  • Follow vue-expert patterns adapted for JavaScript

MUST NOT DO

  • Use TypeScript syntax (no <script setup lang="ts">)
  • Use .ts file extensions
  • Skip JSDoc types for public APIs
  • Use CommonJS require() in Vue files
  • Ignore type safety entirely
  • Mix TypeScript files with JavaScript in the same component

Output Templates

When implementing Vue features in JavaScript:

  1. Component file with <script setup> (no lang attribute) and JSDoc-typed props/emits
  2. @typedef definitions for complex prop or state shapes
  3. Composable with @param and @returns annotations
  4. Brief note on type coverage

Knowledge Reference

Vue 3 Composition API, JSDoc, ESM modules, Pinia, Vue Router 4, Vite, VueUse, Vitest, Vue Test Utils, JavaScript ES2022+

Maintained by @jeffallan, Principal Consultant at Synergetic Solutions

Documentation

來源與署名

來源:jeffallan/claude-skills位於skills/vue-expert-js提交1be15d8

授權條款: MIT

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架