kimei-global-co/react-native-boilerplate/on-device-ai
Claude Code and agent skill by kimei-global-co/react-native-boilerplate
- community
Checking that the SKILL.md file is still in the repository.
Best practices for building on-device AI features in React Native using React Native ExecuTorch. Use when the user wants to add AI to a mobile app without cloud dependencies: AI chatbots and assistants, image classification, object detection, text recognition and document parsing (OCR), style transfer, image generation, speech-to-text transcription, text-to-speech synthesis, voice activity detection, semantic search with embeddings, real-time camera AI with VisionCamera, or vision-language image understanding. Also use when the user mentions offline AI, on-device ML, privacy-preserving AI, reducing cloud API costs or latency, running models locally on mobile, or downloading and managing ML models. Covers react-native-executorch hooks (useLLM, useClassification, useObjectDetection, useOCR, useSemanticSegmentation, useInstanceSegmentation, useStyleTransfer, useTextToImage, useImageEmbeddings, useSpeechToText, useTextToSpeech, useVAD, useTextEmbeddings, useExecutorchModule), tool calling, structured output, VLMs, model loading, and resource management.
Install
npx vskill@latest install kimei-global-co/react-native-boilerplate/on-device-aiSKILL.md
The same SKILL.md was published earlier as kimei-global-co/react-native-boilerplate/on-device-ai.
On-Device AI
Software Mansion's production patterns for on-device AI in React Native using React Native ExecuTorch.
Load at most one reference file per question. For hook API signatures, model constants, and configuration options, webfetch the relevant page from the official docs at https://docs.swmansion.com/react-native-executorch/docs/.
Decision Tree
Pick the right hook based on the AI task.
Critical Rules
- Call `initExecutorch()` before any other API. You must initialize the library with a resource fetcher adapter at the entry point of your app. Without it, all hooks throw
ResourceFetcherAdapterNotInitialized.
- Always check `isReady` before calling `forward` or `generate`. Hooks load models asynchronously. Calling inference methods before the model is ready throws
ModuleNotLoaded.
- Interrupt LLM generation before unmounting the component. Unmounting while
isGeneratingis true causes a crash. Callllm.interrupt()and wait forisGeneratingto become false before navigating away.
- Use quantized models on mobile. Full-precision models consume too much memory for most devices. React Native ExecuTorch ships quantized variants for all supported models.
- Audio for speech-to-text must be 16kHz mono. Mismatched sample rates produce garbled transcriptions silently.
- Audio from text-to-speech is 24kHz. Create the
AudioContextwith{ sampleRate: 24000 }for playback.
- Set `pixelFormat: 'rgb'` and `orientationSource="device"` for VisionCamera frame processing. The default
yuvformat produces incorrect results with ExecuTorch vision models. MissingorientationSourcecauses misaligned bounding boxes and masks.
References
| File | When to read | |
|---|---|---|
llm.md | LLM chat (functional and managed), tool calling, structured output, token batching, context strategy, vision-language models (VLM), model selection, generation config | |
vision.md | Image classification, object detection, OCR, semantic segmentation, instance segmentation, style transfer, text-to-image, image/text embeddings, VisionCamera real-time frame processing with runOnFrame | |
speech.md | Speech-to-text (batch and streaming transcription with timestamps), text-to-speech (batch and streaming synthesis, phoneme input), voice activity detection, audio format requirements | |
setup.md | Installation with initExecutorch, resource fetcher adapters, model loading strategies (bundled, remote, local), download management, error handling with RnExecutorchError, custom models with useExecutorchModule, Metro config for .pte files |
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplate/dotfiles/agents-setup/skills/react-native-best-practices/references/on-device-ai/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kimei-global-co/react-native-boilerplate/on-device-ai)