shelly-scripting

shelly-scripting is a skill for Claude Code, Codex from mslavov/shelly-forge. It costs 110 tokens per session (1,311 once invoked), scanned A, original, MIT.

A guide to writing TypeScript scripts that run directly on Shelly Gen2 or newer smart-home devices. It explains the device's limited scripting environment, supported APIs, callbacks, timers, storage, and resource limits.

In plain words
What is it for?
Use it to write or review Shelly scripts involving device calls, timers, MQTT, Bluetooth data, HTTP endpoints, persistent storage, and device state.
Why use it?
Code that works in Node.js or a web browser may fail on the device, which has different APIs and limited resources. The rules help prevent crashes, blocked device tasks, lost state, and oversized scripts.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write or review Shelly scripts involving device calls, timers, MQTT, Bluetooth data, HTTP endpoints, persistent storage, and device state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mslavov/shelly-forge/shelly-scripting
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mslavov/shelly-forge --skill shelly-scripting
Clone the repo
git clone --depth 1 https://github.com/mslavov/shelly-forge

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for shelly-scripting

README.md
[![agentmods](https://agentmods.dev/badge/skills/mslavov/shelly-forge/shelly-scripting/github.svg)](https://agentmods.dev/skills/mslavov/shelly-forge/shelly-scripting)
Your own site
<a href="https://agentmods.dev/skills/mslavov/shelly-forge/shelly-scripting"><img src="https://agentmods.dev/badge/skills/mslavov/shelly-forge/shelly-scripting/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for shelly-scripting

Your own site · 80×15
<a href="https://agentmods.dev/skills/mslavov/shelly-forge/shelly-scripting"><img src="https://agentmods.dev/badge/skills/mslavov/shelly-forge/shelly-scripting.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 110 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,311 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00110 $0.01311
Opus 5.5 $0.00044 $0.00524
Sonnet 5.5 $0.00022 $0.00262
Haiku 4.5 $0.00011 $0.00131

Measured today against content hash ebb1578586a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

shelly-scripting scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/shelly-scripting/SKILL.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Shelly device scripting

Write device code in TypeScript under src/<solution>/. Each configured entry becomes one ES5 script on a device. The interpreter is not Node or a browser. Support varies by model and firmware. Check that the target supports scripting and the APIs you use.

Rules that prevent crashes

  1. Keep callbacks shallow. The official language reference warns that more than two or three levels of nested anonymous functions can crash the device. Define named callbacks before use and register them at startup.
  2. Never block. Scripts share the firmware's main task. Use Timer.set and callbacks instead of busy waits or long loops.
  3. Track resource use. Each script has at most 5 timers, 5 event handlers, 5 status handlers, 5 in-flight RPC calls, 10 MQTT subscriptions, and 5 HTTP endpoints. Register once, release unused handles, and sequence RPC calls.
  4. Keep durable state in KVS or Script.storage. Module variables reset when the script restarts. Validate stored values before using them.
  5. Keep the final artifact at or below SCRIPT_MAX_BYTES, 65535 UTF-8 bytes. Script.PutCode rejects 65536 bytes or more. Forge reports size-limit above the limit and size-budget above 80% of it.

Use the device types and checks

The generated device tsconfig loads node_modules/shelly-forge/types/lib.shelly.d.ts and node_modules/shelly-forge/types/shelly.d.ts with noLib: true and types: []. The replacement library rejects missing globals and unsupported array methods. Keep moduleDetection: "force" in both device and test configurations so files without imports or exports stay separate modules. Do not add Node or DOM types to device code to silence errors.

Forge bundles with esbuild's esnext target and uses TypeScript for ES5 lowering. Its __assign and __rest helpers feature-detect missing built-ins and use fallbacks. The final pass normalizes UTF-8 even with --no-minify. AST checks use the unminified ES5 bundle and include code excerpts; size checks use the shipped artifact. For minified builds and check, text locations include (unminified) and JSON findings include bundle: "unminified". build --no-minify writes the matching file. Fix errors and investigate warnings. --strict makes warnings fail the check. Passing these checks does not prove device compatibility.

Read the full file on GitHub · 97 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 97 lines · 110 tokens per session scan A ebb1578586a7

Subscribe to this mod's changes

shelly-scripting is a skill published in the GitHub repository mslavov/shelly-forge (21 stars, last pushed yesterday), licensed MIT. It adds 110 tokens to every session and 1,311 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-06.

Related

shelly-scripting compared with skills from other repositories

shelly-scripting next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
shelly-scriptingmslavov/shelly-forgeSkill21yesterdayMITA110Claude Code, Codex
womldali-benothmen/womlSkill1742d agononeA66Claude Code, Codex
bun-ffi-native-bindingHarmeet10000/skillsSkill76mo agoMITA48Claude Code, Codex
viam-typescriptviam-devrel/agent-skillsSkill23mo agononeA234Claude Code
no-bare-castsprisma/ormSkill48kyesterdayApache-2.0A52Claude Code, Codex
aws-sst-developmentsickn33/agentic-awesome-skillsSkill49kyesterdayMITA26Claude Code
holoscan-install-wheelNVIDIA/skillsSkill3.9kyesterdayApache-2.0A34Claude Code, Codex