Copilot instructions
.github/instructions/rails-mobile.instructions.mdHotwire Native Guidelines
Copilot instructions
Quality
66/100
Scores the file, not the repository.Length
579 words
9 headings · 4 code blocksRepository
54
— · pushed 410 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Hotwire Native Guidelines78## Core Concepts910- Hotwire Native displays web content in a native shell with platform-specific navigation11- Web content renders in a WebView with native-feeling transitions and behaviors12- Link navigation is intercepted and handled by the native adapter13- Build once for the web, deploy simultaneously to web and native mobile apps14- Progressively enhance with native components where higher fidelity is needed1516## Navigation Best Practices1718- Design web content to work across web, iOS, and Android19- Links between pages become native screen transitions automatically20- External links open in an in-app browser (SFSafariViewController on iOS, Custom Tabs on Android)21- Use `data-turbo-action="replace"` to replace the current screen instead of pushing a new one22- Ensure all screens are accessible via URLs for proper native navigation2324## Path Configuration2526- Define platform-specific navigation rules in a JSON configuration file27- Host configuration files at versioned URLs (e.g., `/configurations/ios_v1.json`)28- Include both local (bundled) and remote (server-hosted) configurations29- Use regex patterns to match URLs and apply specific behaviors30- Configuration example:3132```json33{34 "settings": {35 "feature_flags": [36 {37 "name": "enable_new_feature",38 "enabled": true39 }40 ]41 },42 "rules": [43 {44 "patterns": ["/modal/.*"],45 "properties": {46 "context": "modal"47 }48 },49 {50 "patterns": ["/tabs/.*"],51 "properties": {52 "presentation": "refresh"53 }54 }55 ]56}57```5859## Bridge Components6061- Use Bridge Components for web-to-native communication62- Components have both web (Stimulus) and native (Swift/Kotlin) counterparts63- Register component handlers in your native app and attach web controllers in HTML64- Use for native UI elements like top bar buttons, action sheets, and platform APIs65- Web component implementation example:6667```javascript68// app/javascript/controllers/native_button_controller.js69import { Controller } from "@hotwired/stimulus";70import { BridgeComponent } from "@hotwired/bridge";7172export default class extends Controller {73 static values = { title: String, style: String };7475 connect() {76 this.bridge = new BridgeComponent("button", this);77 this.bridge.send("connect", {78 title: this.titleValue,79 style: this.styleValue || "default",80 });81 }8283 disconnect() {84 this.bridge.send("disconnect");85 }8687 handleTap(message) {88 // Handle tap event from native89 const form = this.element.closest("form");90 if (form) form.requestSubmit();91 }92}93```9495```html96<!-- In your view -->97<div98 data-controller="native-button"99 data-native-button-title-value="Save"100 data-native-button-style-value="primary"101></div>102```103104## Native Screen Integration105106- Create fully native screens for high-fidelity interactions107- Register URL routes that map to native screen controllers108- Ensure each native screen has a corresponding URL for consistent navigation109- Share data between web and native using URL parameters or Bridge Components110- Follow platform design guidelines for native screens (Human Interface Guidelines for iOS, Material Design for Android)111112## Progressive Enhancement Strategy113114- Start with web-only implementation to quickly ship features115- Add Bridge Components for native UI elements and platform integrations116- Build fully native screens only where high fidelity is required117- Maintain a consistent navigation model across all screen types118- Use feature flags in path configuration to enable native features gradually119120## Mobile-Optimized HTML/CSS121122- Test all web pages in mobile viewports123- Use responsive design principles for fluid layouts124- Ensure tap targets are appropriately sized (minimum 44×44pt on iOS, 48×48dp on Android)125- Optimize images and assets for mobile devices126- Consider mobile-specific meta tags:127128```html129<meta130 name="viewport"131 content="width=device-width, initial-scale=1, user-scalable=no"132/>133<meta name="apple-mobile-web-app-capable" content="yes" />134<meta name="turbo-visit-control" content="reload" />135```136137## Performance Considerations138139- Keep initial page load fast (under 2 seconds)140- Minimize JavaScript usage to conserve battery and performance141- Optimize image sizes for mobile network conditions142- Use Turbo Frames to load content incrementally143- Consider offline capabilities with service workers where appropriate144
Also in levifig/rails-instructions
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| levifig/rails-instructions.github/instructions/rails-core.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+5 | 68/100 | 3 days ago | |
| levifig/rails-instructions.cursor/rules/guidelines.mdc · 54 | Cursor rules | teststyletesting-strategysecurity+4 | 71/100 | 3 days ago | |
| levifig/rails-instructions.cursor/rules/rails-rules.mdc · 54 | Cursor rules | testlint-formatstylearch+9 | 84/100 | 3 days ago | |
| levifig/rails-instructions.github/copilot-instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+4 | 71/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-api.instructions.md · 54 | Copilot instructions | testlint-formatstyletesting-strategy+7 | 67/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-background-jobs.instructions.md · 54 | Copilot instructions | teststyletesting-strategydatabase+2 | 63/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-controllers.instructions.md · 54 | Copilot instructions | teststylesecurityapi+1 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-deployment.instructions.md · 54 | Copilot instructions | setupstylesecuritydatabase+2 | 52/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-hotwire.instructions.md · 54 | Copilot instructions | teststylesecurityperformance+1 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-importmaps.instructions.md · 54 | Copilot instructions | teststylesecuritydatabase+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-models.instructions.md · 54 | Copilot instructions | teststylearchtypes+4 | 60/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-performance.instructions.md · 54 | Copilot instructions | teststylegitdatabase+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-security.instructions.md · 54 | Copilot instructions | teststylesecuritydependencies+3 | 63/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-services.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+4 | 75/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-styling.instructions.md · 54 | Copilot instructions | styledatabaseuiperformance+3 | 59/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-testing.instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-views.instructions.md · 54 | Copilot instructions | teststylearchsecurity+3 | 60/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails.instructions.md · 54 | Copilot instructions | testlint-formatstylearch+9 | 84/100 | 3 days ago |
Diff against .github/instructions/rails-core.instructions.md Diff against .cursor/rules/guidelines.mdc Diff against .cursor/rules/rails-rules.mdc Diff against .github/copilot-instructions.md Diff against .github/instructions/rails-api.instructions.md Diff against .github/instructions/rails-background-jobs.instructions.md Diff against .github/instructions/rails-controllers.instructions.md Diff against .github/instructions/rails-deployment.instructions.md Diff against .github/instructions/rails-hotwire.instructions.md Diff against .github/instructions/rails-importmaps.instructions.md Diff against .github/instructions/rails-models.instructions.md Diff against .github/instructions/rails-performance.instructions.md Diff against .github/instructions/rails-security.instructions.md Diff against .github/instructions/rails-services.instructions.md Diff against .github/instructions/rails-styling.instructions.md Diff against .github/instructions/rails-testing.instructions.md Diff against .github/instructions/rails-views.instructions.md Diff against .github/instructions/rails.instructions.md
