Offline speech recognition module for React Native using Vosk library. Supports Android & iOS with native Kotlin/Swift code in a Yarn workspaces monorepo.
Expert guidance for developing the react-native-vosk offline speech recognition module. This skill helps you work with React Native native modules, Vosk API integration, and cross-platform mobile development.
This is a React Native library providing offline speech recognition using the Vosk API. The project is structured as a Yarn workspaces monorepo containing:
1. Ensure Node.js v18+ is active: `nvm use`
2. Install dependencies: `yarn install --immutable`
3. Never use npm for package management - Yarn is enforced
```bash
yarn
yarn prepare
yarn typecheck
yarn lint
yarn lint --fix
yarn test
yarn clean
```
```bash
yarn example android
yarn example ios
```
The repository uses Lefthook for pre-commit hooks that automatically run:
Commit messages must follow [Conventional Commits](https://www.conventionalcommits.org/en) format.
- `src/index.tsx` - Main entry point
- `src/index.d.ts` - Type definitions
- `src/__tests__/` - Jest unit tests
- `android/src/main/java/com/vosk/VoskModule.kt` - Core module
- `android/src/main/java/com/vosk/VoskPackage.kt` - Package definition
- `ios/Vosk.swift` - Swift implementation
- `ios/Vosk.mm` - Objective-C++ bridge
- `ios/VoskModel.swift` - Model handling
- `ios/libvosk.xcframework/` - Vosk framework
- `example/src/App.tsx` - Demo application
- `example/android/` - Android example project
- `example/ios/` - iOS example project
Download Vosk models from [alphacephei.com/vosk/models](https://alphacephei.com/vosk/models)
Place models in: `example/android/app/src/main/assets/model-<lang>/`
Add models to the Xcode project (see README for detailed steps)
Before submitting changes:
1. ✓ Run `yarn lint` - ensure no linting errors
2. ✓ Run `yarn typecheck` - verify TypeScript types
3. ✓ Run `yarn test` - all tests pass
4. ✓ For native changes: rebuild example app on both platforms
5. ✓ Verify commit message passes pre-commit hooks
6. ✓ Check CI status on pull requests
Releases are managed with `release-it`:
```bash
yarn release
```
(Requires appropriate permissions)
1. Run `yarn clean` to remove build artifacts
2. Run `yarn install` to reinstall dependencies
3. Retry the build
1. **Always use Yarn** - npm is only for publishing
2. **Follow Conventional Commits** - required for automated releases
3. **Test both platforms** - verify Android and iOS functionality
4. **Run validation before committing** - lint, typecheck, and test
5. **Keep models updated** - check Vosk website for model updates
6. **Document native changes** - add comments for complex native code
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/react-native-vosk-speech-recognition/raw