Vueのロゴ

Vue

コミュニティ
alpham8
vue

Use when developing Vue.js components - Vue 2 Options API, Vue 3 Composition API, script setup, reactivity (ref, reactive, computed, watch), props, emits, slots, provide/inject, lifecycle hooks, directives, TypeScript integration. Triggers on .vue files, Vue components, Shopware 6 Administration.

概要

公開者alpham8
リポジトリagentic-webdev
スキル名vue
スター
4
フォーク
0
同梱ファイル
指示のみ
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    alpham8がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルVueをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/alpham8/agentic-webdev/tree/master/skills/vue
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alpham8/agentic-webdev.git /tmp/agentic-webdev
mkdir -p .claude/skills
cp -r /tmp/agentic-webdev/skills/vue .claude/skills/vue
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでVueを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にVueを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Vueは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Vue.js

Related Skills

NeedSkill
TypeScript language referencetypescript
Shopware 6 plugin development (Admin uses Vue)shopware
Symfony framework (backend)symfony

Shopware 6 Administration is built on Vue. SW 6.4/6.5 use Vue 2 (Options API), SW 6.6+ use Vue 3.


Overview

Vue.js is a progressive framework for building user interfaces. It uses a virtual DOM, reactive data binding, and a component-based architecture.

Vue 3 (current) supports two API styles:

  • Composition API with <script setup> — recommended for new code
  • Options API — still supported, used in Shopware 6 Admin (≤6.5)

Composition API (<script setup>)

Reactive State

vue
<script setup lang="ts">
import { ref, reactive, computed, watch, onMounted } from 'vue';

// ref — for primitives and single values
const count = ref(0);
const name = ref('');

// reactive — for objects (deep reactivity)
const form = reactive({
    email: '',
    password: '',
    rememberMe: false,
});

// computed — derived values
const isValid = computed(() => form.email !== '' && form.password.length >= 8);

// Access ref value in script: count.value
// In template: {{ count }} (auto-unwrapped)
function increment(): void {
    count.value++;
}
</script>

<template>
    <button @click="increment">Count: {{ count }}</button>
    <p v-if="isValid">Form is valid</p>
</template>

Props

vue
<script setup lang="ts">
interface Props {
    title: string;
    count?: number;
    items: string[];
    variant?: 'primary' | 'secondary';
}

const props = withDefaults(defineProps<Props>(), {
    count: 0,
    variant: 'primary',
});

// Access: props.title, props.count
</script>

Emits

vue
<script setup lang="ts">
interface Emits {
    (e: 'update', value: string): void;
    (e: 'delete', id: number): void;
    (e: 'close'): void;
}

const emit = defineEmits<Emits>();

function handleSave(): void {
    emit('update', 'new value');
}
</script>

v-model on Components

vue
<!-- Parent -->
<SearchInput v-model="query" v-model:filter="activeFilter" />

<!-- SearchInput.vue -->
<script setup lang="ts">
const model = defineModel<string>(); // default v-model
const filter = defineModel<string>('filter'); // named v-model
</script>

<template>
    <input :value="model" @input="model = ($event.target as HTMLInputElement).value" />
    <select :value="filter" @change="filter = ($event.target as HTMLSelectElement).value">
        <option value="all">All</option>
        <option value="active">Active</option>
    </select>
</template>

Watch

vue
<script setup lang="ts">
import { ref, watch, watchEffect } from 'vue';

const query = ref('');
const results = ref<Item[]>([]);

// Watch specific source
watch(query, async (newVal, oldVal) => {
    if (newVal.length >= 3) {
        results.value = await search(newVal);
    }
});

// Watch with options
watch(
    () => form.email,
    (newEmail) => validateEmail(newEmail),
    { immediate: true, deep: false },
);

// watchEffect — auto-tracks dependencies (like Svelte's $effect)
watchEffect(() => {
    console.log(`Query is: ${query.value}`);
});
</script>

Lifecycle Hooks

vue
<script setup lang="ts">
import { onMounted, onUnmounted, onBeforeMount, onUpdated, nextTick } from 'vue';

onMounted(() => {
    // DOM is ready
    initThirdPartyLib();
});

onUnmounted(() => {
    // Cleanup — remove listeners, destroy instances
    thirdPartyLib.destroy();
});

// Wait for next DOM update
async function scrollToEnd(): Promise<void> {
    await nextTick();
    container.value?.scrollTo(0, container.value.scrollHeight);
}
</script>
HookWhen
onBeforeMountBefore initial render
onMountedAfter DOM mount
onBeforeUpdateBefore reactive data re-render
onUpdatedAfter reactive data re-render
onBeforeUnmountBefore component destruction
onUnmountedAfter component removal
onActivated<KeepAlive> component activated
onDeactivated<KeepAlive> component deactivated

Template Refs

vue
<script setup lang="ts">
import { ref, onMounted } from 'vue';

const inputRef = ref<HTMLInputElement | null>(null);

onMounted(() => {
    inputRef.value?.focus();
});
</script>

<template>
    <input ref="inputRef" />
</template>

Provide / Inject (Dependency Injection)

vue
<!-- Provider (parent/ancestor) -->
<script setup lang="ts">
import { provide, ref } from 'vue';
import type { InjectionKey } from 'vue';

export const ThemeKey: InjectionKey<Ref<string>> = Symbol('theme');

const theme = ref('light');
provide(ThemeKey, theme);
</script>

<!-- Consumer (child/descendant) -->
<script setup lang="ts">
import { inject } from 'vue';
import { ThemeKey } from './provider';

const theme = inject(ThemeKey, ref('light')); // with default
</script>

Composables (Reusable Logic)

typescript
// composables/useCounter.ts
import { ref, type Ref } from 'vue';

interface UseCounterReturn {
    count: Ref<number>;
    increment: () => void;
    decrement: () => void;
    reset: () => void;
}

export function useCounter(initial = 0): UseCounterReturn {
    const count = ref(initial);

    return {
        count,
        increment: () => count.value++,
        decrement: () => count.value--,
        reset: () => { count.value = initial; },
    };
}
vue
<script setup lang="ts">
import { useCounter } from '@/composables/useCounter';

const { count, increment, reset } = useCounter(10);
</script>

Options API (Vue 2 / Shopware Admin)

Used in Shopware 6 Administration (≤6.5 = Vue 2, ≥6.6 = Vue 3 but still Options API in many places).

javascript
export default {
    name: 'sw-example-list',

    inject: ['repositoryFactory'],

    mixins: [Mixin.getByName('listing')],

    props: {
        title: { type: String, required: true },
        limit: { type: Number, default: 25 },
    },

    data() {
        return {
            items: [],
            isLoading: false,
            searchTerm: '',
        };
    },

    computed: {
        repository() {
            return this.repositoryFactory.create('product');
        },

        filteredItems() {
            if (this.searchTerm === '') {
                return this.items;
            }
            return this.items.filter(item =>
                item.name.toLowerCase().includes(this.searchTerm.toLowerCase()),
            );
        },
    },

    watch: {
        searchTerm: {
            handler(newVal) {
                this.loadItems(newVal);
            },
            immediate: false,
        },
    },

    created() {
        this.loadItems();
    },

    methods: {
        async loadItems(search = '') {
            this.isLoading = true;
            const { Criteria } = Shopware.Data;
            const criteria = new Criteria();

            if (search !== '') {
                criteria.addFilter(Criteria.contains('name', search));
            }

            criteria.setLimit(this.limit);
            this.items = await this.repository.search(criteria, Shopware.Context.api);
            this.isLoading = false;
        },
    },
};

Options API Lifecycle

HookWhen
beforeCreateBefore instance init
createdAfter reactive data setup, before DOM
beforeMountBefore initial render
mountedAfter DOM mount
beforeUpdateBefore re-render
updatedAfter re-render
beforeDestroy (Vue 2) / beforeUnmount (Vue 3)Before teardown
destroyed (Vue 2) / unmounted (Vue 3)After teardown

Template Syntax

Directives

vue
<template>
    <!-- Conditionals -->
    <div v-if="status === 'active'">Active</div>
    <div v-else-if="status === 'pending'">Pending</div>
    <div v-else>Inactive</div>

    <div v-show="isVisible">Toggle visibility (CSS display)</div>

    <!-- Lists -->
    <ul>
        <li v-for="item in items" :key="item.id">{{ item.name }}</li>
    </ul>

    <!-- Two-way binding -->
    <input v-model="searchTerm" />
    <input v-model.trim="name" />
    <input v-model.number="age" type="number" />
    <input v-model.lazy="email" />

    <!-- Event handling -->
    <button @click="handleClick">Click</button>
    <button @click.prevent="handleSubmit">Submit</button>
    <input @keyup.enter="search" />
    <div @click.stop="handleInner">Stop propagation</div>

    <!-- Attribute binding -->
    <img :src="imageUrl" :alt="imageAlt" />
    <div :class="{ active: isActive, 'text-danger': hasError }">...</div>
    <div :class="[baseClass, { highlight: isHighlighted }]">...</div>
    <div :style="{ color: textColor, fontSize: size + 'px' }">...</div>

    <!-- Dynamic attributes -->
    <component :is="currentComponent" />
    <div v-bind="$attrs">Spread all attributes</div>

    <!-- Raw HTML (caution: XSS risk) -->
    <div v-html="htmlContent"></div>

    <!-- Once (render once, skip future updates) -->
    <span v-once>{{ staticValue }}</span>
</template>

Event Modifiers

ModifierEffect
.preventevent.preventDefault()
.stopevent.stopPropagation()
.selfOnly trigger if event target is element itself
.onceTrigger at most once
.captureUse capture mode
.passive{ passive: true }

Key Modifiers

vue
<input @keyup.enter="submit" />
<input @keyup.esc="cancel" />
<input @keyup.tab="nextField" />
<div @keydown.ctrl.s.prevent="save">...</div>

Slots

Default Slot

vue
<!-- Card.vue -->
<template>
    <div class="card">
        <slot />
    </div>
</template>

<!-- Usage -->
<Card>
    <p>Card content here</p>
</Card>

Named Slots

vue
<!-- Layout.vue -->
<template>
    <header><slot name="header" /></header>
    <main><slot /></main>
    <footer><slot name="footer" /></footer>
</template>

<!-- Usage -->
<Layout>
    <template #header><h1>Title</h1></template>
    <p>Main content</p>
    <template #footer><small>Footer</small></template>
</Layout>

Scoped Slots (data from child to parent)

vue
<!-- DataTable.vue -->
<template>
    <table>
        <tr v-for="item in items" :key="item.id">
            <slot name="row" :item="item" :index="index" />
        </tr>
    </table>
</template>

<!-- Usage -->
<DataTable :items="products">
    <template #row="{ item }">
        <td>{{ item.name }}</td>
        <td>{{ item.price }}</td>
    </template>
</DataTable>

Custom Directives

vue
<script setup lang="ts">
import type { Directive } from 'vue';

const vFocus: Directive<HTMLElement> = {
    mounted(el) {
        el.focus();
    },
};

const vClickOutside: Directive<HTMLElement, () => void> = {
    mounted(el, binding) {
        el.__clickOutsideHandler = (event: Event) => {
            if (!el.contains(event.target as Node)) {
                binding.value();
            }
        };
        document.addEventListener('click', el.__clickOutsideHandler);
    },
    unmounted(el) {
        document.removeEventListener('click', el.__clickOutsideHandler);
    },
};
</script>

<template>
    <input v-focus />
    <div v-click-outside="closeDropdown">Dropdown</div>
</template>

Transitions

vue
<template>
    <Transition name="fade">
        <div v-if="visible">Content</div>
    </Transition>

    <TransitionGroup name="list" tag="ul">
        <li v-for="item in items" :key="item.id">{{ item.name }}</li>
    </TransitionGroup>
</template>

<style>
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.3s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

.list-enter-active, .list-leave-active {
    transition: all 0.3s ease;
}
.list-enter-from, .list-leave-to {
    opacity: 0;
    transform: translateX(30px);
}
.list-move {
    transition: transform 0.3s ease;
}
</style>

Pinia (State Management, Vue 3)

Replaces Vuex. Used in Shopware 6.7+.

typescript
// stores/counter.ts
import { defineStore } from 'pinia';
import { ref, computed } from 'vue';

export const useCounterStore = defineStore('counter', () => {
    const count = ref(0);
    const doubleCount = computed(() => count.value * 2);

    function increment(): void {
        count.value++;
    }

    return { count, doubleCount, increment };
});
vue
<script setup lang="ts">
import { useCounterStore } from '@/stores/counter';

const counter = useCounterStore();
</script>

<template>
    <button @click="counter.increment">{{ counter.count }}</button>
</template>

Vue 2 → Vue 3 Migration

Vue 2Vue 3
new Vue({ ... })createApp({ ... })
Vue.component()app.component()
Vue.use(plugin)app.use(plugin)
this.$emit('event')emit('event') (Composition API)
this.$refs.nameconst name = ref(null)
data() functionref() / reactive()
computed: { ... }computed(() => ...)
watch: { ... }watch(source, cb)
beforeDestroyonBeforeUnmount
destroyedonUnmounted
$on / $off / $onceRemoved — use external event bus or emits
v-model (single)v-model + v-model:name (multiple)
VuexPinia
Filters ({{ x | filter }})Removed — use computed or methods
$set / $deleteNot needed (Proxy-based reactivity)

Shopware-Specific Vue 2→3 Changes

SW 6.5 (Vue 2)SW 6.6+ (Vue 3)
v-model="val"v-model:value="val" on custom components
vue-meta for page titlesRemoved — use title property
Vuex storesPinia stores (SW 6.7)
Webpack 4Webpack 5 (SW 6.6) / Vite (SW 6.7)

TypeScript with Vue

Component Typing

vue
<script setup lang="ts">
import { ref, computed } from 'vue';

interface User {
    id: number;
    name: string;
    email: string;
}

const users = ref<User[]>([]);
const selectedId = ref<number | null>(null);

const selectedUser = computed<User | undefined>(() =>
    users.value.find(u => u.id === selectedId.value),
);
</script>

Props with Complex Types

vue
<script setup lang="ts">
import type { PropType } from 'vue';

interface Column {
    key: string;
    label: string;
    sortable?: boolean;
}

// Generic props with defineProps
const props = defineProps<{
    columns: Column[];
    data: Record<string, unknown>[];
    loading?: boolean;
}>();

Typed Template Refs

vue
<script setup lang="ts">
import { ref } from 'vue';
import MyComponent from './MyComponent.vue';

const inputRef = ref<HTMLInputElement | null>(null);
const childRef = ref<InstanceType<typeof MyComponent> | null>(null);
</script>

Typed Provide/Inject

typescript
import type { InjectionKey, Ref } from 'vue';

interface UserContext {
    user: Ref<User | null>;
    login: (email: string, password: string) => Promise<void>;
    logout: () => void;
}

export const UserKey: InjectionKey<UserContext> = Symbol('user');

Common Gotchas

  1. ref vs reactive — Use ref for primitives and single values, reactive for objects. Don't destructure reactive() — it loses reactivity. Use toRefs() if needed.
  2. .value in script, not in template — ref.value is needed in <script>, but auto-unwrapped in <template>. Forgetting .value in script is the #1 Vue bug.
  3. v-if vs v-show — v-if removes from DOM (toggle cost), v-show uses CSS display (initial render cost). Use v-show for frequent toggles.
  4. v-for needs :key — Always provide a unique :key. Never use array index as key for dynamic lists.
  5. v-if + v-for — Never use on same element. v-if has higher priority in Vue 3 (opposite from Vue 2). Use a <template> wrapper or computed filter.
  6. Props are readonly — Never mutate props. Use emit to signal changes to parent, or use defineModel for two-way binding.
  7. watch vs watchEffect — watch is explicit about sources and gives old/new values. watchEffect auto-tracks but no old value. Use watch for most cases.
  8. Reactivity lost — Reassigning a reactive object (obj = newObj) breaks reactivity. Use Object.assign(obj, newObj) or switch to ref.
  9. $attrs inheritance — In Vue 3, $attrs includes class and style. Disable with inheritAttrs: false on multi-root components.
  10. Shopware $super — In Shopware Admin overrides, call this.$super('methodName') to invoke the original. Standard Vue has no $super.
  11. Shopware criteria — When overriding categoryCriteria or similar computed, always call this.$super() first, then add associations.
  12. Async setup — <script setup> cannot be async. Use onMounted for async initialization.

Documentation References

よくある質問

AIスキル「Vue」では何ができますか?

Use when developing Vue.js components - Vue 2 Options API, Vue 3 Composition API, script setup, reactivity (ref, reactive, computed, watch), props, emits, slots, provide/inject, lifecycle hooks, directives, TypeScript integration. Triggers on .vue files, Vue components, Shopware 6 Administration.

TypingMindでVueを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Vueはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにVueをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/alpham8/agentic-webdev/tree/master/skills/vueを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Vueを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Vueは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもVueを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Vue」は無料ですか?

alpham8がGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇