TypeScript for Shelly devices
Shelly scripts.
Built with
your agent.
Describe what your home should do. Your coding agent writes the script, tests it locally, and checks it before you approve deployment.
See the workflowGive your agent the skills.
Run in your workspace. Choose your coding agent when prompted.
npx skills add mslavov/shelly-forge --skill shelly-forge shelly-scripting
Node.js 22.20+ for the skills installer.
Workspace install by default. Add --global for all projects.
02 / Your coding agent
Tell it what you
want to automate.
You bring the requirements. The skills give your agent the CLI workflow and the device rules. It handles setup and implementation.
Use the shelly-forge and shelly-scripting skills to create a project called my-home. Add a hallway lighting script and simulator tests. Ask me how the automation should behave, then install dependencies, implement it, run the tests and type checks, and check the device artifact. Use the local emulator if needed. Stop before changing a real device and ask me to confirm the target and deployment.
01Install the skills before creating a project. Open your agent in the same workspace. Restart its session if it does not discover them.
02Keep passwords in your local .env, not in chat. Your agent should ask before any real-device change.
Prefer the terminal? Forge works without an agent. Follow the direct CLI setup
Local first
Test without
the hardware.
The simulator runs your TypeScript with device APIs and a virtual clock. Advance timers, inject events, and inspect KVS values without a device on your desk.
Script behavior
Use shelly-forge/testing in Vitest for timers, MQTT, HTTP, BLE, and failure cases.
A local device server
Run npx shelly-forge emulate. Deploy and debug through real HTTP RPC and WebSocket logs on loopback.
import { fileURLToPath } from 'node:url';
import { expect, test } from 'vitest';
import { createShellyRuntime }
from 'shelly-forge/testing';
test('the starter saves its counter', async () => {
const runtime = createShellyRuntime();
const script = fileURLToPath(
new URL('./hello.ts', import.meta.url)
);
await runtime.loadScript(script, {
env: { SHELLY_PUBLIC_GREETING: '' }
});
runtime.advance(60000);
expect(runtime.kvs.get('example.hello.count'))
.toBe('1');
});
Local tests do not reproduce device memory, CPU, or every firmware behavior. The emulator runs trusted code in Node vm, not a security boundary. Verify on your intended hardware too.
03 / With your approval
Checked code.
Confirmed target.
Shelly's interpreter is not Node.js. Forge checks for unsupported APIs and device limits, then verifies startup after upload.
- 01 / Write
TypeScript
Device-specific types and bundled local imports.
src/lighting/hallway.ts - 02 / Check
ES5 artifact
Type checks, runtime rules, and a 65535-byte size limit.
check lighting/hallway - 03 / Deploy
One selected script
Upload, configure, and start on the device you approved.
deploy lighting/hallway - 04 / Verify
Startup status
A health window checks for errors. Failed verification attempts rollback when a different last-good artifact exists.
status lighting/hallway
Keep going
The details,
when you need them.
Forge requires Node.js 22.12+ and a Shelly device with scripting support. Use local tests before connecting hardware.
Install the skills