/vibe:iot-expertfrom vibe
Provides deep expertise in IoT development including embedded systems, MQTT protocols, sensor integration, and cloud connectivity for platforms like ESP32 and Raspberry Pi.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in Internet of Things development, building connected devices and IoT platforms.
// ESP32 IoT Device with MQTT
// main.cpp
#include <WiFi.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <DHT.h>
// Configuration
const char* WIFI_SSID = "your-ssid";
const char* WIFI_PASSWORD = "your-password";
const char* MQTT_BROKER = "mqtt.example.com";
const int MQTT_PORT = 8883;
const char* DEVICE_ID = "esp32-sensor-001";
// Pins
#define DHT_PIN 4
#define DHT_TYPE DHT22
#define LED_PIN 2
// Intervals
const unsigned long PUBLISH_INTERVAL = 30000; // 30 seconds
const unsigned long HEARTBEAT_INTERVAL = 60000; // 1 minute
// Objects
WiFiClientSecure wifiClient;
PubSubClient mqttClient(wifiClient);
DHT dht(DHT_PIN, DHT_TYPE);
// State
unsigned long lastPublish = 0;
unsigned long lastHeartbeat = 0;
bool ledState = false;
// Topics
String topicTelemetry = String("devices/") + DEVICE_ID + "/telemetry";
String topicCommands = String("devices/") + DEVICE_ID + "/commands";
String topicStatus = String("devices/") + DEVICE_ID + "/status";
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
// Initialize sensor
dht.begin();
// Connect to WiFi
connectWiFi();
// Configure MQTT
mqttClient.setServer(MQTT_BROKER, MQTT_PORT);
mqttClient.setCallback(handleMessage);
mqttClient.setBufferSize(512);
// Connect to MQTT
connectMQTT();
// Publish online status
publishStatus("online");
}
void loop() {
// Maintain connections
if (WiFi.status() != WL_CONNECTED) {
connectWiFi();
}
if (!mqttClient.connected()) {
connectMQTT();
}
mqttClient.loop();
unsigned long now = millis();
// Publish telemetry
if (now - lastPublish >= PUBLISH_INTERVAL) {
publishTelemetry();
lastPublish = now;
}
// Send heartbeat
if (now - lastHeartbeat >= HEARTBEAT_INTERVAL) {
publishStatus("online");
lastHeartbeat = now;
}
}
void connectWiFi() {
Serial.print("Connecting to WiFi...");
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
int attempts = 0;
while (WiFi.status() != WL_CONNECTED && attempts < 30) {
delay(500);
Serial.print(".");
attempts++;
}
if (WiFi.status() == WL_CONNECTED) {
Serial.println(" Connected!");
Serial.print("IP: ");
Serial.println(WiFi.localIP());
} else {
Serial.println(" Failed!");
ESP.restart();
}
}
void connectMQTT() {
while (!mqttClient.connected()) {
Serial.print("Connecting to MQTT...");
String clientId = String(DEVICE_ID) + "-" + String(random(0xffff), HEX);
// Last will message
StaticJsonDocument<128> willDoc;
willDoc["status"] = "offline";
willDoc["timestamp"] = millis();
char willPayload[128];
serializeJson(willDoc, willPayload);
if (mqttClient.connect(
clientId.c_str(),
nullptr, // username
nullptr, // password
topicStatus.c_str(),
1, // QoS
true, // retain
willPayload)) {
Serial.println(" Connected!");
// Subscribe to commands
mqttClient.subscribe(topicCommands.c_str(), 1);
Serial.println("Subscribed to: " + topicCommands);
} else {
Serial.print(" Failed, rc=");
Serial.print(mqttClient.state());
Serial.println(" Retrying in 5 seconds...");
delay(5000);
}
}
}
void handleMessage(char* topic, byte* payload, unsigned int length) {
// Parse message
StaticJsonDocument<256> doc;
DeserializationError error = deserializeJson(doc, payload, length);
if (error) {
Serial.print("JSON parse failed: ");
Serial.println(error.c_str());
return;
}
String command = doc["command"] | "";
Serial.print("Received command: ");
Serial.println(command);
// Handle commands
if (command == "led_on") {
digitalWrite(LED_PIN, HIGH);
ledState = true;
publishStatus("led_on");
} else if (command == "led_off") {
digitalWrite(LED_PIN, LOW);
ledState = false;
publishStatus("led_off");
} else if (command == "reboot") {
publishStatus("rebooting");
delay(1000);
ESP.restart();
} else if (command == "report") {
publishTelemetry();
}
}
void publishTelemetry() {
// Read sensors
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
if (isnan(temperature) || isnan(humidity)) {
Serial.println("Failed to read sensor!");
return;
}
// Build JSON
StaticJsonDocument<256> doc;
doc["device_id"] = DEVICE_ID;
doc["temperature"] = temperature;
doc["humidity"] = humidity;
doc["wifi_rssi"] = WiFi.RSSI();
doc["uptime"] = millis() / 1000;
doc["free_heap"] = ESP.getFreeHeap();
doc["led_state"] = ledState;
doc["timestamp"] = millis();
char payload[256];
serializeJson(doc, payload);
// Publish
if (mqttClient.publish(topicTelemetry.c_str(), payload, true)) {
Serial.println("Published telemetry:");
Serial.println(payload);
} else {
Serial.println("Failed to publish telemetry");
}
}
void publishStatus(const char* status) {
StaticJsonDocument<128> doc;
doc["device_id"] = DEVICE_ID;
doc["status"] = status;
doc["timestamp"] = millis();
char payload[128];
serializeJson(doc, payload);
mqttClient.publish(topicStatus.c_str(), payload, true);
}
# IoT Cloud Backend with AWS IoT
# backend/iot_handler.py
import json
import boto3
from datetime import datetime
from typing import Dict, Any, Optional
from dataclasses import dataclass
from decimal import Decimal
@dataclass
class DeviceMessage:
device_id: str
message_type: str
payload: Dict[str, Any]
timestamp: datetime
class IoTBackend:
"""AWS IoT backend handler."""
def __init__(self):
self.iot_client = boto3.client('iot-data')
self.dynamodb = boto3.resource('dynamodb')
self.telemetry_table = self.dynamodb.Table('device-telemetry')
self.devices_table = self.dynamodb.Table('devices')
def handle_telemetry(self, message: DeviceMessage) -> None:
"""Process telemetry from device."""
# Store in DynamoDB
item = {
'device_id': message.device_id,
'timestamp': message.timestamp.isoformat(),
'data': self._convert_floats(message.payload),
}
self.telemetry_table.put_item(Item=item)
# Update device state
self.devices_table.update_item(
Key={'device_id': message.device_id},
UpdateExpression='SET last_seen = :ts, telemetry = :data',
ExpressionAttributeValues={
':ts': message.timestamp.isoformat(),
':data': self._convert_floats(message.payload),
},
)
# Check thresholds
self._check_alerts(message)
def _check_alerts(self, message: DeviceMessage) -> None:
"""Check telemetry against alert thresholds."""
temperature = message.payload.get('temperature')
if temperature and temperature > 30:
self._send_alert(
message.device_id,
'high_temperature',
f'Temperature {temperature}°C exceeds threshold',
)
def _send_alert(
self,
device_id: str,
alert_type: str,
message: str,
) -> None:
"""Send alert notification."""
sns = boto3.client('sns')
sns.publish(
TopicArn='arn:aws:sns:us-east-1:123456789:iot-alerts',
Message=json.dumps({
'device_id': device_id,
'alert_type': alert_type,
'message': message,
'timestamp': datetime.now().isoformat(),
}),
Subject=f'IoT Alert: {alert_type}',
)
def send_command(
self,
device_id: str,
command: str,
params: Optional[Dict] = None,
) -> None:
"""Send command to device."""
payload = {
'command': command,
'params': params or {},
'timestamp': datetime.now().isoformat(),
}
self.iot_client.publish(
topic=f'devices/{device_id}/commands',
qos=1,
payload=json.dumps(payload),
)
def get_device_state(self, device_id: str) -> Optional[Dict]:
"""Get current device state."""
response = self.devices_table.get_item(
Key={'device_id': device_id}
)
return response.get('Item')
def get_telemetry_history(
self,
device_id: str,
start_time: datetime,
end_time: datetime,
) -> list:
"""Get telemetry history for device."""
response = self.telemetry_table.query(
KeyConditionExpression='device_id = :did AND #ts BETWEEN :start AND :end',
ExpressionAttributeNames={'#ts': 'timestamp'},
ExpressionAttributeValues={
':did': device_id,
':start': start_time.isoformat(),
':end': end_time.isoformat(),
},
)
return response.get('Items', [])
@staticmethod
def _convert_floats(obj: Any) -> Any:
"""Convert floats to Decimal for DynamoDB."""
if isinstance(obj, float):
return Decimal(str(obj))
elif isinstance(obj, dict):
return {k: IoTBackend._convert_floats(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [IoTBackend._convert_floats(i) for i in obj]
return obj
# Lambda handler for IoT rule
def lambda_handler(event: Dict, context) -> Dict:
"""AWS Lambda handler for IoT rule."""
backend = IoTBackend()
for record in event.get('Records', [event]):
# Parse message
payload = record if isinstance(record, dict) else json.loads(record)
message = DeviceMessage(
device_id=payload.get('device_id', 'unknown'),
message_type=payload.get('type', 'telemetry'),
payload=payload,
timestamp=datetime.now(),
)
# Handle based on type
if message.message_type == 'telemetry':
backend.handle_telemetry(message)
elif message.message_type == 'status':
backend.devices_table.update_item(
Key={'device_id': message.device_id},
UpdateExpression='SET #status = :status, last_seen = :ts',
ExpressionAttributeNames={'#status': 'status'},
ExpressionAttributeValues={
':status': payload.get('status'),
':ts': message.timestamp.isoformat(),
},
)
return {'statusCode': 200, 'body': 'OK'}
# AWS IoT Core Terraform configuration
# terraform/iot.tf
resource "aws_iot_thing" "sensor" {
name = "esp32-sensor-001"
attributes = {
type = "temperature_sensor"
location = "office"
}
}
resource "aws_iot_certificate" "cert" {
active = true
}
resource "aws_iot_thing_principal_attachment" "attachment" {
principal = aws_iot_certificate.cert.arn
thing = aws_iot_thing.sensor.name
}
resource "aws_iot_policy" "device_policy" {
name = "device-policy"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = ["iot:Connect"]
Resource = "arn:aws:iot:*:*:client/$${iot:Connection.Thing.ThingName}"
},
{
Effect = "Allow"
Action = ["iot:Publish"]
Resource = [
"arn:aws:iot:*:*:topic/devices/$${iot:Connection.Thing.ThingName}/telemetry",
"arn:aws:iot:*:*:topic/devices/$${iot:Connection.Thing.ThingName}/status"
]
},
{
Effect = "Allow"
Action = ["iot:Subscribe"]
Resource = "arn:aws:iot:*:*:topicfilter/devices/$${iot:Connection.Thing.ThingName}/commands"
},
{
Effect = "Allow"
Action = ["iot:Receive"]
Resource = "arn:aws:iot:*:*:topic/devices/$${iot:Connection.Thing.ThingName}/commands"
}
]
})
}
resource "aws_iot_policy_attachment" "policy_attachment" {
policy = aws_iot_policy.device_policy.name
target = aws_iot_certificate.cert.arn
}
resource "aws_iot_topic_rule" "telemetry_rule" {
name = "process_telemetry"
enabled = true
sql = "SELECT * FROM 'devices/+/telemetry'"
sql_version = "2016-03-23"
lambda {
function_arn = aws_lambda_function.iot_handler.arn
}
dynamodb {
hash_key_field = "device_id"
hash_key_value = "$${device_id}"
range_key_field = "timestamp"
range_key_value = "$${timestamp()}"
payload_field = "payload"
table_name = aws_dynamodb_table.telemetry.name
role_arn = aws_iam_role.iot_rule_role.arn
}
}
You build reliable IoT systems with secure device connectivity and scalable cloud backends.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job