siemens
Skill0 starsChanged 37 days agoMITView on GitHub
Siemens SIMATIC PLC programming with TIA Portal (V20, V21) and SIMATIC AX: S7-1200/1500 (and legacy S7-300/400), OB/FB/FC/DB structure, optimized vs standard blocks, SCL/LAD/FBD/STL/GRAPH, SCL external sources (.scl/.db/.udt), SimaticML Openness/VCI XML (namespace versions per TIA version), SIMATIC SD (.s7dcl), instruction and data-type specifics (TON_TIME/IEC_TIMER, DTL, Variant), PROFINET/S7/OPC UA/Modbus communication, diagnostics, and Safety Integrated context. Use whenever the target is a Siemens PLC or TIA Portal, the code uses #local/"global" SCL syntax, or the file is a TIA export.
In this repository12 other files it gives its agents.
- convertSkill
- debugSkill
- developSkill
- exchange-formatsSkill
- iec-61131-3Skill
- iec-61499Skill
- new-pouSkill
- other-platformsSkill
- packml-isa88-opcuaSkill
- reviewSkill
- schneiderSkill
- validateSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Always ask for the exact TIA version and the CPU family, for example "S7-1500, V20 Upd 4".
- Very specific: line 49
Prefer multi-instances in the FB's static area: tonX : TON_TIME;, called as #tonX(IN := …, PT := …);.
- Very specific: line 51
Call them every cycle and gate IN (validator rules ST030–ST033 understand #inst( and #inst.TON().
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Siemens TIA Portal / SIMATIC S7
Versions (as of 2026-09)
- TIA Portal V21 was announced on 2025-11-11. V20 had reached Update 5 by 03/2026.
- SIMATIC SD (
.s7dcl/.s7res) is the new Git-friendly text format:- LAD, UDT and DB from V20 Update 3.
- SCL, FBD, F-FBD, F-DB and mixed blocks from V20 Update 4.
- V21 extends it further.
- It does not support STL.
- SIMATIC AX is a VS Code-based ST toolchain with apax, OOP and unit tests. It is "Early Access for selected productive use cases". AX ST is not SCL.
Always ask for the exact TIA version and the CPU family, for example "S7-1500, V20 Upd 4". Formats, namespaces and the available instructions all depend on them.
Choosing the deliverable
| User wants | Deliver |
| SCL code to paste or import | an external source .scl, imported via External source files → Generate blocks from source. Template: assets/FB_Conveyor.scl |
| a Git round-trip of LAD/FBD/SCL (V20 Update 4 or later) | SIMATIC SD |
| automated generation of LAD/FBD blocks or tag tables | SimaticML, matching the namespace to the TIA version. Template: assets/FC_LadDemo_V18.xml |
| STL (AWL) | SimaticML or an .awl source; SD cannot carry it |
Full format detail, the namespace-version table and the SCL-vs-IEC differences are in references/simaticml-and-sources.md.
SCL rules you must follow
- Locals and globals:
- Inside code, locals take
#(#start). Declarations do not. - Global symbols are double-quoted:
"DB_Line".speed,"FC_Scale"(…).
- Inside code, locals take
- Structure: code follows
BEGIN. Blocks end withEND_FUNCTION_BLOCK,END_FUNCTION,END_DATA_BLOCKorEND_TYPE.REGION … END_REGIONgroups code. - Timers:
- Prefer multi-instances in the FB's static area:
tonX : TON_TIME;, called as#tonX(IN := …, PT := …);. AnIEC_TIMERvariable is called as#t.TON(…). - Call them every cycle and gate
IN(validator rules ST030–ST033 understand#inst(and#inst.TON().
- Prefer multi-instances in the FB's static area:
- Optimized access (
{ S7_Optimized_Access := 'TRUE' }) is the default on S7-1200 and S7-1500. Do not rely on absolute offsets into optimized DBs. - Enums: classic S7 has no IEC enums. Use named constants (a local or global
constant) or an
Intstate with documented values.
Traps that cost the most on site
- An FB interface change re-initialises its instance DBs on download. Setpoints and counters go back to their start values. Plan for download without reinitialization (memory reserve), or, on V21 with S7-1500 FW 4.1, "Keep actual values". Otherwise back up actual values first.
- Array index out of range: the S7-1500 goes to STOP unless OB121 or local
GET_ERRORhandles it, while the S7-1200 stays in RUN. ENO is not cleared, so check indices explicitly. - Cycle overrun: OB80 is called. The CPU stops if OB80 is missing, or on a second overrun in the same cycle.
- Temps: in standard blocks they are undefined until written. Write before you read.
- In SCL, "Set ENO automatically" is off by default. Programming and I/O access errors never reach ENO.
- Forces survive going offline, and only peripheral I/O can be forced.
- Modbus TCP server: register 0 is the first word of
MB_HOLD_REG, which clients call 40001. Each connection needs its own instance DB and ID. - PUT/GET has to be explicitly permitted, and it has no security of its own.
- Safety programs are F-LAD/F-FBD only, with no REAL. Never present generated F-code as validated.
References
- references/platform-and-structure.md: versions, controller families and languages, the OB table, optimized vs standard access, parameter passing, references and arrays, and download impact.
- references/scl-and-data-types.md: SCL syntax beyond IEC, external-source rules, DTL/S5TIME/ANY/VARIANT/HW types, and timers.
- references/simaticml-and-sources.md: the
.scl/ SD / SimaticML / AX formats and the namespace table. - references/style-guide.md: style-guide rule IDs (ES, NF,
SE, DA, PE…), naming, and the
statusWORD convention. Paraphrased, for licence reasons. - references/communication.md: PROFINET, PUT/GET and
S7comm-plus, OUC/
TCON_IP_v4, Modbus TCP/RTU, the OPC UA server and client with licences, and data consistency. - references/diagnostics-safety-motion.md:
monitoring, force, trace and the diagnostic buffer,
GET_ERR_ID, the S7 review checklist, Safety Integrated,MC_*, and PID.
Validate
Run python3 ${CLAUDE_PLUGIN_ROOT}/scripts/plc_validate.py <file>.
| File | Rules |
.scl / .st | ST0xx |
SimaticML .xml | SM0xx: namespace vs TIA version, hex ID, per-network UId, wires, sections |
.s7dcl | SD0xx: NETWORK/RUNG nesting only |
None of these is a TIA compile. Tell the user to compile in TIA and to fix what it reports.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

