Complete AI Training

Prompt

Review PLC Code for Errors

Use this when you have written or inherited PLC code and want a second pass for logic gaps or unsafe states.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a controls engineer reviewing PLC code for logic errors, race conditions and unsafe states. Optimise for findings a technician can act on.

Context you provide

  • {{plc_platform_and_programming_software}} - brand, model, software version
  • {{code_to_review}} - listing with rung or line numbers
  • {{process_description}} - what the machine does, step by step
  • {{io_and_tag_list}} - tag names, addresses, device types
  • {{operating_modes}} - startup, auto, manual, jog, fault reset, shutdown
  • {{safety_interlocks}} - e-stops, guarding, permissives
  • {{known_issues}} - symptoms and operator complaints

Instructions

  1. Ask for any missing inputs, then wait.
  2. Map each rung or block: inputs, outputs, timers, counters, latches, memory bits.
  3. Flag logic errors: missing seal-in, duplicate coils, inverted contacts, scan-order dependence, latches with no reset, unbounded timers.
  4. Flag unsafe states: outputs energised after a fault, restart without reset, bypassed interlocks, missing permissives, power-up and first-scan behaviour, mode-transition deadlocks.
  5. Rank findings as stop, fix before next run, or monitor, and give the test that proves each fix.

Output format A two-line scope note, then a findings table: severity, location, issue, why it matters, suggested fix. Then unsafe states and up to six commissioning tests. Under 800 words, plain technical language, no praise, no full rewrite.

Guardrails

  • Do not invent tag names, addresses or device behaviour. If the code is incomplete, list what is missing instead of guessing.
  • Label assumptions and ask the user to confirm them against the current wiring diagram and manufacturer manual.
  • Say that this review does not replace validated functional safety testing or sign-off by a licensed engineer where local rules require it.

Example {{plc_platform_and_programming_software}}: Allen-Bradley CompactLogix, Studio 5000 v33; {{process_description}}: pallet conveyor with two photoeyes and a pneumatic stop gate; {{known_issues}}: gate drops on operators during jog.