Guide · Agent skill
How to use the LiteRT on-device inference Android skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The litert-runtime skill is a set of written instructions and reference documents that guides an AI agent through adding on-device machine learning inference to a Kotlin Android app using Google's LiteRT runtime and its CompiledModel API. It does not run a model itself. After this guide you will know how to install the skill, how to ask for it in plain language, what the agent will check and change in your project, and what to review before you accept its work.
Quick start
- 1Download and unzip the skill. Download the litert-runtime ZIP from this page and unzip it. Place the folder in ~/.claude/skills/ for all projects, or in a project's .claude/skills/ folder for one project.
- 2Or upload it in the Claude apps. In the Claude apps, open Settings, then Capabilities, then Skills, and upload the ZIP.
- 3Open your Android project. Make sure it is a Kotlin Android project with minSdk 24 or higher and a Gradle build using the Android Gradle Plugin.
- 4Ask for the task in plain words. Describe what you want, for example adding image classification with a .tflite model, and mention LiteRT.
- 5Let the agent pick the runtime. The agent reads the runtime reference first and defaults to the Google Play services runtime unless your app needs the NPU, custom operators, or a library the skill cannot replace.
- 6Build and test on a device. Run ./gradlew assembleDebug, install the app, and check that inference runs and the output is correct.
What the skill makes the agent do
Without the skill, an agent has to work out LiteRT setup from general knowledge. With it, the agent follows a detailed playbook for a .tflite model in an Android app. The playbook covers choosing between the Google Play services runtime and the bundled runtime, setting up Gradle, placing or delivering model files, managing threads and buffers, adding a GPU-to-CPU fallback, migrating from the legacy TensorFlow Lite Interpreter, and benchmarking latency.
- Choose between the Google Play services runtime (the default) and the bundled runtime
- Configure Gradle and place the .tflite model in the app assets, or deliver it through Play for On-Device AI or a downloaded file
- Run inference on one background thread that owns the CompiledModel, with reused TensorBuffer objects
- Add a warm-up inference and a GPU-to-CPU fallback
- Migrate org.tensorflow.lite Interpreter or GpuDelegate code to LiteRT
- Measure latency, including output readback
Install the litert-runtime skill
Download the skill ZIP from this page and unzip it. For a personal install that works in all your projects, place the folder in your user skills directory at ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder instead.
If you use the Claude apps, you can upload the skill instead. Open Settings, then Capabilities, then Skills, and add the ZIP there.
- The skill folder contains SKILL.md, the reference files for Play services, migration, verification and Play for On-Device AI, and a LICENSE.txt file.
- The skill is licensed under Apache-2.0 according to this listing; the full terms are in LICENSE.txt.
~/.claude/skills/litert-runtime/Check that your project meets the requirements
Before you ask for help, confirm the basics. The skill is written for a Kotlin Android project with minSdk 24 or higher and a Gradle build using the Android Gradle Plugin. It needs either the Google Play services LiteRT artifact or the bundled LiteRT artifacts from Google Maven. You also need a .tflite model and its input contract, which means the input dimensions, mean, standard deviation, channel order and tensor layout.
Play for On-Device AI and bundletool are optional. You need them only if you deliver a large model as an AI pack.
- Kotlin Android project, minSdk 24 or higher
- Gradle build with Android Gradle Plugin
- Google Play services LiteRT or bundled LiteRT artifacts from Google Maven
- A verified .tflite model and its input contract
- Optional: Play for On-Device AI and bundletool for large model delivery
Trigger the skill with natural requests
You do not need a special command. Describe the task in plain language and mention LiteRT, .tflite or your model type. The skill's description covers Gradle setup, image classification, vision, audio and embedding helpers, TensorBuffer reuse, Bitmap preprocessing, GPU-to-CPU fallback, Play services delivery, migration from the legacy Interpreter, and latency benchmarking.
The skill does not cover running generative text LLMs with .litertlm files, which is a job for the separate litert-lm skill, or converting models in Python.
- Add LiteRT image classification to my Kotlin Android app using this .tflite model
- Migrate this app from org.tensorflow.lite Interpreter to LiteRT
- Add a GPU with CPU fallback to my existing LiteRT model code
- Set up Play for On-Device AI delivery for my 300 MB model
- Benchmark the latency of my model's inference on Android
Review what the agent changes
The skill tells the agent to search your project for libs.versions.toml, gradle.properties, app/build.gradle.kts and existing org.tensorflow.lite imports before it edits anything. It also tells the agent to run a real build after adding the Play services dependency, and to avoid leaving the build broken.
Review the diff yourself. Check the dependency choice, the model file location, and that code runs inference on one background thread rather than the main thread. The skill's verification guidance is in references/verify.md.
- Confirm which runtime was chosen and why
- Confirm the model is in app/src/main/assets/ or delivered as described in the Play for On-Device AI reference
- Confirm the build succeeds with ./gradlew assembleDebug
./gradlew assembleDebugSafety notes: scripts and network
The skill is a set of written instructions and reference documents. According to its listing, it runs no scripts and does not use the network. It does not run a model for you; the agent writes code and build configuration in your project, and you run the build and the app.
Read the changes before you commit them. The agent may run Gradle commands on your machine as part of its normal work, so run it in a project you can restore from version control.
- Runs scripts: no
- Uses network: no
- The agent can edit build files and source code in the project it is working on
What people use it for
- Adding image classification to a Kotlin app with a bundled .tflite model in app assets
- Migrating an app from org.tensorflow.lite Interpreter and GpuDelegate code to LiteRT with CompiledModel
- Adding a GPU option with CPU fallback so the app keeps working on devices where the GPU accelerator is unavailable
- Delivering a large model through Play for On-Device AI as an install-time, fast-follow or on-demand AI pack
- Measuring inference latency on a device, including output readback
Frequently asked questions
How do I install the litert-runtime skill?
Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder for one project. In the Claude apps, you can instead upload the ZIP under Settings, then Capabilities, then Skills.
What does my Android project need to use this skill?
You need a Kotlin Android project with minSdk 24 or higher, a Gradle build using the Android Gradle Plugin, and either the Google Play services LiteRT artifact or the bundled LiteRT artifacts from Google Maven. You also need a verified .tflite model and its input contract.
Is the litert-runtime skill free?
The skill is licensed under Apache-2.0 according to this listing, and the full terms are in its LICENSE.txt file. The Play for On-Device AI reference says it has no additional cost for hosting and delivery through Google Play.
Can this skill run LLMs with .litertlm files?
No. The skill excludes running generative text LLMs with .litertlm files and tells the agent to use the separate litert-lm skill for that. It also does not cover converting models in Python.
What is the difference between the Play services runtime and the bundled runtime?
The Play services runtime uses the LiteRT artifact from Google Play services and is the skill's default. The bundled runtime ships the LiteRT libraries inside your APK and is used when the app needs the NPU, custom operators, a library the skill cannot replace, or support for devices without Google Play services.
Why does my app run on the CPU when I asked for the GPU?
With the bundled runtime, if the GPU accelerator library is missing and you pass both GPU and CPU options, the model runs on the CPU while the app reports the GPU. The skill says only Logcat shows this, with the message that the GPU accelerator could not be loaded and registered, so check Logcat.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are adding .tflite inference, LiteRT GPU support or an Interpreter migration to a Kotlin Android app and want an agent to follow a detailed, checked playbook. Pick something else if you need to run generative text LLMs with .litertlm files, convert models in Python, or work outside Android and Kotlin, since the guidance does not apply there.
Download the skill