> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edgeimpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a companion skill

> Use a companion skill that knows your target hardware and SDK so an AI agent can write application code that runs the exported model on your device.

The base API skill from the Edge Impulse [agent-tools repository](/tutorials/topics/ai-agents/create-edge-impulse-skill#install-from-the-agent-tools-repository) covers the Edge Impulse platform: uploading data, triggering training, exporting deployments. It does not know anything about your target hardware, project structure, or how to wire the exported library into your application, unless you give it the context in a separate prompt. A companion skill helps fill that gap.

## Why a companion skill

When you ask `Export a C++ library from my Edge Impulse project`, the agent downloads the archive. When you then ask it to write the code that calls `run_classifier()` on your STM32 using FreeRTOS, it can draw on general knowledge of the Edge Impulse SDK — but it has to make assumptions about your build system, directory layout, sensor drivers, and memory constraints, and those assumptions may not match your project.

A companion skill gives the agent a persistent reference for the things it can't infer: where you extracted the library, how your CMakeLists is structured, which sensor driver you're using,  any board-specific constraints or instructions, etc. You invoke it alongside or after the base skill, and the two together cover the full workflow from Studio to running inference on your specific target.

## Develop application code with a ready-made skill

The `build-*` and `firmware-*` skills in the [edgeimpulse/agent-tools](https://github.com/edgeimpulse/agent-tools) repository are ready-made companion skills for application development. Each one teaches the agent how to turn an exported Edge Impulse deployment into working application code for a family of targets — Arduino boards, Linux SBCs such as the Raspberry Pi and NVIDIA Jetson, MCU platforms, and custom deployment blocks — and the repository README always reflects the current list:

```bash theme={"system"}
npx skills add edgeimpulse/agent-tools --list
```

Install the skill that matches your target:

```bash theme={"system"}
npx skills add edgeimpulse/agent-tools --skill <skill-name>
```

### What the skill gives the agent

A build or firmware skill fills in the target-specific knowledge the agent would otherwise have to guess:

* **Deployment format** — which export to choose on the [Deployment page](/studio/projects/deployment) for that target (Arduino library, C++ library, `.eim` model, Zephyr module) and how the extracted library or module is laid out on disk
* **Inference patterns** — the correct way to feed sensor data and run inference on that platform, such as a `run_classifier()` signal callback in C++ or an `ImpulseRunner` loop in Python
* **Buffer sizing from model constants** — sizing buffers and sampling intervals from the constants exported with the model instead of hardcoding numbers, so the code survives retraining
* **Build system integration** — wiring the library into a sketch, CMake project, IDE project, or module manifest, plus the commands to build, flash, and run
* **Platform constraints** — RTOS task structure, ISR-safe buffering, memory limits, and other patterns specific to the target

### Typical workflow

Export a deployment for your target, then describe what the application should do. The agent loads the companion skill automatically when your prompt matches its description, and combines it with the base API skill to export the deployment first if needed:

<Prompt description="Export my Edge Impulse project as an Arduino library to ./build, then write a sketch for the Arduino Nano 33 BLE Sense that reads the IMU and runs inference, printing the top label to Serial">
  Export my Edge Impulse project as an Arduino library to ./build, then write a sketch for the Arduino Nano 33 BLE Sense that reads the IMU and runs inference, printing the top label to Serial
</Prompt>

<Prompt description="Write a Python script for my Raspberry Pi that runs the .eim model in ./build against a USB microphone and prints each classification with its confidence">
  Write a Python script for my Raspberry Pi that runs the .eim model in ./build against a USB microphone and prints each classification with its confidence
</Prompt>

<Prompt description="Integrate the Edge Impulse C++ library in ./build into my STM32CubeIDE project as a FreeRTOS task, using the existing accelerometer driver in ./Drivers">
  Integrate the Edge Impulse C++ library in ./build into my STM32CubeIDE project as a FreeRTOS task, using the existing accelerometer driver in ./Drivers
</Prompt>

From there, iterate the way you would on any code the agent writes: paste build errors or runtime logs back into the conversation, and ask the agent to build, flash, or run the application when your toolchain is available from the command line.

These skills cover the platform, not your project. The agent still needs your project specifics — sensor wiring, label meanings, repository layout — which you supply through [project context](#add-project-context-with-agents-md) or [your own companion skill](#write-your-own-companion-skill) when your target isn't covered.

## Write your own companion skill

A companion skill is just an [Agent Skill](https://agentskills.io/home): plain markdown with `name` and `description` frontmatter, followed by the reference material the agent should apply — library layout, build commands, inference patterns, board constraints. The file content is the same regardless of agent; only the install path differs. See [Install Agent Skills](/tutorials/topics/ai-agents/create-edge-impulse-skill#write-your-own-skill) for the file format and per-agent install paths, and browse the skills in the [agent-tools repository](https://github.com/edgeimpulse/agent-tools) for real-world examples of the structure.

You don't have to write the file by hand. Describe your target and let your agent create a skill tailored to it — it has general knowledge of SDK patterns, build systems, and integration details for many common platforms, though coverage varies:

<Prompt description="Create an Agent Skill named ei-stm32 that helps write Edge Impulse inference code for the STM32H7 using STM32CubeIDE and FreeRTOS. The sensor is an IIS2DH accelerometer on SPI. Include the correct include paths for the Edge Impulse C++ library, the ISR-safe buffer pattern for collecting samples, and the FreeRTOS task structure for running inference.">
  Create an Agent Skill named ei-stm32 that helps write Edge Impulse inference code for the STM32H7 using STM32CubeIDE and FreeRTOS. The sensor is an IIS2DH accelerometer on SPI. Include the correct include paths for the Edge Impulse C++ library, the ISR-safe buffer pattern for collecting samples, and the FreeRTOS task structure for running inference.
</Prompt>

<Prompt description="Create an Agent Skill named ei-rpi-python for running Edge Impulse .eim models on a Raspberry Pi 5 using the Python SDK. Include how to install the SDK, the inference loop pattern using AudioImpulseRunner or ImpulseRunner, and how to read from a USB microphone with PyAudio.">
  Create an Agent Skill named ei-rpi-python for running Edge Impulse .eim models on a Raspberry Pi 5 using the Python SDK. Include how to install the SDK, the inference loop pattern using AudioImpulseRunner or ImpulseRunner, and how to read from a USB microphone with PyAudio.
</Prompt>

<Prompt description="Create an Agent Skill named ei-zephyr for integrating an Edge Impulse Zephyr module into a nRF5340 project using the nRF Connect SDK. Cover the CMakeLists additions, Kconfig options, and the sample main.c inference loop pattern.">
  Create an Agent Skill named ei-zephyr for integrating an Edge Impulse Zephyr module into a nRF5340 project using the nRF Connect SDK. Cover the CMakeLists additions, Kconfig options, and the sample main.c inference loop pattern.
</Prompt>

## Add project context with AGENTS.md

For a project you return to repeatedly, put an [`AGENTS.md`](https://agents.md) in your repository root. `AGENTS.md` is an open format for giving coding agents persistent project context — most agents load it automatically with every session, no skill invocation needed.

<Info>
  Claude Code reads [`CLAUDE.md`](https://code.claude.com/docs/en/memory) rather than `AGENTS.md`. To keep a single source of truth, create a `CLAUDE.md` that contains only the import line `@AGENTS.md`, or symlink it with `ln -s AGENTS.md CLAUDE.md`.
</Info>

A good agent context file for an Edge Impulse project includes instructions like:

```markdown AGENTS.md expandable theme={"system"}
# Project context

## Hardware target
Raspberry Pi 4 (ARM64, Linux). The Edge Impulse C++ library is extracted at ./ei-sdk.

## Build system
CMake. Build directory is ./build. Run `cmake .. && make -j4` from ./build.

## Sensor
USB webcam via OpenCV. Capture at 96×96, convert to RGB float normalized to [0, 1].

## Project layout
src/main.cpp       — inference loop
src/camera.cpp     — OpenCV capture helpers
include/           — project headers
ei-sdk/            — extracted Edge Impulse C++ library (do not modify)
data/              — sample images for testing

## Edge Impulse project
Project ID: 12345. API key is in EI_API_KEY env var.
Labels: person, no_person.
```

With this in place, you can run `Retrain and re-export the C++ library for my Edge Impulse project` and the agent will know where to put the output, without needing to re-prompt the project structure.

## Extend a skill for a specific project

If you work on one project exclusively, edit the installed skill file itself (the `SKILL.md` in your agent's skills directory) to add project-specific context at the bottom. Anything you repeat across sessions — board type, sensor wiring, label names, file paths — belongs in the skill.

For example, append to the skill for a gesture classifier running on the [Arduino Nano 33 BLE Sense](/hardware/boards/arduino-nano-33-ble-sense):

```markdown theme={"system"}
## Project-specific context

Project ID: 12345 (Gesture Classifier)
Target: Arduino Nano 33 BLE Sense
Sensor: LSM9DS1 IMU, 3-axis accelerometer at 62.5 Hz
Labels: idle, wave, punch
Library location after export: ./build/arduino-library.zip
```

The agent will use this context automatically whenever the skill loads, without you having to repeat the information every time.

<Info>
  Re-installing a skill from the agent-tools repository overwrites the local file, so if you want to keep pulling skill updates, put project-specific additions in a separate companion skill or your project's `AGENTS.md` instead of editing an installed skill in place.
</Info>

## What to include in a companion skill

| What to document                   | Why it helps                                               |
| ---------------------------------- | ---------------------------------------------------------- |
| Board or SoC name and architecture | Correct compiler flags, memory model                       |
| Sensor type and wiring             | Correct driver library and data format                     |
| Buffer sizing strategy             | Avoids hardcoded numbers that break when the model changes |
| Build system and directory layout  | The agent can build and run without asking                 |
| Label names and their meaning      | Better variable names and output formatting                |
| Any existing integration code      | The agent extends rather than rewrites                     |
| Constraints (RAM, flash, RTOS)     | The agent avoids patterns that won't fit                   |

## Next steps

* Browse the [prompt library](/tutorials/topics/ai-agents/prompt-library) for ready-to-use prompts covering data management, training, evaluation, deployment, and application code
* Browse [deployment targets](/studio/projects/deployment) for the full list of supported export formats
* See the [Linux SDK](/tools/clis/edge-impulse-linux-cli) and [Python SDK](/tools/libraries/sdks/inference/linux) for running `.eim` models on Linux boards
* Browse the [hardware directory](/hardware) for setup guides for supported boards
* See [EON Tuner](/studio/projects/eon-tuner) if the model is too large for your target after export
