PID to Knowledge Graph skill

A Claude Code skill that reads P&ID drawings from PDF and builds a process graph of flows, instruments and control loops.

  • 256 ★ on the repository
  • Last commit
  • MIT
Skill

Extended access

Why this level

  • The skill installs Python packages and runs scripts, so Claude Code asks permission for commands.
All reasons and checks

scottduncanai/pid-to-knowledge-graph

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add skills/pid-to-knowledge-graph

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The skill installs Python packages and runs scripts, so Claude Code asks permission for commands.

This is third-party code. Review the repository files before installing.

What it does

The `pid-to-kg` skill takes a PDF of P&IDs or PFDs, digital or scanned, and builds a knowledge graph of the process. The graph has three layers: flow (what is upstream and downstream of every tank, pump, valve and pipe segment), measurement (which instrument measures which variable and where it sits) and control (loops from sensor through controller to final element, including cascades, interlocks and VFD drives). Claude reads the drawings, recognizing symbols and tracing lines. Python scripts prepare pages, build the graph and check it. Each sheet is cut into overlapping tiles and tags are cross-checked against the PDF text or OCR. Every item gets a confidence level, and anything unreadable is marked rather than guessed. The result goes to `work/<plant name>/kg/`: `summary.md` with a plant overview for an LLM, `graph.json` with the full graph and `qa_report.md` listing doubtful items. After that the drawings can be queried: what feeds the clarifier, or which transmitters sit downstream of P-101.

Who it is for. Process and automation engineers at chemical plants who want to query a P&ID set instead of paging through hundreds of sheets.

Good fit when

  • The plant drawing archive has to become a context layer for an LLM application.
  • You need to find quickly which equipment sits upstream of the clarifier.
  • You want to know which valve the FIC-0502 controller moves and by which signal.
  • A scan of an old P&ID has to become a checkable structure with uncertain spots flagged.

Not a fit when

  • The drawings are not PDFs: the skill reads PDF only.
  • The result must be used without manual review: recognition confidence on complex sheets is limited.
  • The question concerns a 3D plant model rather than 2D diagrams.

Example request

Convert haile.pdf into a knowledge graph. The P&IDs are on pages 47–60.

Limitations

Claude Code (desktop app or terminal) and Python 3.10 or newer are required. On Python 3.13 and later the skill works, but without the OCR cross-check of tags and automatic page orientation, and 3.12 is the best choice. On first run Claude installs the needed Python packages and asks permission for commands. Large drawing sets take a long time because every sheet is read in detail. Mismatches are flagged in `qa_report.md` and are worth checking against the drawing. The license is MIT, the last commit dates from November 2026.

How to disable. Delete the `pid-to-kg` folder from `~/.claude/skills/` and restart Claude Code. Generated graphs sit in the project `work/` folder and are deleted separately.

FAQ

How do I install the skill?

Download the repository as a ZIP, copy `skills/pid-to-kg` into `~/.claude/skills/` (on Windows `C:\Users\<name>\.claude\skills\`) and open the project folder with the PDF in Claude Code.

Do I have to name the skill in the prompt?

No, the skill loads by itself: ask to convert the P&ID PDF into a knowledge graph and give the page numbers.

Where is the result stored?

In `work/<plant name>/kg/` inside the project folder: `summary.md` overview, `graph.json` graph and `qa_report.md` with doubtful items.

Does the skill handle scans?

Yes, scans are taken at original resolution, enlarged up to 2.5 times with boosted contrast, and tags are cross-checked through OCR.

What questions can I ask about the graph?

What feeds the clarifier, which transmitters sit downstream of P-101, and what FIC-0502 controls and through which valve.

Discussion

No questions or reviews yet.

Skills

SciPilot Figure

scipilot-figure-skill

A scientific visualization advisor skill: it profiles the data and picks a chart for the argument first, then renders it to journal-grade quality

SkillExtended access2.8KRepository stars

Skills for power-system studies: how to work with pandapower, OpenDSS, PSS/E and PowerWorld, plus playbooks for fixing violations.

PluginMinimal access80Repository stars

A skill that picks a scientific chart from nearly 100 templates for CSV or Excel data and outputs PNG, SVG, PDF and Python code.

SkillExtended access298Repository stars

myKG builds a confidence scored knowledge graph from mixed documents and serves it to an agent through MCP or a Claude Code skill.

CLIExtended access85Repository stars

A skill that builds scientific figures from a table: it offers 2–3 chart candidates, assembles panels and checks image reuse.

SkillExtended access84Repository stars

A skill that turns a one-line brief into a live 3D factory model with a discrete event simulation, throughput and bottleneck.

SkillExtended access51Repository stars

README in short

A Claude Code skill for PDFs of P&IDs and PFDs: pages are cut into tiles, Claude reads the symbols, and scripts assemble the graph and a report of doubtful items.

README badge

Report a problem