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.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "capacitor" with this command: npx skills add g1joshi/agent-skills/g1joshi-agent-skills-capacitor

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

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); };

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

  • Capacitor Plugins

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

claude

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

mariadb

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

figma

No summary provided by upstream source.

Repository SourceNeeds Review