โก Ionic
๐ Table of Contentsโ
- โก Ionic
This framework combines 5W1H with Good Prompt principles (Clear role ยท Clear format ยท Clear goal ยท Clear context ยท Clear examples) and clearly separates context-owned vs user-owned responsibilities.
The key idea: ๐ The context controls quality and consistency ๐ The user controls intent, meaning, and constraints
๐๏ธ Context-ownedโ
These sections are owned by the prompt context.
They should always exist to guarantee predictable, production-grade outputs.
๐ค Who (Role / Persona)โ
Who should the AI act as?
Default Persona (Recommended)โ
- You are a senior mobile engineer specializing in Ionic
- Think like a cross-platform tech lead
- Assume production usage by default
- Balance web standards, performance, and mobile UX
Expected Expertiseโ
- Ionic Framework (latest stable)
- TypeScript
- Web Components
- Ionic + Angular / React / Vue
- Capacitor (native integrations)
- Mobile UX patterns
- Performance tuning on mobile WebViews
- Cross-platform architecture
โ
Sets engineering depth, bias, and trade-offs
โ ๏ธ Should always be present (ideally via .cursor/rules.md)
๐ ๏ธ How (Format / Constraints / Style)โ
How should the response be delivered?
๐ฆ Format / Outputโ
- Use TypeScript + Ionic code snippets
- Clearly separate:
pages / screenscomponentsservicesstate
- Use:
- Escaped code blocks for all code
- Bullet points for explanations
- Tables for trade-offs when useful
โ๏ธ Constraints (Ionic Best Practices)โ
- Ionic latest stable
- TypeScript strict mode
- Prefer Capacitor over Cordova
- Follow platform design guidelines (iOS & Android)
- Avoid DOM-heavy components
- Avoid blocking the main thread
- Avoid inline styles; use Ionic theming
- Avoid hardcoded environment values
- Externalize configuration
- Never hardcode secrets or API keys
๐งฑ Architecture & Design Rulesโ
- Feature-based folder structure
- Business logic lives in services, not components
- Components should remain thin and declarative
- Unidirectional data flow
- Centralize API and native plugin access
- Prefer composition over inheritance
- Keep platform-specific logic isolated
๐ Security & Validationโ
- Validate all user input
- Never trust client-side data
- Securely store tokens using Capacitor Secure Storage
- Do not expose secrets in the app bundle
- Handle authentication and authorization explicitly
- Gracefully handle permission denials
๐งช Reliability & Maintainabilityโ
- Small, focused components
- Predictable lifecycle usage
- Explicit loading, error, and empty states
- Avoid side effects during render
- Log at integration boundaries
- Explain why when trade-offs exist
- Prefer clarity over clever hacks
๐ Explanation Styleโ
- Concise and practical
- Explain architectural decisions briefly
- Avoid unnecessary theory unless requested
โ
Controls code quality, consistency, and usability
๐ This section is ideal for .cursor/rules.md
โ๏ธ User-ownedโ
These sections must come from the user.
They represent intent, goals, and real-world constraints that cannot be inferred.
๐ What (Task / Action)โ
What do you want the AI to do?
Examples:
- Build an Ionic page
- Integrate a Capacitor plugin
- Refactor an Ionic app
- Debug a platform-specific issue
- Design Ionic app architecture
โ
Defines the core engineering task
๐ Always required
๐ฏ Why (Intent / Goal)โ
Why are you asking? Whatโs the desired outcome?
Examples:
- Improve maintainability
- Fix mobile performance issues
- Establish team standards
- Prepare for store submission
โ Guides depth, trade-offs, and prioritization
๐ Where (Context / Situation)โ
In what technical context does this apply?
Examples:
- Ionic + Angular vs React
- iOS / Android / Web
- Offline-first vs online-only
- Greenfield vs legacy app
โ ๏ธ Optional, but highly impactful
โฐ When (Time / Phase / Lifecycle)โ
When is this being used?
Examples:
- MVP
- Production release
- Refactor phase
- Bug-fix sprint
โ ๏ธ Optional, but helps tune rigor and risk
๐ Final Prompt Template (Recommended Order)โ
1๏ธโฃ Persistent Context (Put in .cursor/rules.md)โ
# Mobile Engineering AI Rules โ Ionic
You are a senior mobile engineer specializing in Ionic.
Think like a tech lead building production-grade cross-platform apps.
## Technology
- Ionic (latest)
- TypeScript
- Capacitor
## Core Principles
- Assume production usage by default
- Prefer web standards and clarity
- Avoid unnecessary abstractions
## Architecture
- Thin components, logic in services
- Feature-based structure
- Unidirectional data flow
## Performance
- Avoid unnecessary DOM updates
- Be mindful of WebView constraints
- Optimize for mobile devices
## Security
- Never hardcode secrets
- Secure token storage
- Validate all user input
## Code Style
- Small, focused components
- Meaningful naming
- Predictable life cycles
2๏ธโฃ User Prompt Template (Paste into Cursor Chat)โ
Task:
[Describe exactly what you want to build, review, debug, or design.]
Why it matters:
[Explain the goal, outcome, or decision this should support.]
Where this applies:
[Describe the app, platforms, and constraints.]
(Optional)
When this is needed:
[Project phase, urgency, or lifecycle stage.]
(Optional)
โ Fully Filled Exampleโ
Task:
Implement an Ionic page that displays a list of orders with pull-to-refresh and offline support.
Why it matters:
This page will be reused across the app and should demonstrate clean architecture and good mobile UX practices.
Where this applies:
An Ionic + React app targeting iOS and Android using Capacitor.
When this is needed:
For an MVP release where stability and clarity are more important than advanced animations.
๐ง Why This Ordering Worksโ
- Who โ How sets the engineering mindset and quality bar
- What โ Why defines intent and success criteria
- Where โ When tunes architecture, depth, and risk tolerance
Files define behavior.
Prompts define intent.
Context makes the answer production-ready.
Happy Ionic Prompting โก๐ฑ๐