用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill capacitor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | capacitor |
| description | Capacitor cross-platform native runtime. Use for web to native. |
Capacitor by Ionic is a cross-platform native runtime that makes it easy to build web apps that run on iOS, Android, and the web as Progressive Web Apps (PWAs). It provides a bridge to native APIs.
npm install @capacitor/core @capacitor/cli
npx cap init MyMobileApp com.example.app
npm install @capacitor/android @capacitor/ios
npx cap add android
npx cap add ios
import { Geolocation } from "@capacitor/geolocation";
const printCurrentPosition = async () => {
const coordinates = await Geolocation.getCurrentPosition();
console.log("Current position:", coordinates);
};
Capacitor injects a native bridge into the WebView, allowing JavaScript to call Native Code (Java/Kotlin/Swift/Obj-C) asynchronously.
Modular blocks of code that provide interface to native functionality.
Capacitor treats native projects (android/, ios/) as "source artifacts", meaning you commit them to git and use native tooling (Android Studio/Xcode) to build and configure them (permissions, icons).
Use @capacitor-community/http for secure requests (bypassing CORS) and secure storage plugins for tokens (Keychain/Keystore) instead of localStorage.
Handle custom URL schemes (myapp://) for authentication redirects or opening specific content.
Do:
npx cap sync.npx cap run android -l --external.Don't:
alert()/confirm(); use Capacitor Dialog plugin or UI framework modals.| Error | Cause | Solution |
|---|---|---|
Plugin not implemented | Plugin not installed or platform not added. | Run npx cap sync and check imports. |
Cleartext HTTP traffic not permitted | Android security preventing http requests. | Use HTTPS or update network_security_config.xml (dev only). |
Xcode build failed | Pods out of sync or signing issue. | npx cap update ios then check Signing in Xcode. |