mozumasu/dotfiles/vue-conventions
Claude Code and agent skill by mozumasu/dotfiles
- community
Checking that the SKILL.md file is still in the repository.
Vue 3 コンポーネント・composable を書く / レビューするときのコーディング規約。 *.vue ファイルの作成・編集、「Vueコンポーネントを作って」「composableを書いて」 「Vueのコードをレビューして」などのリクエストで使用する。 Slidev テーマのレイアウト実装にも適用する (Slidev 固有 API は slidev-theme-dev スキル参照)。
Install
npx vskill@latest install mozumasu/dotfiles/vue-conventionsSKILL.md
Vue 3 コーディング規約
Vue 公式スタイルガイド (<https://vuejs.org/style-guide/>) をベースにした個人規約。 API の解説ではなく「こう書く」の列挙。API の詳細は docs-researcher / context7 で最新を引くこと。
基本方針
- Composition API + `<script setup lang="ts">` で統一。Options API は書かない
- SFC のブロック順は
<script>→<template>→<style> - リアクティブ状態は `ref()` を第一選択にする (
reactive()はプリミティブ不可・
再代入不可・分割代入で喪失の制限があるため使わない)
命名
- コンポーネント名は複数語の PascalCase (
TodoItem○ /Todo×)。ファイル名も PascalCase - 汎用 presentational コンポーネントは
Baseプレフィックス (BaseButton) - 親に密結合な子は親名をプレフィックス (
TodoListItem) - 名前は「最上位概念 → 修飾語」の順 (
SearchButtonClear○ /ClearSearchButton×)。略語禁止 - テンプレート内は PascalCase + 内容がなければ自己終了タグ (
<MyComponent />)
props / emits / v-model
- props は type-based 宣言 + Reactive Props Destructure でデフォルト値 (Vue 3.5+):
``ts const { msg = 'hello', count } = defineProps<{ msg?: string; count: number }>() ``
withDefaults は 3.4 以前のレガシー。runtime 宣言と型宣言の混在は不可
- emits は named tuple 構文 (3.3+)。call signature 構文は使わない:
``ts const emit = defineEmits<{ change: [id: number] }>() ``
- v-model は `defineModel()` (3.4+)。
modelValueprop + emit の手動実装はしない - props の直接変更は禁止 (props down, events up)
script setup
- コンポーネントオプションは
defineOptions()(別<script>ブロックを作らない) - 外部公開が必要なものだけ
defineExpose() - テンプレート ref は
useTemplateRef()(3.5+)。ref(null)+ 同名変数の旧パターンは使わない - provide/inject は
InjectionKey<T>で型付けする
composables
- 命名は
use+ camelCase (useMouse)。composables/ディレクトリに置く - 引数は ref / getter / 生値を受けられるようにし
toValue()で正規化する - 戻り値は refs を含むプレーンオブジェクト (
reactive()で包まない) - DOM 副作用は
onMounted()内 +onUnmounted()で必ずクリーンアップ - 呼び出しは
<script setup>/ ライフサイクルフック内で同期的に行う
テンプレート
v-forには必ず一意なkeyv-ifとv-forを同一要素に併用しない (computed でフィルタ or<template>でラップ)- 複雑な式は computed へ。複雑な computed は小さく分割
v-htmlは使わない (XSS)。改行入りテキストの描画は行分割した配列をv-forで回す- ディレクティブは短縮記法 (
:@#) で統一。属性値は常にクォート - 複数属性の要素は 1 属性 1 行
スタイル
- コンポーネントのスタイルは
scopedにする (ルートレイアウトは例外) scoped内で要素セレクタを使わない (class セレクタを使う)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.config/claude/skills/vue-conventions/SKILL.md
Popularity
- Repository stars
- 139
- Repository forks
- 1
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mozumasu/dotfiles/vue-conventions)