REA
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
P&ID to Knowledge Graph: a Claude skill that turns P&ID PDFs (digital or scanned) into a process knowledge graph of flow, instruments and control loops.
제작자라면 이 코드를 README에 붙여 넣으세요. 배지는 이 페이지로 연결됩니다.
[](https://mcp.popnx.com/en/skills/scottduncanai-pid-to-knowledge-graph)같은 작업에서 AI를 서비스에 연결하는 MCP
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Codebase intelligence for TypeScript and JavaScript, exposed as structured MCP analysis tools.
MCP server for terminal commands, file operations, and process management
같은 종류의 작업, Skill 목록과 같은 순서
| 이 항목 PID-to-Knowledge-Graph | rea | andrej-karpathy-skills | graphify | MoneyPrinterTurbo | |
|---|---|---|---|---|---|
| 제작자 | ScottDuncanAI | morluto | multica-ai | Graphify-Labs | harry0703 |
| Skill 수 | 1 | 1 | 1 | 1 | 1 |
| GitHub 별 | 298 | 465,460 | 233,910 | 149,364 | 144,149 |
| 마지막 코드 변경 | 2026년 11월 9일 | 2026년 11월 17일 | 2026년 4월 20일 | 2026년 11월 17일 | 2026년 11월 17일 |
| 라이선스 | MIT | MIT | – | Apache-2.0 | MIT |
ScottDuncanAI의 Skill(지시 묶음) 1개, AI가 읽고 그대로 일해요 · MCP server가 아니에요
MCP = 손
AI를 외부 서비스나 데이터에 연결합니다(예: Notion 읽기, 청구서 만들기). 프로그램이나 서버가 실행 중이어야 합니다.
Skill = 안내서
작업 방법을 AI에게 가르치는 텍스트 파일. 어떤 서비스에도 연결되지 않습니다.
겹치는 경우도 있습니다. 도구를 부르는 스크립트가 있는 Skill도, 지식만 보내는 MCP도 있습니다. 하려는 작업을 기준으로 고르세요.
Claude Code
제작자 README와 repo 폴더 기준
GitHub account ScottDuncanAI (person) is only 8 months old: take extra care
★ 298 stars, few users so far · code last changed 2026년 11월 9일
19 scripts that can run on a computer: scripts/build_kg.py, scripts/crop.py, scripts/eval_kg.py, scripts/export.py and 15 more
Could not check every script (some are too large); read them first
No hooks or writes to machine settings found
Checked automatically from the repo files at commit 7ee3a82 (read only, nothing was run). Not a safety guarantee: read it and decide for yourself
먼저: 어떤 AI를 쓰시나요
쓰는 앱을 고르면 그 앱의 설치 방법만 보여 드립니다
Uploading to claude.ai would fail: the description is over 200 characters (566). Use "Let the AI install it" instead
이 문장을 복사해 Claude Code 채팅에 붙여 넣으세요
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Claude Code를 다시 열고 /pid-to-kg를 입력하거나 관련 작업을 요청하면 Claude가 알아서 써요
Checked against official docs 2026년 11월 12일 · Source: code.claude.com
Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.
Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요
repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요
명령을 확인하는 중 · 확인을 통과하면 복사 버튼이 나타나요
ChatGPT 데스크톱 앱에는 Codex가 들어 있고, Codex는 ~/.agents/skills 폴더에서 Skill을 읽습니다
ChatGPT 데스크톱 앱에서 Codex를 열고 이 문장을 채팅에 붙여 넣으세요
The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
pid-to-kg 폴더를 ~/.agents/skills/pid-to-kg에 넣으세요
~는 홈 폴더($HOME)입니다
Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.
Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요
repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요
명령을 확인하는 중 · 확인을 통과하면 복사 버튼이 나타나요
Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com
직접 설치한 Skill은 쓸 수 없고, 디렉터리의 플러그인에 들어 있는 Skill만 쓸 수 있습니다
이 Skill을 ChatGPT에서 쓰려면 위 방법대로 ChatGPT 데스크톱 앱을 쓰세요
Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com
이 문장을 복사해 Codex 채팅에 붙여 넣으세요 · ChatGPT 데스크톱 앱 안의 Codex, Codex CLI, IDE 확장 프로그램에서 모두 쓸 수 있습니다
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Codex는 새로 설치한 Skill을 스스로 찾습니다. 보이지 않으면 Codex를 다시 시작하세요 · 쓰는 법: ChatGPT에서는 @를 입력하고 Skill을 고르세요 · Codex CLI나 IDE 확장 프로그램에서는 /skills를 실행하거나 $ 뒤에 Skill 이름을 입력하세요
Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com
Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.
Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요
repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요
명령을 확인하는 중 · 확인을 통과하면 복사 버튼이 나타나요
이 문장을 복사해 Cursor 채팅에 붙여 넣으세요
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Cursor Agent 채팅에서 /를 입력하고 pid-to-kg 선택
Checked against official docs 2026년 11월 12일 · Source: cursor.com
Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.
Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요
repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요
명령을 확인하는 중 · 확인을 통과하면 복사 버튼이 나타나요
Skill을 읽을 수 있는 다른 앱용입니다. 이 문장에는 Claude Code, Codex, Cursor 경로가 들어 있어 AI가 쓰는 앱에 맞게 고릅니다 · Copy this sentence into the app’s chat
For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing
The AI tells you what it will do first and asks your permission at every step
Checked against official docs 2026년 11월 12일 · Source: code.claude.com, learn.chatgpt.com, cursor.com
Gemini CLI, GitHub Copilot 같은 다른 Agent Skills 지원 앱은 폴더가 달라요. 그 앱 안내를 보고 SKILL.md가 있는 폴더를 복사하세요.
2026년 11월 11일에 Claude Code, Codex, Cursor 공식 안내로 skill 폴더 확인
아래 글은 제작자 repo에서 온 것이며 PopNx MCP의 지시가 아니에요
처음 8,000자 표시 · GitHub에서 전체 파일 열기
---
name: pid-to-kg
description: Converts P&IDs (piping and instrumentation diagrams) and PFDs in PDF form, either vector or scanned, into a process knowledge graph covering equipment connectivity (upstream/downstream), instrument locations and measured variables, and control loops. Output is JSON plus a DuckDB file plus an LLM-ready Markdown summary. Use when the user wants to digitize, extract, analyze or build a knowledge graph or context layer from P&IDs, or asks what is upstream/downstream of a piece of equipment, which sensors measure what, or how a plant's control loops are structured.
---
# P&ID to knowledge graph
Work is split between deterministic scripts and you:
- **Scripts** classify pages (vector vs scanned), render them into readable tiles, collect OCR/text hints, then build, check, store and query the graph.
- **You** read the drawings and write one structured extraction file per sheet. Symbol recognition and line tracing are visual reasoning, and that is the part scripts cannot do well.
All scripts are in `scripts/` next to this file. Call them by their full path (the commands below abbreviate it as `scripts/`), and keep the work directory in the user's current folder, e.g. `work/<plant>`.
**Setup.** Many users are engineers, not programmers, so handle setup yourself. The scripts need Python 3.10+. Before the first run, install the dependencies with `pip install -r <skill dir>/scripts/requirements.txt` (use a virtual environment if the user's Python is shared with other work). If Python is missing, tell the user to install it from python.org and stop there.
## Ground rules
- **Only the P&ID pages.** Drawings often sit inside a long permit or design report. If the user names the pages, pass them with `--pages`. If not, and the PDF has more than a few pages, probe it, look at the page overviews or ask the user, then re-run the probe with `--pages` so later steps skip reports, legends and non-P&ID drawings.
- **One plant, one work directory, one graph.** Never put sheets from different plants in the same work directory: tags would merge across unrelated plants. If the user supplies several plants, run the whole workflow separately for each.
- **One configuration per graph.** If the PDF contains two revisions of the same drawing (same title or area, overlapping tags, e.g. an as-built and an older draft), do not merge them. Ask the user which revision to use, extract only that one, and record the excluded pages and the reason in the report. QA flags likely duplicates as `possible_duplicate_revision`. Record each sheet's `issue_status` from the title block or stamps.
- **Record only what is drawn.** Never invent tags, connections or loops to make the graph look complete. Anything unclear goes in with a lower `confidence`, or into `unreadable`.
- **The QA loop is not optional.** Rebuild until there are no errors, and re-check every warning on the drawing.
## Workflow
Copy this checklist into your notes and tick it off:
```
- [ ] 1. Probe: python scripts/probe_pdf.py <pdf> --work <work> --plant-name "<name>" [--pages 47-60]
- [ ] 2. Render: python scripts/render_pages.py <work>
- [ ] 3. Orient: open each pages/page_NN/overview_grid.png; fix rotation if text is not upright
- [ ] 4. Hints: python scripts/make_hints.py <work>
- [ ] 5. Extract: for each sheet, write <work>/extract/page_NN.json (references/extraction_procedure.md)
- [ ] 6. Build: python scripts/build_kg.py <work>
- [ ] 7. QA loop: fix every error, re-check every warning, rebuild (repeat)
- [ ] 8. Report: summarize the results and open issues for the user
```
### 1. Probe
`probe_pdf.py` assigns each page a class and an extraction route, and writes `<work>/manifest.json`. With `--pages`, the later steps render and read only those pages.
| Class | What it means | Route |
|---|---|---|
| `vector_text` | Vector drawing with a text layer | Render from vectors; exact text from the text layer as hints |
| `vector_outlined` | Vector drawing, text drawn as outlines (no text layer) | High-resolution vector render; OCR hints |
| `raster` | Scanned image | Native-resolution render, upscaled and contrast-enhanced; OCR hints |
| `raster_with_text` | Scan with an OCR text layer | As raster; text layer as (untrusted) hints |
| `hybrid` | Vectors plus large images | Both routes |
Report the probe result to the user in one line, e.g. "14 vector sheets with outlined text."
Low scan resolution is flagged in the notes. Expect to record more items in `unreadable` on those sheets.
### 2–3. Render and check orientation
`render_pages.py` writes the following for each page:
- `overview.png`
- `overview_grid.png`, which shows the tile names
- overlapping tiles in `tiles/`
- `tiles.json`, which records which tiles are blank
Orientation is detected with OCR when it is installed. Always confirm it on `overview_grid.png`. If the main drawing text is not upright, re-render that page with an explicit rotation, given clockwise: `render_pages.py <work> --pages N --rotation 90`.
Title blocks are sometimes rotated differently from the drawing. Orient by the drawing labels, not by the title block.
### 4. Hints
`make_hints.py` writes `hints/page_NN.json`. Each file holds candidate tags with page positions, taken from the text layer or from OCR. They are only hints: OCR misreads, and it misses things. You don't need to read the hint files during extraction. QA uses them to flag tags you may have missed. If OCR is not installed the step is skipped; note this in the final report.
### 5. Extract each sheet
This is the core of the job. Follow **[references/extraction_procedure.md](references/extraction_procedure.md)** exactly. It covers:
- the reading order: overview, then every non-blank tile, then zoomed crops
- how to model pipe runs, tees, taps, signals and off-page connectors
- confidence calibration
- a self-check list to run before saving
Reference material, to read when needed:
- [references/isa_5_1.md](references/isa_5_1.md): instrument letter codes, bubble symbols, signal line types
- [references/symbol_guide.md](references/symbol_guide.md): how equipment and valve symbols map to `kind` values
- [references/ontology.md](references/ontology.md): the graph's node and edge types and how they are derived
- `references/schema/extraction.schema.json`: the exact JSON schema of a page file
Write `extract/page_NN.json` and save it before starting the next sheet, so a long job never holds more than one sheet in context. With many sheets, and if your environment supports subagents, you can extract sheets in parallel. Give each subagent the procedure file and its own page directory.
### 6–7. Build and the QA loop
`build_kg.py` validates every page file and stops with a precise message on schema errors. It then writes these files to `<work>/kg/`:
- `graph.json`
- `graph.duckdb`
- `summary.md`
- `qa_report.md`
Work through `qa_report.md`:
- **Errors**, such as `unresolved_reference`, are mistakes in the page files. Fix them and rebuild.
- **Warnings** name the tiles to re-check. Look at those tiles again, or use `crop.py` for a zoomed view, and correct the extraction if the drawing shows something different. Common warnings:
- `instrument_not_located`: a sensor with no `measures`
- `equipment_not_connected`
- `unmatched_off_page`
- `possible_missed_tags`: an OCR tag that is not in your extraction
- `tiles_not_reviewed`
- A warning that turns out correct on the drawing is fine to leave. Examples: an off-page connector whose other drawing was not supplied, or an OCR misread. List these in your report.
Stop when there are no errors and every warning has been checked.
```bash
python scripts/crop.py <work> --page 5 --bbox 0.40 0.20 0.55 0.35 # zoomed view of a region
```
### 8. Report
Tell the user:
- where the outputs are
- the headline counts (equipment, instruments, loops)
- two or three example flow paths and loops taken from `summary.md`
- what remains uncertain
Po질문하고, 팁을 나누고, 안 되는 점을 알려 주세요. "도움이 됨"이 많은 순서예요.