Iot protocols

From j4flmao/agent-skills · View interactive version

Iot protocols is an AI agent skill from the GitHub repository j4flmao/agent-skills. Use when the user asks about MQTT 5, QoS, retained messages, last will, CoAP, LwM2M, BLE GATT, LoRaWAN, Matter, Thread or device provisioning. Produces device-to-cloud protocol choice, topic design and TLS/DTLS security. Not for cloud stream processing (use data-streaming) or firmware drivers (use c

How to use this skill

Skill file

IoT Protocols

Purpose

Constrained devices run on batteries, lossy radios and tiny RAM. This skill picks the protocol stack that fits the link and power budget, designs MQTT topics/QoS or CoAP resources correctly, and secures and provisions devices so a fleet can be managed for years.

Agent Protocol

Trigger

"MQTT", "CoAP", "LwM2M", "IoT protocol", "QoS", "retained message", "last will", "MQTT 5", "BLE GATT", "LoRaWAN", "Matter", "Thread", "device provisioning".

Input Context

Output Artifact

Protocol choice, topic/resource design, QoS and session settings, client code. No file unless requested.

Response Format

Link: {radio/network}
Protocol: {MQTT 3.1.1 | MQTT 5 | CoAP | LwM2M | BLE GATT | LoRaWAN}
Design: {topics/resources and payload format}
Delivery: {QoS / confirmable, retries, session expiry}
Security: {TLS/DTLS, cert/PSK, provisioning}
Offline: {buffering and reconnect strategy}

1. Choosing the Stack

| Situation | Choice | Why |

|-----------|--------|-----|

| IP device, always-on-ish, cloud telemetry + commands | MQTT over TLS (TCP 8883) | Broker fan-out, persistent sessions, huge ecosystem |

| Very constrained IP device, UDP/6LoWPAN, sleepy nodes | CoAP (RFC 7252) over DTLS or OSCORE | 4-byte header, UDP, REST semantics, Observe |

| Fleet management (firmware update, config, standard objects) | LwM2M (OMA) over CoAP | Standard object model, FOTA, bootstrap |

| Phone/gateway companion, short range | BLE GATT | Low power, phone native |

| Smart-home interoperability | Matter (over Wi-Fi/Thread/Ethernet) | Multi-vendor ecosystem |

| Long range, few bytes per hour | LoRaWAN | km range, duty-cycle and payload limits |

| Non-IP sensor nets to a gateway | MQTT-SN, Zigbee, proprietary | gateway translates to MQTT |

2. MQTT Essentials

MQTT 5 additions worth using

Reason codes on acks, session and message expiry intervals, user properties (metadata without payload changes), topic aliases (save bytes), request/response (Response Topic + Correlation Data), shared subscriptions ($share/<group>/<topic>) for load-balanced backend consumers, flow control (Receive Maximum).

Topic design

{tenant}/{deviceType}/{deviceId}/telemetry       device -> cloud, QoS 0/1
{tenant}/{deviceType}/{deviceId}/state           retained, device -> cloud
{tenant}/{deviceType}/{deviceId}/cmd/{name}      cloud -> device, QoS 1
{tenant}/{deviceType}/{deviceId}/cmd/{name}/res  device -> cloud, correlation id

3. CoAP Essentials

4. Security and Provisioning

5. Power and Unreliable Links

6. Anti-Patterns

| Anti-pattern | Consequence | Fix |

|--------------|-------------|-----|

| QoS 2 everywhere | latency, broker state, battery | QoS 1 + idempotent consumers |

| One shared credential for all devices | one leak compromises the fleet | per-device certs + ACLs |

| Wildcard subscribe # on devices | receive other devices' traffic | per-device topics + ACL |

| JSON with long keys over NB-IoT | data cost, airtime | CBOR/Protobuf, topic aliases |

| Synchronized reconnect after outage | broker overload | jittered back-off |

| No message timestamp from device | wrong ordering after buffering | device timestamp + sequence number |

7. Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.