Token导航 LogoToken导航

Agent Skill · 开发

capacitor-vue(capacitor Vue 开发)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

capacitor-vue 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 11,429。

总安装 1,772周安装 71GitHub Stars 19下载 574核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:capacitor-vue(capacitor Vue 开发)
来源仓库:https://github.com/capawesome-team/skills
仓库路径:skills/capacitor-vue
安装命令:
npx skills add https://github.com/capawesome-team/skills --skill capacitor-vue
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/capawesome-team/skills --skill capacitor-vue

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于辅助 Vue 相关前端页面、组件和样式开发与维护。适合生成或审查 React、Vue、Tailwind、CSS 等代码。可整理组件结构或定位布局和性能问题。capacitor-vue 属于开发类 Skill,可作为该场景下的辅助能力补充。需结合项目设计系统、路由和构建方式使用。

安装前建议确认仓库权限,避免只生成孤立代码片段。

来源仓库内路径:skills/capacitor-vue

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/capawesome-team/skills --skill capacitor-vue;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

capacitor-vue 怎么安装?

在终端执行 npx skills add https://github.com/capawesome-team/skills --skill capacitor-vue。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

capacitor-vue 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

capacitor-vue 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

capacitor-vue 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

capacitor-vue 用的人多吗?

公开数据是累计安装 1,772 次,近一周安装 71 次,下载 574 次,GitHub 19 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

capacitor-vue 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
capacitor-vue

capacitor Vue 开发 · 本页

1,77219需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

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

  1. Capacitor 6, 7, or 8 app with Vue 3.
  2. Node.js and npm installed.
  3. For iOS: Xcode installed.
  4. 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.ts or capacitor.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:

  1. Vue version: Read vue version from package.json.
  2. Capacitor version: Read @capacitor/core version from package.json. If not present, Capacitor has not been added yet — proceed to Step 2.
  3. Meta-framework: Detect the framework by checking for these files in order:

- quasar.config.js or quasar.config.ts — Quasar project. Proceed to references/quasar.md. - nuxt.config.ts or nuxt.config.js — Nuxt project. Proceed to references/nuxt.md. - vite.config.ts or vite.config.js — Plain Vue (Vite) project. Continue with the steps below.

  1. Platforms: Check which directories exist (android/, ios/).
  2. Capacitor config format: Check for capacitor.config.ts (TypeScript) or capacitor.config.json (JSON).
  3. Build output directory: Read build.outDir from vite.config.ts or vite.config.js. The default is dist.

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).

  1. Install Capacitor core and CLI: npm install @capacitor/core npm install -D @capacitor/cli
  2. Initialize Capacitor: npx cap init When prompted, set the web directory to the Vue build output path detected in Step 1. For Vite-based Vue projects, this is typically dist.
  3. Verify the webDir value in the generated capacitor.config.ts or capacitor.config.json matches 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"}
  4. 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/ and ios/ 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)

Wrapping Capacitor plugins in composables provides reusability, encapsulated reactive state, and automatic cleanup:

// src/composables/useCamera.ts
import { ref } from 'vue';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import type { Photo } from '@capacitor/camera';

export function useCamera() {
  const photo = ref<Photo | null>(null);
  const error = ref<string | null>(null);

  async function takePhoto(): Promise<void> {
    try {
      error.value = null;
      photo.value = await Camera.getPhoto({
        quality: 90,
        allowEditing: false,
        resultType: CameraResultType.Uri,
        source: CameraSource.Camera,
      });
    } catch (e) {
      error.value = e instanceof Error ? e.message : String(e);
    }
  }

  async function pickFromGallery(): Promise<void> {
    try {
      error.value = null;
      photo.value = await Camera.getPhoto({
        quality: 90,
        allowEditing: false,
        resultType: CameraResultType.Uri,
        source: CameraSource.Photos,
      });
    } catch (e) {
      error.value = e instanceof Error ? e.message : String(e);
    }
  }

  return {
    photo,
    error,
    takePhoto,
    pickFromGallery,
  };
}

Use the composable in a component:

<script setup lang="ts">
import { useCamera } from '@/composables/useCamera';

const { photo, error, takePhoto } = useCamera();
</script>

<template>
  <div>
    <button @click="takePhoto">Take Photo</button>
    <p v-if="error">Error: {{ error }}</p>
    <img v-if="photo?.webPath" :src="photo.webPath" alt="Captured photo" />
  </div>
</template>

Step 5: Plugin Event Listeners with Lifecycle Hooks

Capacitor plugin event listeners must be registered in onMounted and removed in onUnmounted to prevent memory leaks. Vue's reactivity system picks up ref changes automatically, so there is no NgZone-equivalent issue — but cleanup is still critical.

Composable with Automatic Cleanup
// src/composables/useNetwork.ts
import { ref, onMounted, onUnmounted } from 'vue';
import { Network } from '@capacitor/network';
import type { ConnectionStatus } from '@capacitor/network';
import type { PluginListenerHandle } from '@capacitor/core';

export function useNetwork() {
  const status = ref<ConnectionStatus | null>(null);
  let listenerHandle: PluginListenerHandle | null = null;

  onMounted(async () => {
    status.value = await Network.getStatus();
    listenerHandle = await Network.addListener('networkStatusChange', (newStatus) => {
      status.value = newStatus;
    });
  });

  onUnmounted(async () => {
    await listenerHandle?.remove();
  });

  return {
    status,
  };
}

Usage in a component:

<script setup lang="ts">
import { useNetwork } from '@/composables/useNetwork';

const { status } = useNetwork();
</script>

<template>
  <p v-if="status">Network: {{ status.connected ? 'Online' : 'Offline' }}</p>
</template>
App-Wide Listeners via App.vue

For listeners that should persist for the entire app lifecycle (e.g., app state changes), register them in App.vue:

<!-- src/App.vue -->
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue';
import { App } from '@capacitor/app';
import type { PluginListenerHandle } from '@capacitor/core';
import { RouterView } from 'vue-router';

let appStateListener: PluginListenerHandle | null = null;

onMounted(async () => {
  appStateListener = await App.addListener('appStateChange', (state) => {
    console.log('App state changed. Is active:', state.isActive);
  });
});

onUnmounted(async () => {
  await appStateListener?.remove();
});
</script>

<template>
  <RouterView />
</template>

Step 6: Platform Detection

Use Capacitor.isNativePlatform() and Capacitor.getPlatform() to conditionally run native-only code. Wrap this in a composable for reuse:

// src/composables/usePlatform.ts
import { Capacitor } from '@capacitor/core';

export function usePlatform() {
  const platform = Capacitor.getPlatform() as 'web' | 'ios' | 'android';
  const isNative = Capacitor.isNativePlatform();
  const isIos = platform === 'ios';
  const isAndroid = platform === 'android';
  const isWeb = platform === 'web';

  return {
    platform,
    isNative,
    isIos,
    isAndroid,
    isWeb,
  };
}

Use it in components to show/hide native-only features:

<script setup lang="ts">
import { usePlatform } from '@/composables/usePlatform';

const { isNative } = usePlatform();
</script>

<template>
  <button v-if="isNative" @click="openNativeSettings()">Open Device Settings</button>
</template>

Step 7: Deep Link Routing with Vue Router

Handle deep links by mapping Capacitor's App.addListener('appUrlOpen',...) event to Vue Router navigation. Set this up in App.vue or a dedicated composable:

// src/composables/useDeepLinks.ts
import { onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { App } from '@capacitor/app';
import type { PluginListenerHandle } from '@capacitor/core';

export function useDeepLinks() {
  const router = useRouter();
  let listenerHandle: PluginListenerHandle | null = null;

  onMounted(async () => {
    listenerHandle = await App.addListener('appUrlOpen', (event) => {
      const url = new URL(event.url);
      const path = url.pathname;

      // Navigate to the route matching the deep link path.
      // Adjust the path parsing logic to match the app's URL scheme.
      if (path) {
        router.push(path);
      }
    });
  });

  onUnmounted(async () => {
    await listenerHandle?.remove();
  });
}

Use the composable in App.vue:

<!-- src/App.vue -->
<script setup lang="ts">
import { useDeepLinks } from '@/composables/useDeepLinks';

useDeepLinks();
</script>

<template>
  <RouterView />
</template>

Step 8: Back Button Handling (Android)

Handle the Android hardware back button using App.addListener('backButton',...) combined with Vue Router:

// src/composables/useBackButton.ts
import { onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { App } from '@capacitor/app';
import { Capacitor } from '@capacitor/core';
import type { PluginListenerHandle } from '@capacitor/core';

export function useBackButton() {
  const router = useRouter();
  let listenerHandle: PluginListenerHandle | null = null;

  onMounted(async () => {
    if (Capacitor.getPlatform() !== 'android') {
      return;
    }

    listenerHandle = await App.addListener('backButton', ({ canGoBack }) => {
      if (canGoBack) {
        router.back();
      } else {
        App.exitApp();
      }
    });
  });

  onUnmounted(async () => {
    await listenerHandle?.remove();
  });
}

Use the composable in App.vue:

<!-- src/App.vue -->
<script setup lang="ts">
import { useBackButton } from '@/composables/useBackButton';

useBackButton();
</script>

<template>
  <RouterView />
</template>

Step 9: PWA Elements Setup

Some Capacitor plugins (e.g., Camera, Toast) require @ionic/pwa-elements for web fallback UI. If the project uses any of these plugins and targets the web:

  1. Install PWA Elements: npm install @ionic/pwa-elements
  2. Register the custom elements in src/main.ts before createApp(): import {createApp} from 'vue'; import {defineCustomElements} from '@ionic/pwa-elements/loader'; import App from './App.vue'; import router from './router'; defineCustomElements(window); const app = createApp(App); app.use(router); app.mount('#app');

Step 10: Build and Sync Workflow

After making changes to the Vue app, build and sync to native platforms:

npm run build
npx cap sync

To run on a device or emulator:

npx cap run android
npx cap run ios

To open the native IDE for advanced configuration or debugging:

npx cap open android
npx cap open ios

For live reload during development:

npx cap run android --livereload --external
npx cap run ios --livereload --external

This starts the Vite dev server internally and configures the native app to load from the development server.

Error Handling

  • webDir mismatch: If npx cap sync copies the wrong files, verify that webDir in capacitor.config.ts or capacitor.config.json matches the Vue build output path. For Vite-based Vue projects, the default output directory is dist.
  • Plugin not found at runtime: Run npx cap sync after installing any new plugin. Verify the plugin appears in package.json dependencies.
  • Memory leaks from listeners: Always remove plugin listeners in onUnmounted. Store the PluginListenerHandle returned by addListener and call handle.remove() on unmount.
  • Deep links not working: Verify the app URL scheme or universal links are configured in the native projects (android/app/src/main/AndroidManifest.xml for Android, ios/App/App/Info.plist and associated domain entitlement for iOS). Verify useDeepLinks() is called in App.vue.
  • Back button closes app unexpectedly: Ensure the back button listener checks canGoBack before calling App.exitApp(). Only exit when there is no navigation history.
  • PWA Elements not rendering on web: Verify defineCustomElements(window) is called in src/main.ts before createApp(). Verify @ionic/pwa-elements is installed.
  • Quasar project — Capacitor not detected: Use quasar mode add capacitor instead of manually installing Capacitor. See references/quasar.md.
  • Nuxt project — build output not compatible: Nuxt's default SSR output is not compatible with Capacitor. The project must use ssr: false in nuxt.config.ts to generate a static SPA. See references/nuxt.md.

Related Skills

  • capacitor-app-creation — Create a new Capacitor app from scratch.
  • capacitor-app-development — General Capacitor development guidance not specific to Vue.
  • capacitor-plugins — Install and configure Capacitor plugins from official and community sources.
  • ionic-vue — Ionic Framework with Vue (UI components, navigation, theming on top of Capacitor).
  • capacitor-app-upgrades — Upgrade a Capacitor app to a newer major version.

平台分布

Codex

34.93%
按下载量换算200

Claude

31.51%
按下载量换算181

Cursor

19.14%
按下载量换算110

Gemini CLI

9.34%
按下载量换算54

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills