Instalar en Claude Code
Copiargit clone --depth 1 https://github.com/industrial-aiops/industrial-aiops /tmp/iaiops-factory && cp -r /tmp/iaiops-factory/skills/iaiops-factory ~/.claude/skills/iaiops-factoryDespués abre una sesión nueva de Claude Code; el skill carga automáticamente.
Definición
SKILL.md
# iaiops-factory — 离散制造 edition(11 协议 + 脑)
启动:`IAIOPS_MCP=factory` / `iaiops-mcp-factory`。PLCnext vPLC 现场用精简
`IAIOPS_MCP=plcnext` / `iaiops-mcp-plcnext`(= opcua+modbus,走 vPLC 内建服务)。
单协议现场直接 `IAIOPS_MCP=<协议>`。EtherCAT 需 extra:`pip install iaiops[ethercat]`;
PROFINET:`pip install iaiops[profinet]`(或 `iaiops[factory]` bundle);Omron FINS 客户端为 in-repo 纯 stdlib 实现,无需第三方库。
## 工具
### OPC-UA(只读)
- `opcua_server_info` / `opcua_browse` / `opcua_read_node` / `opcua_read_many`
- `opcua_subscribe_sample` `opcua_read_alarms` `opcua_alarm_events`(A&C 带时间戳) `opcua_read_history`(HDA)
- `opcua_diagnose_connection` — 连接失败五类归因(证书/策略/认证/网络/配置)
- `opcua_discover_tags` — 自动发现 + 语义资产建模
- `opcua_health_summary` — tag vs 阈值分类;`opcua_anomaly_scan` — 有界统计异常扫描
### Modbus-TCP / Modbus-RTU(本 edition 只读)
- `modbus_read_holding`(FC03) `modbus_read_input`(FC04) `modbus_read_coils`(FC01)
`modbus_read_discrete`(FC02) — 带解码提示
- `modbus_detect_byte_order` — 自动探测寄存器块字节/字序
- `modbus_list_templates` / `modbus_apply_template` — 厂商寄存器模板 → 命名 tag
- `modbus_health_summary` — 寄存器 vs 阈值分类
### Siemens S7comm(pyS7)
- `s7_cpu_info` `s7_read_area` `s7_read_db` `s7_read_many`
- `s7_write_db` — **[WRITE][HIGH][MOC]** 写 DB 单值(默认 off)
### 三菱 MC(3E;Q/L/iQ)
- `mc_cpu_status` `mc_read_words` `mc_read_bits` `mc_read_many`
- `mc_write_words` — **[WRITE][HIGH][MOC]**(默认 off)
- CC-Link 经主站读(零 CC-Link 硬件,见 docs/CCLINK.md):`mc_cclink_templates`
`mc_cclink_link_read`(RX/RY/RWr/RWw 刷新映像,模板默认值 `待核实` per 项目)
`mc_cclink_network_health`(SB/SW 每站链路诊断:classic SW0080–;IE Field
SB0049 + SW00B0– + SW00A0– baton pass)
### Omron FINS(in-repo stdlib 客户端;CS/CJ/CP/NX-via-FINS)
- `fins_cpu_info`(0501 CPU 型号/版本) `fins_cpu_status`(0601 运行状态/模式/故障字)
- `fins_read_words`(0101; DM/CIO/W/H/A/EM, ≤500 字) `fins_read_bits`
`fins_read_many`(单会话批量, ≤20 项)
- `fins_write_words` — **[WRITE][HIGH][MOC]**(0102;默认 off)
### Allen-Bradley EtherNet/IP(pycomm3)
- `eip_controller_info` `eip_list_tags` `eip_read_tag` `eip_read_many`
- `eip_write_tag` — **[WRITE][HIGH][MOC]**(默认 off)
- **`plctype` 选驱动**(config key 或工具入参):`logix`(默认;ControlLogix/CompactLogix/
GuardLogix 符号 tag)、`slc`(PLC-5/SLC-500/MicroLogix PCCC 数据表:`N7:0` 整数、
`B3:0/0` 位、`F8:0` 浮点、`T4:0.ACC`/`C5:0.ACC`;`eip_list_tags` 改列数据文件目录)、
`micro800`(Micro820/850/870 符号变量,仅 IP)。真 PLC-5/SLC/MicroLogix/Micro800 待核实。
### EtherCAT(pysoem/SOEM;**Linux + root/CAP_NET_RAW + 专用网卡 + 真从站**)
- `ethercat_master_state` `ethercat_slaves` `ethercat_slave_info`
- `ethercat_read_sdo`(CoE SDO 上载) `ethercat_read_pdo`(输入过程映像单帧)
- `ethercat_write_sdo` / `ethercat_set_state` — **[WRITE][HIGH][MOC]**
(AL-state 切换可 START/STOP 运动;默认 off)
### PROFINET(DCP 发现,layer-2 raw socket;不碰 RT 循环数据)
- `profinet_discover`(IdentifyAll) `profinet_identify_station`
`profinet_station_params` `profinet_asset_inventory`
- `profinet_dcp_set` — **[WRITE][HIGH][MOC]** 重编址 name/IP(可断 IO 关系;默认 off)
### MTConnect(只读;CNC 机床 agent)
- `mtconnect_probe` `mtconnect_current` `mtconnect_sample` `mtconnect_assets`
- `mtconnect_oee_snapshot` — availability/execution/mode/program(OEE 输入)
### IO-Link(只读;主站 JSON 接口 — 传感器级可见性)
- `iolink_master_info` — 主站身份(/deviceinfo:productcode/serial/hw/sw)
- `iolink_ports` — 有界端口扫描(≤32:mode/status + 在线设备身份)
- `iolink_device_info` — 单端口设备身份(vendorid/deviceid/productname/serial/status)
- `iolink_read_pdin` — 过程数据输入(raw hex + 字节数组;按 IODD 解码)
- `iolink_read_isdu` — ISDU 参数读(iolreadacyclic,index/subindex 有界)
- `iolink_scan` — 主站 + 全端口一次性快照
- 配置 `flavor: iotcore`(ifm IoT-Core POST envelope,默认)或 `rest`
(plain-REST GET,Balluff/Turck 类);v1 只读,无写工具
### MQTT / Sparkplug B / UNS(含裸 MQTT)
- `mqtt_read_topic` `sparkplug_decode_payload` `sparkplug_subscribe_sample`
`sparkplug_node_list`
- `uns_browse` `uns_topic_audit` `uns_schema_drift` `uns_live_audit`
`sparkplug_live_schema` `uns_live_drift`
- `mqtt_publish` — **[WRITE][HIGH][MOC]**(默认 off)
### 离散制造专属(edition 工具;仅随 factory edition 加载,不进全局脑)
- `changeover_analysis` — **换型/SMED 时长**:换型 = 上个产品末件到下个产品首件的间隔(OEE 可用率
只汇总、不拆解)。从好件完成流按产品切换测每次换型,排最长、算均值/总换型时间,worst-first,
每时长引用两端时间戳。纯分析,喂 MES/PLC 好件计数。
### Gateway MES/SCADA 读层(edition 工具;厂商 SCADA/MES 平台 HTTP web API — **只读**)
厂商 SCADA/MES 平台的 **Gateway HTTP/web API** 暴露 MES 侧生产面(模块健康、tag 树、当前值、
活动告警、tag 历史)——这是基座 `opcua` connector 覆盖不到的部分。该平台**同时**跑一个 OPC-UA
server,但那已由 `opcua` connector 处理,本读层**不碰 OPC-UA**。全部**只读**(`risk=low`),
**无任何写工具**——是厂商官方 MCP 模块的受治理/只读补集(差异化在审计/预算/回滚 harness,不在写)。
- `ignition_gateway_status` — 网关/模块健康 + 可达性(Gateway doctor 步;`{gateway, modules[]}`)
- `ignition_tag_browse` — 按 provider/path 浏览 tag 树(`{name, path, type, has_children}`)
- `ignition_tag_read` — 单/多 tag 当前值/质量/时间戳(`{path, value, quality, timestamp}`)
- `ignition_alarm_status` — 活动/已确认告警列表(归一化)
- `ignition_tag_history` — 单 tag 时间窗历史(有界聚合样本 ≤5000)
- API token/key 从加密 secret store 按 key 名取,绝不内联;`flavor`(webdev/gateway:资源路径 +
字段别名)仅存在于连接器内;确切 API 版本/路径 + live gateway 待核实。
### 跨协议脑(永远随 server 暴露)
- 诊断:`diagnose_dataflow` `downtime_root_cause` `downtime_root_cause_live` `downtime_triage`
`learn_cause_weights` `rca_corpus_from_maintenance` `historian_health` `alarm_bad_actors` `tag_health`
`subscription_health` `heartbeat_health` `alarm_flood_analysis` `alarm_cascade`
`alarm_rationalization_worksheet`
- 数据质量:`data_quality_scorecard` `data_quality_fleet_rollup`
- 分析:`oee_compute` `downtime_events` `oee_multidim` `monitor_changes`
`health_summary` (deprecated) `anomaly_scan` (deprecated)
- 资产:`asset_inventory` `cross_protocol_asset_model` `adopt_alias_map` `diff_alias_map`
- 基线:`baseline_learn` `baseline_check` `baseline_record_change` `baseline_status`
(change-log 基线:拒学薄历史、只报持续越带、每次告警必引基线样本 —— 非黑盒异常检测)
- 合规/信创:`compliance_mapping` `compliance_frameworks` `compliance_dengbao_levels`
`compliance_report` `compliance_evidence_bundle`
`historian_push` `export_data` `historian_query` `historian_coverage` `stream_publish` `uns_publish` `stream_publish_event` `rca_narrate` `fleet_status` `fleet_incidents` `pdm_forecast`
- 程序解读:`plc_program_outline` `p