Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →NativeScript best practices and patterns for mobile applications
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -9% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -9% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -26% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -7% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 28% | 0% |
NativeScript best practices and patterns for mobile applications
Synced from https://github.com/PatrickJS/awesome-cursorrules/tree/main/rules/nativescript.mdc.
.ios.ts, .android.ts) when code exceeds 20 platform-specific lines.custom-native/index.ios.ts, custom-native/index.android.ts, custom-native/common.ts, custom-native/index.d.ts to keep platform-specific code organized and easy to import with single import elsewhere, replacing custom-native with the name of the custom code.ios or android (e.g., iosButtonStyle).primaryButtonStyle, userProfileView).@NativeClass() when extending native classes when neededstatic ObjCProtocols = [AnyUIKitDelegate]; to declare custom delegates if a delegate is required or used.let delegate = MyCustomDelegate.new() as MyCustomDelegate, and ensure it is retained in the class scope.__ANDROID__ and __APPLE__ for conditional platform code with tree-shaking.setTimeout, setInterval) to avoid memory leaks."@nativescript/tailwind": "^2.1.0" for consistent styling paired with "tailwindcss": "~3.4.0".GridLayout or StackLayout for flexible, responsive layouts. Place more emphasis on proper GridLayout usage for complex layouts but use StackLayout for simpler, linear arrangements.visibility: 'hidden' for elements that should not affect layout when hidden.GridLayout wisely to setup complex layouts.ns clean) after modifying files in App_Resources or package.json.itemTemplateSelector) for conditional layouts in ListView and RadListView.Observable or ObservableArray properties to reflect state changes efficiently.Other measured skills in the registry, with their headline benchmark lift.