| title | Agentic Coding | |
|---|---|---|
| description | Leverage AI coding assistants to build higher quality NativeScript applications faster | |
| contributors |
|
Agentic coding refers to using AI-powered coding assistants that can autonomously perform complex multi-step development tasks. These tools go beyond simple code completion; they can understand your entire codebase, make architectural decisions, write tests, and implement features end-to-end.
NativeScript's architecture provides the following:
- Direct native API access - AI agents need to understand both JavaScript/TypeScript and native iOS/Android APIs
- Cross-platform patterns - Agents must generate code that works correctly on multiple platforms
- Framework flexibility - Code generation should adapt to Angular, Vue, Solid, Svelte, React, or plain TypeScript
- Performance considerations - Agents should follow best practices for native mobile performance
By providing proper context, AI coding assistants can generate high-quality NativeScript code that follows best practices and leverages the full power of the platform.
NativeScript provides a comprehensive context file that can be used with any AI coding assistant to dramatically improve code generation quality. This file contains:
- Project structure conventions
- Core API patterns and imports
- UI component reference
- Best practices for performance
- Platform-specific code patterns
- Framework integration examples
- Custom view creation patterns
The NATIVESCRIPT.md file is available for download:
You can also download it via the command line:
curl -o CLAUDE.md https://docs.nativescript.org/assets/agentic/NATIVESCRIPT.mdClaude Code is Anthropic's agentic coding tool that runs in your terminal. It uses CLAUDE.md files to understand project context.
- Download the NativeScript context file to your project root:
curl -o CLAUDE.md https://docs.nativescript.org/assets/agentic/NATIVESCRIPT.md- Optionally, add project-specific instructions at the top of the file:
# Project Context
This is a NativeScript Vue 3 application for managing recipes.
## Project-Specific Patterns
- We use Pinia for state management
- API calls go through `src/services/api.ts`
- All components are in `src/components/`
---
# NativeScript AI Agent Context
... (rest of NATIVESCRIPT.md content)- Start Claude Code in your project:
cd your-nativescript-project
claudeClaude will automatically read the CLAUDE.md file and use it to inform all code generation.
With the context file in place, you can give high-level instructions:
Create a settings page with switches for notifications, dark mode, and location tracking.
Save preferences using ApplicationSettings.
Build a ListView that shows products with images, names, and prices.
Use template selectors for featured vs regular items.
Create a custom native view that wraps Android's MaterialCardView and iOS's UIVisualEffectView.
The NATIVESCRIPT.md context file works with any AI coding assistant that supports custom context:
Download and add to your workspace's .github/copilot-instructions.md:
curl -o .github/copilot-instructions.md https://docs.nativescript.org/assets/agentic/NATIVESCRIPT.mdAdd to your .cursorrules file or include in your project's context settings.
Add to your workspace's .windsurfrules file.
Copy the relevant sections into your conversation as context before asking NativeScript-related questions.
When prompting, specify which framework you're using:
Using NativeScript with Vue 3, create a component that...
In my Angular NativeScript app, implement a service that...
Using NativeScript with SolidJS, build a custom directive that...
While using NativeScript with React, create a functional component that...
Using NativeScript with Svelte, create a store that...
For platform-specific features, mention the target:
Create an iOS-specific implementation that uses UIBlurEffect. You can reference it here https://developer.apple.com/documentation/uikit/uiblureffect?language=objc
Add Android haptic feedback using the native Vibrator API. You can reference it here https://developer.android.com/reference/android/os/Vibrator
Help the AI understand performance constraints:
This will be used in a ListView with 1000+ items, so optimize for scroll performance.
This animation runs during user interaction, keep it on the UI thread.
Provide UX context for better implementations:
Create a pull-to-refresh list that shows a loading indicator while fetching new data.
Build a form that validates on blur and shows inline error messages.
Create unit tests for the data transformation logic in this service.
For team projects, consider extending the base context file with project-specific information:
# Project: Recipe Manager App
## Architecture
- Feature-based folder structure (`src/features/recipes/`, `src/features/auth/`)
- Shared components in `src/shared/components/`
- All API calls through `src/core/api/client.ts`
## Conventions
- Use `const` for all variables unless reassignment is needed
- Prefer composition over inheritance
- All async operations use async/await (no raw promises)
## State Management
- Pinia stores in `src/stores/`
- Each feature has its own store
---
@CLAUDE.mdThe @ import syntax (supported in Claude Code) lets you reference the base file without duplicating its contents. Just ensure you've downloaded NATIVESCRIPT.md as CLAUDE.md in your project root.
If your team uses specific patterns, document them:
## Vue Component Patterns
- Use `<script setup lang="ts">` for all components
- Props must have TypeScript types defined
- Emit events using `defineEmits` with typed payloads
- Use `v-model` for two-way binding with form inputsWhen using AI coding assistants:
- Never include secrets in context files (API keys, passwords)
- Review generated code before committing, especially for security-sensitive features
- Validate native API usage - ensure proper permissions are requested
- Test on real devices - Even if something runs in emulators, always verify on actual devices
If the AI generates DOM-based code instead of NativeScript:
- Ensure the context file is properly loaded
- Explicitly mention "NativeScript" in your prompts
- Specify the target platforms (iOS/Android/visionOS)
- Update to the latest
@nativescript/coreto get the current context file - Mention the NativeScript version you're using in prompts
- Verify your context file includes the correct framework examples
- Add your framework's specific patterns to the context