AI-Assisted Development
The Dale SDK is built with patterns that make it an excellent fit for AI-assisted coding — whether you use Claude Code, GitHub Copilot, Cursor, or any other AI coding tool.
Why Dale Works Well with AI Agents
Most IoT development involves boilerplate: declaring properties, wiring events, setting up timers, handling state. Dale's attribute-based design turns these into declarative patterns that AI agents can generate reliably.
A logic block is essentially a class with:
- Schema-side attributes that describe each value (
[ServiceProperty],[ServiceMeasuringPoint],[Timer],[ServiceProviderContractBinding]) - Presentation hints separated into a sibling attribute (
[Presentation]) — group, importance, format, custom widgets - A single entry point (
Ready()) for event wiring - Strongly-typed interfaces for inter-block communication
This is exactly the kind of structured, pattern-driven code that AI agents excel at generating.
The Dale CLI as the Agent's Interface
The Dale CLI gives AI agents a complete development feedback loop:
| Command | What the Agent Gets |
|---|---|
dale new MyProject | Scaffolded project with build, test, and DevHost setup |
dale build | Compile errors to fix |
dale test | Test failures to diagnose |
dale list --output json | Machine-readable project introspection |
dale add logicblock Thermostat | Code generation without writing boilerplate |
dale add serviceproperty Temperature --type double | Add a service property via command |
dale add timer Poll --interval 5 | Add a timer via command |
dale dev --headless | Boots the DevHost without a browser and prints a JSON readiness line for the agent to parse |
dale dev --stepped | Boots a deterministic virtual clock so scenario runs step exactly |
dale scenario run <id> | Drives a committed scenario and returns a structured report |
dale scenario validate | Resolves every name path and topology offline — the CI gate |
dale scenario scaffold <id> | Graduates a scenario to a typed xUnit test |
The --output json flag on every command means agents can parse results programmatically rather than scraping terminal output.
The Scenario Feedback Loop
The DevHost gives an agent a closed loop it can drive without a human in front of a browser. It boots the real wired network — the same messaging path that runs on the edge gateway — so it catches wired-path bugs that the TestKit's stubbed collaborators miss.
The loop has four moves:
- Boot a headless, deterministic DevHost with
dale dev --headless --stepped. The host prints a JSON readiness line on stdout ({"ready":true,"port":...}) that the agent parses to learn the port. - Drive a committed scenario with
dale scenario run <id>. This returns the same structured report the Player's copy button produces — pass or fail, with the failing step's detail. - Iterate on the failure detail until the report is green.
- Gate the work offline in CI with
dale scenario validate, which resolves every name path and topology against the wired-host configuration without a running host.
When a scenario outgrows the file format, dale scenario scaffold <id> graduates it to a typed xUnit test (it runs the scenario's setup and steps via ScenarioRunner.ApplyAsync and leaves TODO assertions for the human judgments).
Scenario files are authored in a JSON format. See Scenarios for the file grammar, step types, and the deterministic clock semantics.
What This Means in Practice
Instead of writing logic blocks line by line, you describe what you want:
"Create a logic block that reads temperature from a Modbus RTU device every 5 seconds, exposes it as a service property, and turns on a cooling relay when it exceeds 30°C"
An AI agent with access to the Dale CLI and SDK documentation can:
dale add logicblock TemperatureController- Add the Modbus and digital output contracts
- Implement the polling and control logic
- Write tests using the TestKit
dale buildanddale testto verifydale uploadto publish
This workflow turns natural-language requirements into deployed IoT logic without writing boilerplate by hand.
Agent-Ready by Default
When you scaffold a new project with dale new, the generated project includes tailored AGENTS.md and CLAUDE.md files. These files give AI agents immediate context about:
- All available CLI commands
- SDK conventions and attribute patterns
- Project structure (library, test, DevHost)
- Code style rules and common patterns
- Persistence behavior and property conventions
Any AI coding tool that supports agent instruction files (Claude Code, Cursor, Windsurf, etc.) will automatically pick up these conventions when opening the project.
Example Projects
The source-available Dale SDK repository includes complete example projects you can study or use as a starting point:
| Example | What It Demonstrates |
|---|---|
| PingPong | Inter-block communication with contracts, commands, and state updates |
| ToggleLight | Digital I/O with IDigitalInput and IDigitalOutput service provider contracts |
| Energy | Multi-block energy management with batteries, PV, and grid simulation |
| ModbusRtu | Reading Modbus RTU registers from an electricity meter (EM122) |
| Emission | Emission policy on service properties and measuring points — throttle, deadband, and dedup knobs for fast-moving telemetry |
| Presentation | Declarative presentation hints — groups, importance, units, and display formatting |
| RichTypes | Service properties over custom and structured value types |
These examples include tests, topology files, and committed scenarios — point an AI agent at one and ask it to explain, extend, or use it as a template.
Tool-Agnostic
This approach works with any AI coding tool that can run shell commands and edit files. The Dale CLI and SDK don't depend on any specific AI product — they provide the structure and feedback loop that any agent can use.
See Getting Started for setup instructions.