jpskill.com
🛠️ 開発・MCP コミュニティ

Vue.js案件で必須、Composition APIとTypeScriptを推奨し、Vue 3、SSR、Volar、vue-tscに対応、VueやVite関連作業で活用し、原則Composition APIを使用する開発を支援するSkill。

vue-best-practices

Vue.jsプロジェクトにおいて、Composition APIと`<script setup>`、TypeScriptを標準的なアプローチとして強く推奨し、Vue 3、SSR、Volar、vue-tscなど、Vue関連のあらゆる作業に対応するためのベストプラクティスを提供するSkill。

📜 元の英語説明(参考)

MUST be used for Vue.js tasks. Strongly recommends Composition API with `<script setup>` and TypeScript as the standard approach. Covers Vue 3, SSR, Volar, vue-tsc. Load for any Vue, .vue files, Vue Router, Pinia, or Vite with Vue work. ALWAYS use Composition API unless the project explicitly requires Options API.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Vue.jsプロジェクトにおいて、Composition APIと`<script setup>`、TypeScriptを標準的なアプローチとして強く推奨し、Vue 3、SSR、Volar、vue-tscなど、Vue関連のあらゆる作業に対応するためのベストプラクティスを提供するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o vue-best-practices.zip https://jpskill.com/download/5551.zip && unzip -o vue-best-practices.zip && rm vue-best-practices.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/5551.zip -OutFile "$d\vue-best-practices.zip"; Expand-Archive "$d\vue-best-practices.zip" -DestinationPath $d -Force; ri "$d\vue-best-practices.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して vue-best-practices.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → vue-best-practices フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-18
同梱ファイル
23

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Vue のベストプラクティスワークフロー

このスキルを指示セットとして使用してください。ユーザーが明示的に異なる順序を要求しない限り、ワークフローを順番に実行してください。

基本原則

  • 状態を予測可能に保つ: 信頼できる唯一の情報源を持ち、そこからすべてを派生させます。
  • データフローを明示的にする: ほとんどの場合、Props は下へ、Events は上へ。
  • 小さく、焦点を絞ったコンポーネントを優先する: テスト、再利用、保守が容易になります。
  • 不要な再レンダリングを避ける: 算出プロパティとウォッチャーを賢く使用します。
  • 可読性を重視する: 明確で自己文書化されたコードを書きます。

1) コーディング前にアーキテクチャを確認する (必須)

  • デフォルトのスタック: Vue 3 + Composition API + <script setup lang="ts">
  • プロジェクトが明示的に Options API を使用している場合、利用可能であれば vue-options-api-best-practices スキルをロードします。
  • プロジェクトが明示的に JSX を使用している場合、利用可能であれば vue-jsx-best-practices スキルをロードします。

1.1 必読のコアリファレンス (必須)

  • Vue タスクを実装する前に、これらのコアリファレンスを読み、適用するようにしてください。
    • references/reactivity.md
    • references/sfc.md
    • references/component-data-flow.md
    • references/composables.md
  • これらのリファレンスは、特定の問題が発生したときだけでなく、タスク全体を通してアクティブな作業コンテキストに保ってください。

1.2 コーディング前にコンポーネントの境界を計画する (必須)

些細ではない機能については、実装前に簡単なコンポーネントマップを作成してください。

  • 各コンポーネントの単一責任を1文で定義します。
  • エントリ/ルートおよびルートレベルのビューコンポーネントは、デフォルトでコンポジションサーフェスとして保持します。
  • タスクが意図的に小さな単一ファイルデモでない限り、機能 UI と機能ロジックをエントリ/ルート/ビューコンポーネントから移動します。
  • マップ内の各子コンポーネントの props/emits 契約を定義します。
  • 複数のコンポーネントを追加する場合は、機能フォルダレイアウト (components/<feature>/...composables/use<Feature>.ts) を優先します。

2) 必須の Vue の基礎を適用する (必須)

これらは必須の、知っておくべき基礎です。セクション 1.1 で既にロードされているコアリファレンスを使用して、すべての Vue タスクでこれらすべてを適用してください。

リアクティビティ

  • 1.1 からの必読リファレンス: reactivity
  • ソースの状態を最小限に保ち (ref/reactive)、computed で可能な限りすべてを派生させます。
  • 必要に応じて、副作用のためにウォッチャーを使用します。
  • テンプレート内でコストのかかるロジックを再計算するのを避けます。

SFC 構造とテンプレートの安全性

  • 1.1 からの必読リファレンス: sfc
  • SFC セクションをこの順序で保持します: <script><template><style>
  • SFC の責任を集中させ、大きなコンポーネントは分割します。
  • テンプレートを宣言的に保ち、分岐/派生をスクリプトに移動します。
  • Vue のテンプレート安全ルール (v-html、リストレンダリング、条件付きレンダリングの選択) を適用します。

コンポーネントに焦点を当てる

コンポーネントが複数の明確な責任 (例: データオーケストレーション + UI、または複数の独立した UI セクション) を持つ場合に分割します。

  • 1つの「メガコンポーネント」よりも小さなコンポーネント + コンポーザブルを優先します。
  • UI セクションを子コンポーネントに移動します (props は入力、イベントは出力)。
  • 状態/副作用をコンポーザブル (useXxx()) に移動します。

客観的な分割トリガーを適用します。いずれかの条件が真である場合にコンポーネントを分割します。

  • オーケストレーション/状態と、複数のセクションに対する実質的なプレゼンテーションマークアップの両方を所有している場合。
  • 3つ以上の異なる UI セクションがある場合 (例: フォーム、フィルター、リスト、フッター/ステータス)。
  • テンプレートブロックが繰り返されているか、再利用可能になる可能性がある場合 (アイテム行、カード、リストエントリ)。

エントリ/ルートおよびルートビューのルール:

  • エントリ/ルートおよびルートビューコンポーネントを薄く保ちます: アプリケーションシェル/レイアウト、プロバイダーの配線、および機能のコンポジション。
  • 独立した部分を含む機能の場合、エントリ/ルート/ビューコンポーネントに完全な機能実装を配置しないでください。
  • CRUD/リスト機能 (todo、テーブル、カタログ、受信トレイ) の場合、少なくとも以下に分割します。
    • 機能コンテナコンポーネント
    • 入力/フォームコンポーネント
    • リスト (および/またはアイテム) コンポーネント
    • フッター/アクションまたはフィルター/ステータスコンポーネント
  • 非常に小さな使い捨てデモの場合にのみ単一ファイルの実装を許可します。選択した場合は、分割が不要な理由を明示的に正当化してください。

コンポーネントのデータフロー

  • 1.1 からの必読リファレンス: component-data-flow
  • 主要なモデルとして、props は下へ、イベントは上へを使用します。
  • v-model は真の双方向コンポーネント契約の場合にのみ使用します。
  • provide/inject は、深いツリーの依存関係または共有コンテキストの場合にのみ使用します。
  • definePropsdefineEmits、および必要に応じて InjectionKey を使用して、契約を明示的かつ型付けされたものに保ちます。

コンポーザブル

  • 1.1 からの必読リファレンス: composables
  • ロジックが再利用される場合、状態を持つ場合、または副作用が多い場合に、コンポーザブルに抽出します。
  • コンポーザブル API を小さく、型付けされ、予測可能なものに保ちます。
  • 機能ロジックをプレゼンテーションコンポーネントから分離します。

3) 要件がある場合にのみオプション機能を検討する

3.1 標準オプション機能

これらをデフォルトで追加しないでください。要件がある場合にのみ、対応するリファレンスをロードしてください。

  • Slots: 親が子のコンテンツ/レイアウトを制御する必要がある場合 -> component-slots
  • Fallthrough attributes: ラッパー/ベースコンポーネントが attrs/events を安全に転送する必要がある場合 -> component-fallthrough-attrs
  • 組み込みコンポーネント <KeepAlive> (状態を持つビューのキャッシュ用) -> component-keep-alive
  • 組み込みコンポーネント <Teleport> (オーバーレイ/ポータル用) -> component-teleport
  • 組み込みコンポーネント <Suspense> (非同期サブツリーのフォールバック境界用) -> component-suspense
  • アニメーション関連機能: 必要なモーション動作に一致する最もシンプルなアプローチを選択します。
    • 組み込みコンポーネント <Transition> (enter/leave エフェクト用) -> transition
    • 組み込みコンポーネント <TransitionGroup> (アニメーション化されたリストの変更用) -> transition-group
    • クラスベースのアニメーション (enter/leave 以外のエフェクト用) -> [animation-class-based-technique](re
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Vue Best Practices Workflow

Use this skill as an instruction set. Follow the workflow in order unless the user explicitly asks for a different order.

Core Principles

  • Keep state predictable: one source of truth, derive everything else.
  • Make data flow explicit: Props down, Events up for most cases.
  • Favor small, focused components: easier to test, reuse, and maintain.
  • Avoid unnecessary re-renders: use computed properties and watchers wisely.
  • Readability counts: write clear, self-documenting code.

1) Confirm architecture before coding (required)

  • Default stack: Vue 3 + Composition API + <script setup lang="ts">.
  • If the project explicitly uses Options API, load vue-options-api-best-practices skill if available.
  • If the project explicitly uses JSX, load vue-jsx-best-practices skill if available.

1.1 Must-read core references (required)

  • Before implementing any Vue task, make sure to read and apply these core references:
    • references/reactivity.md
    • references/sfc.md
    • references/component-data-flow.md
    • references/composables.md
  • Keep these references in active working context for the entire task, not only when a specific issue appears.

1.2 Plan component boundaries before coding (required)

Create a brief component map before implementation for any non-trivial feature.

  • Define each component's single responsibility in one sentence.
  • Keep entry/root and route-level view components as composition surfaces by default.
  • Move feature UI and feature logic out of entry/root/view components unless the task is intentionally a tiny single-file demo.
  • Define props/emits contracts for each child component in the map.
  • Prefer a feature folder layout (components/<feature>/..., composables/use<Feature>.ts) when adding more than one component.

2) Apply essential Vue foundations (required)

These are essential, must-know foundations. Apply all of them in every Vue task using the core references already loaded in section 1.1.

Reactivity

  • Must-read reference from 1.1: reactivity
  • Keep source state minimal (ref/reactive), derive everything possible with computed.
  • Use watchers for side effects if needed.
  • Avoid recomputing expensive logic in templates.

SFC structure and template safety

  • Must-read reference from 1.1: sfc
  • Keep SFC sections in this order: <script><template><style>.
  • Keep SFC responsibilities focused; split large components.
  • Keep templates declarative; move branching/derivation to script.
  • Apply Vue template safety rules (v-html, list rendering, conditional rendering choices).

Keep components focused

Split a component when it has more than one clear responsibility (e.g. data orchestration + UI, or multiple independent UI sections).

  • Prefer smaller components + composables over one “mega component”
  • Move UI sections into child components (props in, events out).
  • Move state/side effects into composables (useXxx()).

Apply objective split triggers. Split the component if any condition is true:

  • It owns both orchestration/state and substantial presentational markup for multiple sections.
  • It has 3+ distinct UI sections (for example: form, filters, list, footer/status).
  • A template block is repeated or could become reusable (item rows, cards, list entries).

Entry/root and route view rule:

  • Keep entry/root and route view components thin: app shell/layout, provider wiring, and feature composition.
  • Do not place full feature implementations in entry/root/view components when those features contain independent parts.
  • For CRUD/list features (todo, table, catalog, inbox), split at least into:
    • feature container component
    • input/form component
    • list (and/or item) component
    • footer/actions or filter/status component
  • Allow a single-file implementation only for very small throwaway demos; if chosen, explicitly justify why splitting is unnecessary.

Component data flow

  • Must-read reference from 1.1: component-data-flow
  • Use props down, events up as the primary model.
  • Use v-model only for true two-way component contracts.
  • Use provide/inject only for deep-tree dependencies or shared context.
  • Keep contracts explicit and typed with defineProps, defineEmits, and InjectionKey as needed.

Composables

  • Must-read reference from 1.1: composables
  • Extract logic into composables when it is reused, stateful, or side-effect heavy.
  • Keep composable APIs small, typed, and predictable.
  • Separate feature logic from presentational components.

3) Consider optional features only when requirements call for them

3.1 Standard optional features

Do not add these by default. Load the matching reference only when the requirement exists.

3.2 Less-common optional features

Use these only when there is explicit product or technical need.

  • Directives: behavior is DOM-specific and not a good composable/component fit -> directives
  • Async components: heavy/rarely-used UI should be lazy loaded -> component-async
  • Render functions only when templates cannot express the requirement -> render-functions
  • Plugins when behavior must be installed app-wide -> plugins
  • State management patterns: app-wide shared state crosses feature boundaries -> state-management

4) Run performance optimization after behavior is correct

Performance work is a post-functionality pass. Do not optimize before core behavior is implemented and verified.

5) Final self-check before finishing

  • Core behavior works and matches requirements.
  • All must-read references were read and applied.
  • Reactivity model is minimal and predictable.
  • SFC structure and template rules are followed.
  • Components are focused and well-factored, splitting when needed.
  • Entry/root and route view components remain composition surfaces unless there is an explicit small-demo exception.
  • Component split decisions are explicit and defensible (responsibility boundaries are clear).
  • Data flow contracts are explicit and typed.
  • Composables are used where reuse/complexity justifies them.
  • Moved state/side effects into composables if applicable
  • Optional features are used only when requirements demand them.
  • Performance changes were applied only after functionality was complete.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。