Skip to content

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:

CommandWhat the Agent Gets
dale new MyProjectScaffolded project with build, test, and DevHost setup
dale buildCompile errors to fix
dale testTest failures to diagnose
dale list --output jsonMachine-readable project introspection
dale add logicblock ThermostatCode generation without writing boilerplate
dale add serviceproperty Temperature --type doubleAdd a service property via command
dale add timer Poll --interval 5Add a timer via command
dale dev --headlessBoots the DevHost without a browser and prints a JSON readiness line for the agent to parse
dale dev --steppedBoots a deterministic virtual clock so scenario runs step exactly
dale scenario run <id>Drives a committed scenario and returns a structured report
dale scenario validateResolves 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:

  1. 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.
  2. 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.
  3. Iterate on the failure detail until the report is green.
  4. 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:

  1. dale add logicblock TemperatureController
  2. Add the Modbus and digital output contracts
  3. Implement the polling and control logic
  4. Write tests using the TestKit
  5. dale build and dale test to verify
  6. dale upload to 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:

ExampleWhat It Demonstrates
PingPongInter-block communication with contracts, commands, and state updates
ToggleLightDigital I/O with IDigitalInput and IDigitalOutput service provider contracts
EnergyMulti-block energy management with batteries, PV, and grid simulation
ModbusRtuReading Modbus RTU registers from an electricity meter (EM122)
EmissionEmission policy on service properties and measuring points — throttle, deadband, and dedup knobs for fast-moving telemetry
PresentationDeclarative presentation hints — groups, importance, units, and display formatting
RichTypesService 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.