shelly-development-standards

shelly-development-standards is a cursor rule for Cursor from mslavov/shelly-forge. It costs 1,265 tokens per session, scanned A, original, MIT.

A set of TypeScript standards for programming Shelly smart-home devices within their limited JavaScript environment.

In plain words
What is it for?
Use it when building Shelly scripts and solutions involving device state, schedules, API data, and asynchronous callbacks.
Why use it?
It helps avoid device crashes and unreliable behavior caused by unsupported patterns, missing types, or excessive callback nesting.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/mslavov/shelly-forge/shelly-development-standards
Clone the repo
git clone --depth 1 https://github.com/mslavov/shelly-forge

Made for: Cursor.

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-development-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/mslavov/shelly-forge/shelly-development-standards.svg)](https://agentmods.dev/rules/mslavov/shelly-forge/shelly-development-standards)
Your own site
<a href="https://agentmods.dev/rules/mslavov/shelly-forge/shelly-development-standards"><img src="https://agentmods.dev/badge/rules/mslavov/shelly-forge/shelly-development-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,265 This file is loaded in full into every session.
When invoked 1,265 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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.01265 $0.01265
Opus 5 $0.00633 $0.00633
Sonnet 5 $0.00253 $0.00253
Haiku 4.5 $0.00127 $0.00127

Measured 4d ago against content hash d2f251ea419a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

shelly-development-standards 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 4d ago.

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.

templates/default/.cursor/rules/shelly-development-standards.mdc · 208 lines

How it starts

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

Shelly Development Standards

This rule defines standards and best practices for developing solutions for Shelly devices.

Overview

Shelly scripts run on a modified version of mJS (a subset of JavaScript) and operate in a non-blocking environment that shares CPU time with device firmware. Development must follow specific patterns to ensure reliability and prevent device crashes.

TypeScript Requirements

  • Always use TypeScript for all Shelly solution development
  • Use types from the shelly-forge library when available: node_modules/shelly-forge/types/**/*
  • Define custom types for all data structures and API responses

✅ Correct:

export type ThermostatState = "On" | "Off";
export interface Schedule {
  weekDays: boolean[];
  startTime: number;
  endTime: number;
  temperature: number;
}

❌ Incorrect:

// Using plain JavaScript without types
let state = "Off";
let schedule = {
  weekDays: [false, true, true, true, true, true, false],
  startTime: 6,
  endTime: 9,
  temperature: 39
};

Callback Functions

Due to limitations in the JavaScript engine, avoid deep nesting of anonymous functions as this can crash the device:

✅ Correct:

function processResponse(result: any, error_code: number, error_message: string) {
  if (error_code !== 0) {
    print("Error: " + error_message);
    return;
  }
  // Process result
}

Shelly.call("HTTP.GET", { url: "http://example.com/" }, processResponse);

❌ Incorrect:

Shelly.call(
  "HTTP.GET",
  { url: "http://example.com/" },
  function(result, error_code, error_message) {
    if (error_code !== 0) {
      print("Error: " + error_message);
      Shelly.call(
        "Switch.Set",
        { id: 0, on: false },
        function(res, err_code, err_msg) {
          // More nested callbacks - DANGEROUS!
        }
      );
    }
  }
);

State Management

  • Use the Storage/KVS API for persistent state storage
  • Create a typed interface around the Storage API for type safety
  • Implement the store as a singleton to ensure consistent access

Read the full file on GitHub · 208 lines

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. 4d ago First seen · 208 lines · 1,265 tokens per session scan A d2f251ea419a

Subscribe to this mod's changes

shelly-development-standards is a cursor rule published in the GitHub repository mslavov/shelly-forge (20 stars, last pushed 1y ago), licensed MIT. It adds 1,265 tokens to every session, about $0.0063 per session on Opus 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-09-01.