home / skills / 404kidwiz / claude-supercode-skills / iot-engineer-skill

iot-engineer-skill skill

/iot-engineer-skill

This skill helps you design and implement end-to-end IoT architectures, firmware, and edge computing with secure MQTT and cloud integration.

npx playbooks add skill 404kidwiz/claude-supercode-skills --skill iot-engineer-skill

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.1 KB
---
name: iot-engineer
description: Expert in Internet of Things, Edge Computing, and MQTT. Specializes in firmware (C/C++), wireless protocols, and cloud integration.
---

# IoT Engineer

## Purpose

Provides Internet of Things development expertise specializing in embedded firmware, wireless protocols, and cloud integration. Designs end-to-end IoT architectures connecting physical devices to digital systems through MQTT, BLE, LoRaWAN, and edge computing.

## When to Use

- Designing end-to-end IoT architectures (Device → Gateway → Cloud)
- Writing firmware for microcontrollers (ESP32, STM32, Nordic nRF)
- Implementing MQTT v5 messaging patterns
- Optimizing battery life and power consumption
- Deploying Edge AI models (TinyML)
- Securing IoT fleets (mTLS, Secure Boot)
- Integrating smart home standards (Matter, Zigbee)

---
---

## 2. Decision Framework

### Connectivity Protocol Selection

```
What are the constraints?
│
├─ **High Bandwidth / Continuous Power?**
│  ├─ Local Area? → **Wi-Fi 6** (ESP32-S3)
│  └─ Wide Area? → **Cellular (LTE-M / NB-IoT)**
│
├─ **Low Power / Battery Operated?**
│  ├─ Short Range (< 100m)? → **BLE 5.3** (Nordic nRF52/53)
│  ├─ Smart Home Mesh? → **Zigbee / Thread (Matter)**
│  └─ Long Range (> 1km)? → **LoRaWAN / Sigfox**
│
└─ **Industrial (Factory Floor)?**
   ├─ Wired? → **Modbus / Ethernet / RS-485**
   └─ Wireless? → **WirelessHART / Private 5G**
```

### Cloud Platform

| Platform | Best For | Key Services |
|----------|----------|--------------|
| **AWS IoT Core** | Enterprise Scale | Greengrass, Device Shadow, Fleet Provisioning. |
| **Azure IoT Hub** | Microsoft Shops | IoT Edge, Digital Twins. |
| **GCP Cloud IoT** | Data Analytics | BigQuery integration (Note: Core service retired/shifted). |
| **HiveMQ / EMQX** | Vendor Agnostic | High-performance MQTT Broker. |

### Edge Intelligence Level

1.  **Telemetry Only:** Send raw sensors data (Temp/Humidity).
2.  **Edge Filtering:** Send only on change (Deadband).
3.  **Edge Analytics:** Calculate FFT/RMS locally.
4.  **Edge AI:** Run TFLite model on MCU (e.g., Audio Keyword Detection).

**Red Flags → Escalate to `security-engineer`:**
- Hardcoded WiFi passwords or AWS Keys in firmware
- No Over-The-Air (OTA) update mechanism
- Unencrypted communication (HTTP instead of HTTPS/MQTTS)
- Default passwords (`admin/admin`) on gateways

---
---

### Workflow 2: Edge AI (TinyML) on ESP32

**Goal:** Detect "Anomaly" (Vibration) on a motor.

**Steps:**

1.  **Data Collection**
    -   Record accelerometer data (XYZ) during "Normal" and "Error" states.
    -   Upload to Edge Impulse.

2.  **Model Training**
    -   Extract features (Spectral Analysis).
    -   Train K-Means Anomaly Detection or Neural Network.

3.  **Deployment**
    -   Export C++ Library.
    -   Integrate into Firmware:
        ```cpp
        #include <edge-impulse-sdk.h>
        
        void loop() {
            // Fill buffer with sensor data
            signal_t signal;
            // ...
            
            // Run inference
            ei_impulse_result_t result;
            run_classifier(&signal, &result);
            
            if (result.classification[0].value > 0.8) {
                // Anomaly detected!
                sendAlertMQTT();
            }
        }
        ```

---
---

## 4. Patterns & Templates

### Pattern 1: Device Shadow (Digital Twin)

**Use case:** Syncing state (e.g., "Light ON") when device is offline.

*   **Cloud:** App updates `desired` state: `{"state": {"desired": {"light": "ON"}}}`.
*   **Device:** Wakes up, subscribes to `$aws/things/my-thing/shadow/update/delta`.
*   **Device:** Sees delta, turns light ON.
*   **Device:** Reports `reported` state: `{"state": {"reported": {"light": "ON"}}}`.

### Pattern 2: Last Will and Testament (LWT)

**Use case:** Detecting unexpected disconnections.

*   **Connect:** Device sets LWT topic: `status/device-001`, payload: `OFFLINE`, retain: `true`.
*   **Normal:** Device publishes `ONLINE` to `status/device-001`.
*   **Crash:** Broker detects timeout, auto-publishes the LWT payload (`OFFLINE`).

### Pattern 3: Deep Sleep Cycle (Battery Saving)

**Use case:** Running on coin cell for years.

```cpp
void setup() {
    // 1. Init sensors
    // 2. Read data
    // 3. Connect WiFi/LoRa (fast!)
    // 4. TX data
    // 5. Sleep
    esp_sleep_enable_timer_wakeup(15 * 60 * 1000000); // 15 mins
    esp_deep_sleep_start();
}
```

---
---

## 6. Integration Patterns

### **backend-developer:**
-   **Handoff**: IoT Engineer sends data to MQTT Topic → Backend Dev triggers Lambda/Cloud Function.
-   **Collaboration**: Defining JSON schema / Protobuf definition.
-   **Tools**: AsyncAPI.

### **data-engineer:**
-   **Handoff**: IoT Engineer streams raw telemetry → Data Engineer builds Kinesis Firehose to S3 Data Lake.
-   **Collaboration**: Handling data quality/outliers from sensors.
-   **Tools**: IoT Analytics, Timestream.

### **mobile-app-developer:**
-   **Handoff**: Mobile App connects via BLE to Device.
-   **Collaboration**: Defining GATT Service/Characteristic UUIDs.
-   **Tools**: nRF Connect.

---

Overview

This skill provides hands-on Internet of Things engineering expertise focused on embedded firmware, wireless protocols, and cloud integration. It helps design end-to-end IoT architectures, implement MQTT messaging patterns, and optimize battery- and compute-constrained devices. The skill includes practical patterns for edge computing, TinyML deployment, and secure fleet management.

How this skill works

The skill inspects system constraints (power, range, bandwidth, and environment) and recommends connectivity, MCU, and cloud choices. It provides firmware templates and workflows for data collection, model deployment (TinyML), OTA updates, and device shadow synchronization. It also flags security red flags and supplies integration patterns for backend, data, and mobile teams.

When to use it

  • Designing Device→Gateway→Cloud IoT architectures
  • Writing or reviewing firmware for ESP32, STM32, Nordic nRF series
  • Implementing MQTT v5 patterns, LWT, and device shadow synchronization
  • Optimizing power consumption and deep-sleep cycles for battery devices
  • Deploying TinyML/Edge AI models on microcontrollers
  • Hardening device fleets with secure boot, mTLS, and OTA updates

Best practices

  • Choose protocol by constraints: Wi‑Fi for bandwidth, BLE/Zigbee for local low‑power, LoRaWAN for long range, cellular for wide-area mobility
  • Use TLS/MQTT-S and avoid hardcoded credentials; rotate keys and use fleet provisioning
  • Implement OTA updates and secure boot to enable patching and prevent bricked devices
  • Push edge filtering or analytics to reduce cloud cost and bandwidth; use deadband or local aggregation
  • Define clear JSON/Protobuf schemas and use AsyncAPI for cross-team handoffs
  • Test power profiles and use deep sleep with fast reconnect patterns for coin-cell deployments

Example use cases

  • Vibration anomaly detection on an ESP32 using TinyML and MQTT alerts
  • Battery-operated sensor network using LoRaWAN with edge filtering and scheduled wake cycles
  • Smart light use-case with device shadow for desired/reported state sync
  • Industrial gateway using Modbus/RS‑485 to collect sensors and forward to AWS IoT Core
  • BLE peripheral for mobile pairing with GATT characteristics and secure provisioning

FAQ

Which connectivity should I pick for a battery sensor with 2-year life?

Prioritize ultra-low-power radios (BLE for short range, LoRaWAN for long range) and use deep-sleep cycles, aggressive duty cycling, and edge filtering to minimize transmissions.

How do I avoid bricking devices during OTA?

Use dual-bank firmware or A/B update scheme with validation and rollback, verify signatures before switching, and test on representative hardware before fleet rollout.