esp-nimble-skill

Generates and debugs BLE firmware code for the Apache NimBLE stack on ESP chips.

28|3|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/JasonYANG170/esp-dev-skill --skill esp-nimble-skill-jasonyang170
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: esp-nimble-skill
Source: https://github.com/JasonYANG170/esp-dev-skill/tree/main/repos/esp-nimble
Command: npx skills add https://github.com/JasonYANG170/esp-dev-skill --skill esp-nimble-skill-jasonyang170

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developing BLE firmware with the Apache NimBLE stack requires precise API usage, correct initialization ordering, and awareness of many subtle pitfalls (unsynced host operations, missing conn_handle, mbuf misuse). This Skill grounds AI-generated code in the real esp-nimble repository documentation, headers, and examples so the output compiles and behaves correctly. ## Core Features & Use Cases - Scenario Recipes: 13 step-by-step recipes covering host initialization, address configuration, peripheral advertising, beacons, notifications, scanning, central connections, custom GATT services, SMP pairing, extended/periodic advertising, PHY updates, connection parameter updates, and Bluetooth Mesh nodes. - Real API Reference: Verified function signatures, constants, and structs from nimble/host/include/host/ headers, grouped by ble_gap, ble_gatt, ble_sm, and FreeRTOS NPL port. - Pitfall Database: 15 documented mistakes with wrong-vs-correct code pairs, plus ESP-IDF Kconfig and Mynewt syscfg configuration references. - Use Case: Ask the AI to build a BLE heart-rate peripheral on ESP32-C3; it follows the host_init, gatt_server, and notify recipes to produce code with correct sync callbacks, service table registration, and mbuf-based notifications. ## Quick Start Ask the AI to create a NimBLE BLE peripheral with a custom GATT service for an ESP32-C3 project.

Frequently Asked Questions about esp-nimble-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I initialize the NimBLE BLE host on ESP32 with ESP-IDF?

Call nimble_port_init() first, register ble_hs_cfg callbacks (sync_cb, reset_cb), register GATT services with ble_gatts_count_cfg and ble_gatts_add_svcs, then start the host task via nimble_port_freertos_init(nimble_host_task). All GAP operations must run inside the sync callback after the host synchronizes with the controller.

How do I create a custom GATT service with NimBLE?

Define a static struct ble_gatt_svc_def array with services, characteristics, and descriptors, each tier terminated by {0}. Implement an access_cb that branches on ctxt->op for read/write operations, then call ble_gatts_count_cfg followed by ble_gatts_add_svcs before the host syncs.

Does NimBLE support classic Bluetooth or only BLE?

NimBLE supports only Bluetooth Low Energy, including BLE 5.x features like extended advertising, periodic advertising, 2M and Coded PHY, Secure Connections, and Bluetooth Mesh. Classic Bluetooth (BR/EDR) requires the Bluedroid stack instead.

Which ESP chips support the NimBLE BLE stack?

NimBLE runs on ESP32, ESP32-C3, ESP32-S3, ESP32-C2, ESP32-H2, and ESP32-H4 through ESP-IDF integration. ESP32-C3/S3/C2 use the FreeRTOS NPL port, while newer chips like ESP32-H4 use the dedicated esp-idf NPL port.

Why does ble_gap_connect return BLE_HS_EBUSY in NimBLE?

BLE_HS_EBUSY occurs when you call ble_gap_connect while a scan is still active. Call ble_gap_disc_cancel() first to stop discovery, then initiate the connection, as demonstrated in the apps/blecent example.

Why is my NimBLE GATT service not visible to clients?

The service table was likely registered after host synchronization or is missing the terminating {0} entry. Ensure ble_gatts_count_cfg and ble_gatts_add_svcs run before nimble_port_freertos_init, and that every service, characteristic, and descriptor array ends with {0}.