iec61131 — Claude Code skill: PLC languages and installation
A reference for IEC 61131-3 languages, PLC data types, and program structure. Use it when comparing control-language options or checking project exchange formats.
MIT 154 installs ★ 50 updated 2026-10-23
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a claude-codeWhat iec61131 does
The skill covers LD, FBD, ST, IL, and SFC, along with PROGRAM, FUNCTION_BLOCK, and FUNCTION units, variable scopes, and data types. It gives an agent reference material for discussing PLC code and how its parts are organized. IL is marked deprecated in the 2013 third edition.
PLCopen sections cover standards including motion control and XML exchange. The reference also maps exchange formats to platforms: CODESYS, Schneider, and Beckhoff support PLCopen XML, while Siemens uses SimaticML. That distinction matters when moving a project between environments; Siemens does not support PLCopen XML.
What it helps with
- choose an IEC 61131-3 language for control logic
- distinguish stateful function blocks from stateless functions
- identify variable scopes within a POU
- check which platforms support PLCopen XML
- compare exchange formats used by automation environments
Example prompts for the agent
- Explain when to use ST, LD, or SFC for a control task.
- Compare FUNCTION_BLOCK and FUNCTION, including how they handle state.
- Check whether PLCopen XML can exchange a project between CODESYS and Siemens.
How to install iec61131
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a claude-code2Manually: put the files in place
~/.claude/skills/iec61131/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/iec61131/
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a codex2Manually: put the files in place
.agents/skills/iec61131/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a cursor2Manually: put the files in place
.cursor/skills/iec61131/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install claude-dev-suite/claude-dev-suite skills/industrial/iec611312Manually: put the files in place
.github/skills/iec61131/SKILL.md1Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a gemini-cli2Platform CLI
gemini skills install https://github.com/claude-dev-suite/claude-dev-suite --path skills/industrial/iec61131Manually: put the files in place
.devin/skills/iec61131/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about iec61131
How do I install iec61131 in Claude Code?
Run npx skills add claude-dev-suite/claude-dev-suite --skill iec61131 -a claude-code. The skill file is placed at ~/.claude/skills/iec61131/SKILL.md.
What does iec61131 do?
It gives the agent reference material on IEC 61131-3 languages, program organization units, data types, and PLCopen standards. It also describes project exchange formats and platform support.
Which platforms support PLCopen XML?
The reference lists CODESYS, ABB AC500, Schneider, Beckhoff, and B&R. Siemens uses SimaticML and does not support PLCopen XML.
Source text
SKILL.md · MIT
---
name: iec61131
description: IEC 61131-3 programming languages reference (LD, FBD, ST, IL, SFC), PLCopen standards, program organization units, data types. Use when discussing PLC programming standards or cross-platform compatibility.
user-invocable: false
---
# IEC 61131-3 Programming Languages Reference
## Overview
IEC 61131-3 defines 5 programming languages for PLCs, all interchangeable:
| Language | Type | Best For | Status |
|----------|------|----------|--------|
| LD (Ladder Diagram) | Graphical | Discrete logic, motor interlocks | Active |
| FBD (Function Block Diagram) | Graphical | Continuous control, PID, analog | Active (DCS primary) |
| ST (Structured Text) | Textual | Complex calculations, algorithms | Active (most expressive) |
| IL (Instruction List) | Textual | Low-level, assembly-like | Deprecated (3rd ed. 2013) |
| SFC (Sequential Function Chart) | Graphical | Sequences, batch, state machines | Active |
## Program Organization Units (POUs)
### PROGRAM
Top-level executable, associated with a task (scan cycle).
### FUNCTION_BLOCK (FB)
Reusable block with **persistent internal state** (memory between calls). Used for motors, PID, timers, counters.
```
FUNCTION_BLOCK MotorControl
VAR_INPUT
StartCmd : BOOL;
StopCmd : BOOL;
FbkRun : BOOL;
Interlock: BOOL;
END_VAR
VAR_OUTPUT
StartOut : BOOL;
Running : BOOL;
Fault : BOOL;
END_VAR
VAR
MonTimer : TON;
State : INT;
END_VAR
```
### FUNCTION (FC)
Stateless, no memory. Always returns same output for same input.
## Data Types
### Elementary
BOOL, BYTE, WORD, DWORD, LWORD, SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT, REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME, STRING, WSTRING
### Derived (User-Defined)
```
TYPE MotorData :
STRUCT
Running : BOOL;
Fault : BOOL;
Speed : REAL;
Runtime : TIME;
END_STRUCT
END_TYPE
```
## Variable Scopes
| Scope | Keyword | Description |
|-------|---------|-------------|
| Local | VAR | Internal to POU |
| Input | VAR_INPUT | Read-only input parameter |
| Output | VAR_OUTPUT | Output parameter |
| In/Out | VAR_IN_OUT | Bidirectional parameter |
| Global | VAR_GLOBAL | Accessible by all POUs |
| External | VAR_EXTERNAL | Reference to global |
| Temp | VAR_TEMP | No persistence |
| Config | VAR_CONFIG | Set at download |
| Constant | CONSTANT | Named constant |
## Language Details
### ST (Structured Text) - Most Relevant for Code Generation
```
IF Motor.FbkRunning AND NOT Motor.Fault THEN
Motor.Status := RUNNING;
Motor.Runtime := Motor.Runtime + T#1s;
ELSIF Motor.Fault THEN
Motor.Status := FAULTED;
Motor.AlarmActive := TRUE;
END_IF;
CASE State OF
0: (* IDLE *)
IF StartCmd AND NOT Interlock THEN State := 1; END_IF;
1: (* STARTING *)
StartOut := TRUE;
MonTimer(IN:=TRUE, PT:=T#10s);
IF FbkRun THEN State := 2; END_IF;
IF MonTimer.Q THEN State := 99; END_IF;
2: (* RUNNING *)
IF StopCmd THEN State := 3; END_IF;
3: (* STOPPING *)
StartOut := FALSE;
99: (* FAULT *)
StartOut := FALSE;
Fault := TRUE;
END_CASE;
```
### SFC (Sequential Function Chart)
Elements: Steps, Transitions, Actions
- Steps contain actions (in any language)
- Transitions are boolean conditions
- Action qualifiers: N (non-stored), S (set), R (reset), L (time limited), D (delayed), P (pulse)
- Parallel branches (simultaneous), Alternative branches (selective)
### FBD (Function Block Diagram)
Signal flow left-to-right. Blocks represent functions. Wires connect outputs to inputs. Primary language in DCS (PCS 7 CFC, DeltaV Control Studio, ABB Freelance).
### LD (Ladder Diagram)
Based on relay logic. Contacts (NO/NC), coils, timers, counters. Left/right power rails. Rungs top-to-bottom.
## PLCopen Standards
| TC | Topic | Description |
|----|-------|-------------|
| TC1 | Standards | IEC 61131-3 compliance testing |
| TC2 | Motion Control | MC_MoveAbsolute, MC_Stop, MC_Home, etc. |
| TC3 | Software Engineering | Coding guidelines |
| TC4 | Communications | OPC UA mapping |
| TC5 | Safety | IEC 61508 extensions |
| TC6 | XML Exchange | Vendor-neutral program interchange format |
## PLCopen XML Format (TC6)
```xml
<project xmlns="http://www.plcopen.org/xml/tc6_0201">
<types>
<pous>
<pou name="MotorControl" pouType="functionBlock">
<interface>
<inputVars>
<variable name="Start"><type><BOOL/></type></variable>
</inputVars>
<outputVars>
<variable name="Running"><type><BOOL/></type></variable>
</outputVars>
</interface>
<body>
<ST><xhtml><!-- Structured Text --></xhtml></ST>
</body>
</pou>
</pous>
</types>
</project>
```
Supported by: CODESYS, ABB AC500, Schneider, Beckhoff, B&R.
NOT supported by: ABB Freelance (uses PRT), Emerson DeltaV (uses FHX), Siemens (uses SimaticML).
## Other Exchange Formats
| Format | Standard | Used By |
|--------|----------|---------|
| PLCopen XML | IEC 61131-10 | CODESYS, Schneider, Beckhoff |
| SimaticML | Siemens proprietary | TIA Portal |
| AutomationML | IEC 62714 | Siemens PCS 7 V9+, multi-vendor |
| FHX | Emerson proprietary | DeltaV |
| PRT/CSV | ABB proprietary | Freelance |
| DEXPI | ISO 15926 | P&ID exchange |
© claude-dev-suite · MIT · claude-dev-suite/claude-dev-suite