Fast synchronous key-value storage for React Native via react-native-mmkv (Nitro-backed). Covers creating and configuring MMKV instances, reading/writing all value types (string, number, boolean, buffer), React hooks for reactive UI, value-change listeners, encryption, AsyncStorage migration, and state-management integrations (zustand, redux-persist, jotai, react-query). Also covers storage limits, multi-process mode, and the V4 upgrade from the class-based API.
npx skills add https://github.com/margelo/react-native-skills --skill react-native-mmkv
A focused reference for AI coding assistants working in a project that uses react-native-mmkv. Answer using the real APIs from this library — not invented ones — by routing to the matching references/*.md file below.
react-native-mmkv is a high-performance, synchronous key-value storage library for React Native, backed by Tencent's MMKV C++ engine via Nitro Modules (JSI). It is ~30x faster than AsyncStorage.
The three things that trip people up:
await, no Promises. storage.getString('key') returns the value immediately. This is the whole point — MMKV memory-maps files and reads/writes in-process.new MMKV() to createMMKV(), .delete() became .remove(), and react-native-nitro-modules is now a required peer dependency. See the upgrade guide.> V4 requires React Native 0.75+. It works on both the New Architecture and the old architecture (Nitro is backwards compatible).
Load the matching file from references/ before writing code. Each reference cites real APIs from the library.
| User is asking about… | Read |
|---|---|
| Creating an MMKV instance, configuration options (id, path, encryptionKey, mode, readOnly, compareBeforeSet), the createMMKV() factory | references/create-instance.md |
| Getting/setting values, all data types (string, number, boolean, buffer, objects via JSON), key management (contains, getAllKeys, remove, clearAll), size, trim, importAllFrom | references/crud-operations.md |
| React hooks (useMMKVString, useMMKVNumber, useMMKVBoolean, useMMKVBuffer, useMMKVObject, useMMKV, useMMKVListener, useMMKVKeys), reactive UI | references/hooks.md |
| Listening for value changes outside of React, addOnValueChangedListener, cleaning up listeners | references/listeners.md |
| Encryption (encrypt, decrypt, recrypt), AES-128 vs AES-256, encryptionKey config | references/encryption.md |
| Migrating from AsyncStorage, data transfer pattern, completion flag | references/migrate-from-async-storage.md |
| zustand persist middleware, redux-persist, jotai atomWithMMKV, react-query persister, MobX | references/state-management.md |
| V4 upgrade, breaking changes from V3, new MMKV() → createMMKV(), .delete() → .remove() | references/upgrade-v4.md |
| Storage size limits, memory warnings, when to use a database instead | references/limits-and-gotchas.md |
If the question doesn't match any row, read references/create-instance.md first — most setup questions start there.
npm install react-native-mmkv react-native-nitro-modules
cd ios && pod install
Expo:
npx expo install react-native-mmkv react-native-nitro-modules
npx expo prebuild
After install, rebuild the app. No additional native wiring is required.
import { createMMKV, existsMMKV, deleteMMKV } from 'react-native-mmkv'
const storage = createMMKV({ id: 'my-store' })
// Properties (read-only)
storage.id // string
storage.length // number of keys
storage.byteSize // total file size in bytes
storage.size // (deprecated — use byteSize)
storage.isReadOnly // boolean
storage.isEncrypted // boolean
// Write
storage.set('key', 'string' | 42 | true | arrayBuffer)
// Read
storage.getString('key') // string | undefined
storage.getNumber('key') // number | undefined
storage.getBoolean('key') // boolean | undefined
storage.getBuffer('key') // ArrayBuffer | undefined
// Keys
storage.contains('key') // boolean
storage.getAllKeys() // string[]
storage.remove('key') // boolean (NOTE: was .delete() in V3)
storage.clearAll() // void
// Encryption
storage.encrypt('password')
storage.encrypt('password', 'AES-256')
storage.decrypt()
storage.recrypt('newPassword' | undefined) // (deprecated — use encrypt()/decrypt())
// Maintenance
storage.trim() // free unused space
storage.importAllFrom(otherStorage) // returns count imported
// Listeners
const sub = storage.addOnValueChangedListener((key) => { ... })
sub.remove()
// Static helpers
existsMMKV('my-store') // boolean
deleteMMKV('my-store') // boolean
A mocked MMKV instance is automatically used when testing with Jest or Vitest. Use createMMKV() as normal in tests — no manual mocking needed.
Good test questions:
StateStorage adapter using storage.set, storage.getString, storage.remove — not AsyncStorage wrappers.| File | Description |
|------|-------------|
| create-instance.md | createMMKV() factory, all configuration options |
| crud-operations.md | Set/get all types, key management, objects, buffers |
| hooks.md | All React hooks for reactive MMKV usage |
| listeners.md | addOnValueChangedListener, cleanup |
| encryption.md | Encrypt/decrypt instances, AES options |
| migrate-from-async-storage.md | Full migration pattern from AsyncStorage |
| state-management.md | zustand, redux-persist, jotai, react-query, MobX |
| upgrade-v4.md | V3 → V4 breaking changes and migration |
| limits-and-gotchas.md | Storage limits, multi-process, logging, common pitfalls |
| Problem | Reference | Action |
|---------|-----------|--------|
| Don't know where to start | create-instance.md | Create instance with createMMKV() |
| Need reactive UI updates | hooks.md | Use useMMKVString / useMMKVObject etc. |
| Encrypting sensitive data | encryption.md | Call storage.encrypt(key) |
| App uses AsyncStorage, want to switch | migrate-from-async-storage.md | Batch migrate then swap calls |
| Zustand/Redux/Jotai persistence | state-management.md | Wire adapter for your state lib |
| Upgrading from V3 to V4 | upgrade-v4.md | new MMKV() → createMMKV(), .delete() → .remove() |
| Storage growing too large | limits-and-gotchas.md | Trim or move to SQLite |
| Multi-process data sharing | limits-and-gotchas.md | Set mode: 'multi-process' |
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take margelo/react-native-mmkv from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, npx.
Without those the skill loads but fails at the first command.