Best use case
capacitor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Capacitor cross-platform native runtime. Use for web to native.
Teams using capacitor should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/capacitor/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How capacitor Compares
| Feature / Agent | capacitor | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Capacitor cross-platform native runtime. Use for web to native.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Capacitor
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.
## When to Use
- Converting existing React/Angular/Vue web apps to mobile apps.
- Need specific native functionality (Camera, Haptics, Push) in a web app.
- Building plugins that need to work across iOS, Android, and Web consistent APIs.
## Quick Start
```bash
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
```
```javascript
import { Geolocation } from "@capacitor/geolocation";
const printCurrentPosition = async () => {
const coordinates = await Geolocation.getCurrentPosition();
console.log("Current position:", coordinates);
};
```
## Core Concepts
### Native Bridge
Capacitor injects a native bridge into the WebView, allowing JavaScript to call Native Code (Java/Kotlin/Swift/Obj-C) asynchronously.
### Plugins
Modular blocks of code that provide interface to native functionality.
- **Official Plugins**: Maintained by Ionic team (Camera, Filesystem).
- **Community Plugins**: Maintained by the community.
### Native Project Management
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).
## Common Patterns
### Secure Storage
Use `@capacitor-community/http` for secure requests (bypassing CORS) and secure storage plugins for tokens (Keychain/Keystore) instead of `localStorage`.
### Deep Linking
Handle custom URL schemes (`myapp://`) for authentication redirects or opening specific content.
## Best Practices
**Do**:
- Use **official plugins** whenever possible for long-term maintenance.
- Sync your project frequently: `npx cap sync`.
- Handle **Permissions** gracefully in your UI before calling native APIs.
- Use **Live Reload** during development: `npx cap run android -l --external`.
**Don't**:
- Don't store sensitive data (API Keys) in JS code; use environment variables or native config.
- Don't ignore platform differences; test on real iOS and Android devices.
- Don't rely on `alert()`/`confirm()`; use Capacitor Dialog plugin or UI framework modals.
## Troubleshooting
| 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. |
## References
- [Capacitor Documentation](https://capacitorjs.com/docs)
- [Capacitor Plugins](https://capacitorjs.com/docs/apis)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.