capacitor-vue
БесплатноБез исполняемых скриптовНе проверенGuides the agent through Vue-specific patterns for Capacitor app development. Covers Vue 3 Composition API with Capacitor plugins, custom composables for…
от capawesome-team★ 56 звёзд на GitHubОб этом скилле
Capacitor with Vue
Vue-specific patterns and best practices for Capacitor app development — Composition API, composables, reactivity, lifecycle hooks, Vue Router integration, and framework-specific guidance for Quasar and Nuxt.
Prerequisites
- Capacitor 6, 7, or 8 app with Vue 3.
- Node.js and npm installed.
- For iOS: Xcode installed.
- For Android: Android Studio installed.
Agent Behavior
- Auto-detect before asking. Check the project for
vite.config.ts,vite.config.js,quasar.config.js,quasar.config.ts,nuxt.config.ts,package.json,capacitor.config.tsorcapacitor.config.json, and existing directory structure. Only ask the user when something cannot be detected. - Guide step-by-step. Walk the user through the process one step at a time.
- Detect the meta-framework. Determine whether the project uses plain Vue (Vite), Quasar, or Nuxt, and adapt instructions accordingly.
Procedures
Step 1: Analyze the Project
Auto-detect the following by reading project files:
- Vue version: Read
vueversion frompackage.json. - Capacitor version: Read
@capacitor/coreversion frompackage.json. If not present, Capacitor has not been added yet — proceed to Step 2. - Meta-framework: Detect the framework by checking for these files in order:
quasar.config.jsorquasar.config.ts— Quasar project. Proceed toreferences/quasar.md.nuxt.config.tsornuxt.config.js— Nuxt project. Proceed toreferences/nuxt.md.vite.config.tsorvite.config.js— Plain Vue (Vite) project. Continue with the steps below.
- Platforms: Check which directories exist (
android/,ios/). - Capacitor config format: Check for
capacitor.config.ts(TypeScript) orcapacitor.config.json(JSON). - Build output directory: Read
build.outDirfromvite.config.tsorvite.config.js. The default isdist.
Step 2: Add Capacitor to a Vue Project
Skip if @capacitor/core is already in package.json. Skip if the project uses Quasar (Quasar has its own Capacitor integration — see references/quasar.md).
Install Capacitor core and CLI:
npm install @capacitor/core npm install -D @capacitor/cliInitialize Capacitor:
npx cap initWhen prompted, set the web directory to the Vue build output path detected in Step 1. For Vite-based Vue projects, this is typically
dist.Verify the
webDirvalue in the generatedcapacitor.config.tsorcapacitor.config.jsonmatches the Vue build output path. If incorrect, update it:capacitor.config.ts:import type { CapacitorConfig } from '@capacitor/cli'; const config: CapacitorConfig = { appId: 'com.example.app', appName: 'my-app', webDir: 'dist', }; export default config;capacitor.config.json:{ "appId": "com.example.app", "appName": "my-app", "webDir": "dist" }Build the Vue app and add platforms:
npm run build npm install @capacitor/android @capacitor/ios npx cap add android npx cap add ios npx cap sync
Step 3: Project Structure
A Capacitor Vue project (Vite-based) has this structure:
my-app/
├── android/ # Android native project
├── ios/ # iOS native project
├── public/
├── src/
│ ├── assets/
│ ├── components/
│ ├── composables/ # Custom composables for Capacitor plugins
│ ├── router/
│ │ └── index.ts # Vue Router configuration
│ ├── views/
│ ├── App.vue
│ └── main.ts
├── capacitor.config.ts # or capacitor.config.json
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
Key points:
- The
android/andios/directories contain native projects and should be committed to version control. - The
src/directory contains the Vue app, which is the web layer of the Capacitor app. - Place custom composables that wrap Capacitor plugins in
src/composables/. - Capacitor plugins are called from Vue components or composables inside
src/.
Step 4: Using Capacitor Plugins in Vue
Capacitor plugins are plain TypeScript APIs. Import and call them directly in Vue components using the Composition API.
Direct Usage in a Component
<script setup lang="ts">
import { ref } from 'vue';
import { Geolocation } from '@capacitor/geolocation';
const latitude = ref<number | null>(null);
const longitude = ref<number | null>(null);
async function getCurrentPosition() {
const position = await Geolocation.getCurrentPosition();
latitude.value = position.coords.latitude;
longitude.value = position.coords.longitude;
}
</script>
<template>
<div>
<p>Latitude: {{ latitude }}</p>
<p>Longitude: {{ longitude }}</p>
<button @click="getCurrentPosition">Get Location</button>
</div>
</template>
Wrapping Plugins in Composables (Recommended)
Установить capacitor-vue в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл capacitor-vue?
Guides the agent through Vue-specific patterns for Capacitor app development. Covers Vue 3 Composition API with Capacitor plugins, custom composables for native features, reactive plugin state, lifecycle hook patterns, Vue Router deep link integration, platform detection, PWA Elements setup, Quasar Framework integration, and Nuxt integration. Do not use for creating a new Capacitor app from scratch, upgrading Capacitor versions, installing specific plugins, Ionic Framework with Vue setup, or non-Vue frameworks.
Как установить скилл capacitor-vue?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл capacitor-vue запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic