Home › Ionic / Capacitor › Ionic + Capacitor AGENTS.md

Ionic + Capacitor AGENTS.md

AGENTS.md for Ionic 8 apps with Capacitor (Angular, React, or Vue): native plugins, platform sync, and mobile UX rules.

AGENTS.mdIonic / Capacitor

How to use

Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

AGENTS.mdDownload  
# AGENTS.md: Ionic + Capacitor

## Commands
- Web dev: `ionic serve` (or `npm run dev`) · Build: `npm run build` · Native sync: `npx cap sync` · Open: `npx cap open ios|android`
- Live reload on device: `ionic cap run android -l --external` (ask before running on a device).
- Check `package.json` for Ionic and Capacitor majors; plugins must match the Capacitor major.

## Rules
- UI with Ionic components (`ion-page`, `ion-header`, `ion-content`, `ion-list`, `ion-item`) so platform styling, safe areas, and gestures work. Don't hand-roll headers or scroll containers.
- Navigation with the framework's Ionic router integration (`IonRouterOutlet`, `ion-tabs`); keep page lifecycle hooks (`ionViewWillEnter`) for refreshes that must run on back navigation.
- Native features through official `@capacitor/*` plugins (Camera, Filesystem, Preferences, Haptics, Push Notifications). Check `Capacitor.isNativePlatform()` and provide web fallbacks.
- Request permissions just in time (`Camera.requestPermissions()`), and add the usage descriptions to `Info.plist` / `AndroidManifest.xml`.
- Secrets/tokens in secure storage (a Keychain/Keystore plugin), not `Preferences` or `localStorage`.
- Run `npx cap sync` after adding plugins or changing web build output; commit native project changes deliberately.
- Performance: virtual scrolling for long lists, lazy-loaded routes, compressed images.
- Handle the hardware back button and keyboard (`@capacitor/keyboard`) on Android.

## Don't
Don't edit generated native files under `ios/App/App/public` or `android/app/src/main/assets/public`.

## Done
Web build, unit tests, and lint pass; `npx cap sync` runs cleanly.

More: all Ionic / Capacitor rules · all AGENTS.md rules

Related rules

Flutter AGENTS.md

AGENTS.md for Flutter apps with Riverpod, go_router and clean feature-first structure.

AGENTS.mdFlutter

Android Jetpack Compose AGENTS.md

AGENTS.md for Android apps in Kotlin 2 with Jetpack Compose, ViewModel + StateFlow, Hilt, and Room.

AGENTS.mdAndroid / Kotlin

.NET MAUI rules

Cursor rules for .NET MAUI apps on .NET 10: MVVM with CommunityToolkit.Mvvm, Shell navigation, compiled bindings, DI.

Cursor.NET MAUI

Flutter + Riverpod rules

Cursor rules for Flutter 3 apps using Riverpod 3 with code generation, go_router, and widget tests.

CursorFlutter

Kotlin Multiplatform + Compose Multiplatform CLAUDE.md

CLAUDE.md for Kotlin Multiplatform apps sharing UI with Compose Multiplatform across Android, iOS, desktop, and web.

Claude Code (CLAUDE.md)Kotlin Multiplatform

Kotlin Multiplatform Copilot path instructions

Path-specific Copilot instructions for Kotlin Multiplatform modules: commonMain first, expect/actual, and coroutines.

GitHub CopilotKotlin Multiplatform

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.