This skill should be used when the user designs or reviews a connected device, fleet, gateway or IoT backend, for example "connect my ESP32 to MQTT", "which IoT protocol", "LoRaWAN or NB-IoT", "BLE GATT design", "Matter / Thread", "device provisioning", "fleet OTA" or "IoT backend", or asks about the EU CRA or RED security rules. It covers radio and protocol choice, security baseline, backend and fleet operations. Load it before recommending a protocol or a security measure, because its rules...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Iot Systems?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gkochievi-iot-systems)
---
name: iot-systems
description: This skill should be used when the user designs or reviews a connected device, fleet, gateway or IoT backend, for example "connect my ESP32 to MQTT", "which IoT protocol", "LoRaWAN or NB-IoT", "BLE GATT design", "Matter / Thread", "device provisioning", "fleet OTA" or "IoT backend", or asks about the EU CRA or RED security rules. It covers radio and protocol choice, security baseline, backend and fleet operations. Load it before recommending a protocol or a security measure, because its rules are checked against the standards.
user-invocable: false
---
# IoT systems
Design the connected part of a product: from the requirements to the radio, the protocol, the device's connectivity logic, identity and security, the backend, fleet updates and tests. The firmware itself (project layout, production rules, persistence, local web page) is in `embedded-firmware`; the MCU and radio chip choice in `microcontrollers`; antennas and RF layout in `pcb-design`; Linux gateways in `embedded-linux`. Versions, prices and regulatory dates in this skill are as of October 2026; recheck them when a project starts.
## Procedure
Work through the steps in order and write each answer into the project's requirements file and decision log (`ask-gela` describes them). Do not choose a protocol before step 1 has numbers.
### 1. Capture the requirements
Ask for these, and turn vague answers into numbers:
| Question | Why it decides things | Example answer |
|---|---|---|
| Data: bytes per report, reports per day, bursts (images, logs, firmware) | Airtime, data plan, protocol | 20 bytes every 15 min; a 1.5 MB update twice a year |
| Direction and latency: commands to the device? how fast? | LoRaWAN Class A and NB-IoT PSM give minutes to hours | Price change within 1 min |
| Power: mains, rechargeable, primary cell; life target | Excludes Wi-Fi on small cells; sets the energy per report | 2 × AA lithium, 5 years |
| Range and environment: indoor, outdoor, metal, distance to gateway or access point, moving | Radio class, antenna, enclosure | Basement meters, 1 km to the nearest mast |
| Cost: per unit (module, antenna, certification share) and per month (SIM, network server, cloud) over the support period | Rules out options that look cheap on the BOM | Under USD 15 BOM for the radio, under USD 1 per month |
| Cloud: customer's cloud, self-hosted, data residency, must work offline | Broker and backend choice, local-first design | Self-hosted in the EU; site keeps working without internet |
| Market and regulation: EU, US, others; consumer or industrial | RED/EN 18031, CRA, FCC, labels | EU consumer product |
| Support period and field life | CRA support period (normally at least 5 years), OTA, certificate lifetimes | 7 years |
| Fleet: number of devices, who installs, who provisions, who owns | Provisioning flow, claim codes, device management tool | 2,000 units, installed by the customer with a phone app |
| What must work without the network | Local control, offline queue, safe states | Payments and outputs |
Then compute bytes and airtime per day and the energy per report (`references/iot-architecture.md` section 3; `scripts/lorawan_airtime.py` for LoRa).
### 2. Choose the radio and protocol
Use the selection table and the decision sequence in `references/iot-architecture.md` section 2. Short form:
| Situation | Radio | Protocol | Infrastructure | Detail |
|---|---|---|---|---|
| Mains device in a building with usable Wi-Fi | Wi-Fi (or Ethernet) | MQTT over TLS | Broker | `references/mqtt.md` |
| Battery device next to a person or a phone | BLE | GATT; phone app as gateway | Phone or BLE gateway | `references/ble.md` |
| Battery sensors kilometres away, a few reports per hour | LoRa | LoRaWAN | Gateways, network server | `references/lpwan-and-cellular.md` |
| Fixed or mobile device with no local infrastructure | LTE-M or NB-IoT | MQTT (LTE-M) or CoAP/LwM2M with PSM | Operator SIM | `references/lpwan-and-cellular.md`, `references/coap-lwm2m.md` |
| Smart-home device for Apple, Google, Amazon or SmartThings | Thread or Wi-Fi (BLE to commission) | Matter | Border router, ecosystem controller | `references/thread-matter-zigbee.md` |
| Joins an existing Zigbee installation | 802.15.4 | Zigbee 3.0 | Coordinator / hub | `references/thread-matter-zigbee.md` |
| Many sensors on a field bus or short-range radio in one site | RS-485, BLE, 802.15.4, LoRa to a gateway | Gateway translates to MQTT | Linux or ESP32-class gateway | `embedded-linux` skill |
Rules:
- Wi-Fi is for mains or large rechargeable batteries; connection setup costs seconds at hundreds of mA.
- LoRaWAN is uplink-heavy: few downlinks, duty-cycle and fair-use limits, small payloads. Check `scripts/lorawan_airtime.py --region EU868 --dr <n> --app-payload <bytes> --interval <s> --ttn` before promising a reporting rate.
- Cellular: confirm coverage, LTE-M versus NB-IoT support and roaming for every target country with the operator, not from maps alone.
- BLE: check the connection parameters with `scripts/ble_conn_check.py` (add `--apple` when iPhones connect).
- Matter adds certification cost and factory attestation data; budget them before choosing it (`references/thread-matter-zigbee.md` section 3.6).
### 3. Lay out the device architecture
Check each item in the design and in code review:
- [ ] Control, safety and money run locally and never wait for the network (`references/iot-architecture.md` section 1).
- [ ] One device ID used for the certificate, client ID, topics, database and label; a versioned topic tree with per-device ACLs (section 1.1).
- [ ] Connectivity is an explicit state machine in its own task, with exponential backoff and full jitter, and permanent errors separated from transient ones (section 7).
- [ ] Every message carries a device-assigned `msg_id` unique across reboots, a UTC timestamp and the firmware or schema version (sections 4 and 6.1).
- [ ] Offline data goes to a bounded non-volatile queue, uploaded oldest first at a limited rate, deleted after an acknowledgement (section 6.2).
- [ ] Time comes from SNTP, the network or an RTC; readings before the first sync are marked; TLS does not run on an unset clock (section 5).
- [ ] Watchdogs are layered: task, hardware, connectivity (power-cycle the modem, then reboot), boot-loop guard with a safe mode (section 8).
- [ ] The power budget is computed per report and then measured over a full cycle including a failed transmission (section 3).
- [ ] Desired and reported state are separate; commands carry an ID and an expiry (section 9).
- [ ] Filtering, deadband and local alarms run on the device; analytics in the cloud (section 10).
Firmware patterns behind these: `embedded-firmware/references/architecture.md`, `persistence-and-power-fail.md`, `webui-and-ota.md`.
### 4. Apply the security baseline
Require all of these unless the threat model (`references/security-and-provisioning.md` section 1) gives a written reason; section numbers below refer to that file:
1. A unique identity per device: private key generated on the device or in a secure element, X.509 certificate, no fleet-wide secret in the image (section 2).
2. No default passwords: per-device or user-set; EN 18031 gives no presumption of conformity if the user may skip setting a password (section 7.2).
3. Signed OTA, verified before boot, with rollback and anti-rollback (section 6; `references/fleet-ota-and-backend.md` section 1).
4. TLS 1.2/1.3 with server validation on every connection; mutual TLS to the broker (section 4).
5. Keys protected at rest: flash encryption plus the chip key store (ESP32 DS or ECDSA peripheral) or a secure element (ATECC608B, SE050, OPTIGA Trust M) when the threat model includes physical access (sections 2.2, 2.3).
6. Provisioning modes opened only by a local action and closed by timeout, with per-device proof of possession (section 3.4).
7. Debug ports locked on production units, fuse state recorded (section 6).
8. Rotation and revocation paths tested; a deny list at the broker (section 5).
9. SBOM per release, CVE scanning in CI, a public vulnerability disclosure policy, a stated support period (section 8).
Regulatory dates to put in the plan (details and sources in section 7):
| Market | Requirement | Date |
|---|---|---|
| EU | RED delegated regulation (EU) 2022/30, assessed with EN 18031-1/-2/-3 (cited with restrictions by Implementing Decision (EU) 2025/138) | Applies since 1 August 2025; repealed by (EU) 2026/339 with effect from 11 December 2027 |
| EU | Cyber Resilience Act, Regulation (EU) 2024/2847: reporting of actively exploited vulnerabilities and severe incidents (24 h early warning, 72 h notification) via ENISA's single reporting platform | From 11 September 2026 |
| EU | CRA essential requirements, conformity assessment, CE marking | From 11 December 2027 |
| Consumer IoT reference | ETSI EN 303 645 V3.1.3 (2024-09), assessed with ETSI TS 103 701 | Current |
| US | Cyber Trust Mark, voluntary FCC label; ioXt Alliance lead administrator since April 2026 | Check fcc.gov/CyberTrustMark |
### 5. Design the backend
Start from the reference stack in `references/fleet-ota-and-backend.md` sections 4 to 10: MQTT broker with mutual TLS and per-device ACLs → ingestion service (Python FastAPI) on a shared subscription → PostgreSQL with TimescaleDB for time series, Redis for latest state, presence and rate limits → API with JWT user auth → Grafana dashboards and alerting.
Rules:
- The device ID comes from the authenticated identity (certificate, topic enforced by the broker), never from the payload.
- De-duplicate on `(device_id, msg_id)` in the same transaction as the insert; answer a duplicate as success.
- Validate every field and the timestamp window on ingestion; accept old timestamps (backlog), reject unsynced (1970) and future ones.
- Narrow telemetry table plus continuous aggregates; retention written down (section 8).
- Check the licence of each server component you deliver to a client: EMQX 5.9.0 and later is BSL-licensed (clusters and bundling into products sold to third parties need a commercial licence); Mosquitto is EPL/EDL; Redis 8 offers RSALv2, SSPLv1 or AGPLv3.
Start code from `examples/backend/`; its tests run on SQLite with `python3 -m pytest -q`.
### 6. Plan fleet operations
- **OTA rollout:** staged (lab, 1 %, 10 %, 50 %, 100 %) with health gates and automatic abort; never reuse a version number (`references/fleet-ota-and-backend.md` sections 1 and 2).
- **Device management:** choose between Mender, Eclipse hawkBit, Memfault, AWS IoT Jobs, Golioth or a self-built job table by platform, existing cloud and crash-analytics needs (section 3).
- **Observability:** heartbeats with reset reason, firmware, signal, free memory and queue depth; crash reports and core dumps with an ELF archive per release; alerts on missing heartbeats (sections 9 and 11).
- **Provisioning:** factory station flow with on-device key generation and a registry record per unit; claim codes for ownership (`references/security-and-provisioning.md` section 3).
- **End of life:** unclaim, data deletion, identity disabled, support-period end announced.
### 7. Test
- Protocol: broker restart, hours of link loss with backlog drain, duplicates, out-of-order arrival, clock not set at boot.
- Power: measure average current over full report cycles and a day of real traffic; compare with the budget.
- OTA: power cut during download and during install, bad signature, wrong hardware revision, rollback when the new image cannot reach the server, oldest shipped version to newest.
- Provisioning: wrong Wi-Fi password, timeout, factory reset, re-provisioning, claim and unclaim.
- Security: port scan, debug ports locked, invalid server certificate and revoked device certificate refused, rate limits.
- Backend: load test at 10 times the expected message rate; restore from backup; Redis flushed and rebuilt.
- RF: range in the final enclosure and installation position; coexistence with Wi-Fi for 2.4 GHz radios.
- Matter / Thread: two ecosystems, two border routers, multi-admin, 50 factory resets (`references/thread-matter-zigbee.md` section 8).
State in every answer what was tested on hardware, what only in host tests or simulation, and what not at all.
## Corrections to common advice
- **MQTT packet identifiers do not de-duplicate end to end.** They are reused after acknowledgement and assigned per hop; use an application `msg_id` from the device (`references/iot-architecture.md` section 6.1, `references/mqtt.md`).
- **An OTA image must pass a signature check before it boots.** A hash, CRC or TLS download proves integrity of the transfer, not origin (`references/security-and-provisioning.md` section 6).
- **BLE supervision timeout:** the Core Specification rule is timeout > (1 + peripheral latency) × connection interval × 2, not × 4 (`references/ble.md` section 4, `scripts/ble_conn_check.py`).
- **ESP-IDF 6.0 removed `wifi_provisioning` from the core:** use the `espressif/network_provisioning` component; Security 0 and 1 are now off by default (`references/security-and-provisioning.md` section 3.4).
- **Improv Wi-Fi sends the SSID and password unencrypted** at the application layer; its protection is the BLE link and the authorization window.
- **`west spdx --init` is deprecated:** enable `CONFIG_BUILD_OUTPUT_META` instead (`references/security-and-provisioning.md` section 8).
- **nRF52 in new designs:** nRF Connect SDK 3.4.0 declares the nRF52 Series feature complete (LTS fixes for five years, no new features); prefer the nRF54L series for new Thread, Matter or BLE products.
- **A TimescaleDB unique index must include the time column,** so `(device_id, msg_id)` cannot be the key of a telemetry hypertable; keep de-duplication keys in a plain table (`references/fleet-ota-and-backend.md` section 6).
## Engineering plugin skills
If the Engineering plugin is installed: `/engineering:system-design` or `/engineering:architecture` for the pattern, protocol and broker decisions; `/engineering:testing-strategy` for the step 7 plan; `/engineering:code-review` with the step 3 and 4 checklists; `/engineering:deploy-checklist` before each OTA stage; `/engineering:incident-response` for fleet outages and the CRA 24-hour reporting clock; `/engineering:documentation` for provisioning guides and runbooks.
## References
| File | Use for |
|---|---|
| `references/iot-architecture.md` | system patterns, topics and IDs, protocol selection, power budget per report (LoRaWAN example), encoding, time, offline queue and message IDs, state machine, watchdogs, device twin, edge versus cloud |
| `references/mqtt.md` | MQTT 3.1.1 versus 5.0, QoS, sessions, retained and will messages, keep-alive, topics, ACLs, shared subscriptions, brokers, TLS on MCUs, clients, bridging |
| `references/coap-lwm2m.md` | CoAP, observe, block-wise, DTLS and OSCORE, LwM2M objects, bootstrap, firmware update object, implementations |
| `references/ble.md` | GATT design, advertising, connection parameters, throughput, pairing, privacy, OTA over BLE, stacks, test tools |
| `references/lpwan-and-cellular.md` | LoRaWAN classes, regions and limits; NB-IoT and LTE-M, PSM and eDRX, modules, SIMs, coverage |
| `references/thread-matter-zigbee.md` | Thread roles and border routers, Thread 1.4, Matter versions, commissioning, DAC/PAI/PAA, Matter OTA, CSA fees, Zigbee PRO 2023 and 4.0, chips, SDKs |
| `references/security-and-provisioning.md` | threat model, identity and key storage, secure elements, provisioning flows, claim codes, Wi-Fi provisioning, rotation, secure boot overview, EN 303 645, RED/EN 18031, CRA, Cyber Trust Mark, SBOM |
| `references/fleet-ota-and-backend.md` | fleet OTA, rollout policy, device management tools, reference backend, broker licences and ACLs, ingestion, TimescaleDB schema, auth, retention, alerting, Grafana, heartbeats, core dumps |
| `scripts/lorawan_airtime.py` | LoRa / LoRaWAN time on air, duty-cycle interval, US915 dwell check, TTN fair-use budget, SF table (`--help`, `--json`) |
| `scripts/ble_conn_check.py` | validate BLE connection interval, latency and supervision timeout (optionally Apple's rules), estimate latency and throughput (`--help`, `--json`) |
| `examples/backend/` | minimal FastAPI ingestion service with exactly-once storage, MQTT bridge, portable schema plus TimescaleDB section, pytest tests |
## Related skills
- `embedded-firmware`: firmware structure, production rules, persistence and power-fail, the local web page and single-device OTA, secure boot and signed OTA implementation.
- `microcontrollers`: choosing the MCU or radio SoC and module (`microcontrollers/references/mcu-selection.md` sections 2, 6 and 7).
- `pcb-design`: antenna placement, RF feed lines and keep-outs, ESP32 module layout (`pcb-design/references/esp32-hardware.md`, `pcb-design/references/stackups-and-routing.md`).
- `embedded-linux`: Linux gateways, border routers on Linux, A/B updates with RAUC, SWUpdate or Mender.
- `peripherals`: radio modules (LoRa, cellular, BLE, 802.15.4), antennas and radio certification (`peripherals/references/communication-modules.md`).
- `electronics-fundamentals`: battery chemistries, regulators and the generic power budget (`electronics-fundamentals/references/power-and-batteries.md`).
- `ask-gela`: requirements file, phases and decision log for the whole product.
## Next step
When this is done, say what comes next: `embedded-firmware` for the device side, `peripherals` for the radio module, `hardware-grilling` when the product decisions are still open.