agentleFS
SmailGSmailG/plc-programming/skills/debug/SKILL.md

debug

Skill0 starsChanged 37 days agoMITView on GitHub

Diagnose misbehaving PLC programs and machines by conversation: a timer that never finishes, an output that flickers or will not switch, a stuck SFC step or state machine, wrong analog values, lost retain data after download, watchdog/cycle-time faults, Modbus or OPC UA values that are off by one or byte-swapped, intermittent faults. Guides evidence gathering (online values, watch/trace, diagnostic buffer), maps symptoms to known PLC failure patterns, and proposes minimal, safe fixes. Use whenever the user reports that PLC logic, a sequence, a device or PLC communication does not behave as expected, on any platform (Siemens, Schneider, CODESYS, TwinCAT, Rockwell, ABB).

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-discord, add-slack and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    add-discord

    Add Discord bot channel integration via Chat SDK.

    Also in 11 projects that use this

  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 11 projects that use this

  • +10 more from microsoft

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer observation (monitoring, trace) over intervention (forcing, online change).

    line 21
  2. Distinctive:

    Collect evidence before theorising: Ask for the relevant code, which is the POU that writes the misbehaving signal, not just the one that …

    line 28
  3. Very specific:

    Find every writer: Search the whole project for assignments to the signal: coils, :=, S/R, block outputs, HMI and OPC UA writes, forces.

    line 33
  4. Distinctive:

    Match against known patterns: Check references/failure-patterns.md, which is ordered by how often each pattern turns out to be the cause.

    line 36
  5. Distinctive:

    Close the loop: Ask for the result, and do not declare the problem fixed until the user reports it.

    line 50

“Common” is measured: kept by at least 6 in 10 of the 175 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debugging PLC programs

Safety first. The user may be looking at a live machine.

  • Never tell them to force outputs, bypass interlocks or download to a running process without first stating the consequence and asking whether it is safe (people, product, equipment).
  • Prefer observation (monitoring, trace) over intervention (forcing, online change).

Method

  1. Pin down the symptom. Get the expected behaviour and the actual behaviour, when it happens (always, intermittently, after a download, after a power cycle, in one mode only), what changed recently, and on which platform and firmware.
  2. Collect evidence before theorising. Ask for the relevant code, which is the POU that writes the misbehaving signal, not just the one that reads it. Also ask for online values at the moment of failure: a watch table, trace or logic-analyzer capture, the diagnostic buffer or alarm log, the task cycle time, and any forces that are active.
  3. Find every writer. Search the whole project for assignments to the signal: coils, :=, S/R, block outputs, HMI and OPC UA writes, forces. Several writers is the first suspect. Validator rules ST031 and LX040 help.
  4. Match against known patterns. Check references/failure-patterns.md, which is ordered by how often each pattern turns out to be the cause. Run python3 ${CLAUDE_PLUGIN_ROOT}/scripts/plc_validate.py <export> on any code the user shares. It catches several patterns mechanically: conditional timers, double OTE, = used as assignment, REAL equality.
  5. Form one hypothesis at a time, and ask for the observation that separates it from the others. Before accepting any check, ask what it would show if the hypothesis were false. If both answers look the same, the check proves nothing. For example, "the timer's ET stays at 0 while IN is TRUE" separates not called from preset too long.
  6. Fix minimally, following the develop skill's rules. State the deployment impact (online change or full download, instance re-initialisation, retain loss) and how to verify the fix: the exact values to watch and the expected result.
  7. Close the loop. Ask for the result, and do not declare the problem fixed until the user reports it.

Platform tools to ask for

PlatformEvidence
Siemens TIAwatch/force tables, S7-1500 trace, diagnostic buffer, call environment for monitoring multi-instances, GetError/GetErrorID, OB80/OB121 entries, PLCSIM
Schneider Machine Expert (M2xx)watch lists, trace, breakpoints (these stop only the debug task, and its I/O is not updated), PLC_R.i_wLastApplicationError / i_wLastStopCause / i_lwSystemFault_1, the device Log tab (/usr/Syslog), the web server's Diagnostics menu, simulation (no watchdogs, paid licence)
Schneider Control Expert (M340/M580)animation tables, watch points, breakpoints, the diagnostic viewer, %S/%SW (%S19 overrun, %S15/%S18/%S20 error flags, %SW125 last error, %SW30–%SW47 task times)
CODESYS / TwinCATwatch lists, trace/Scope, breakpoints and flow control, the device log, exception call stack
Rockwelltrend, cross-reference, controller fault log (major/minor faults), GSV fault info

See the platform skills for details (siemens, schneider, other-platforms).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.