Home/Hardware & Electronics/easyeda-api-skill
E

easyeda-api-skill

by @easyedav
4.2(20)

Control JLC EDA Professional Edition through natural language, automatically completing schematic drawing, PCB design, component library management, and project operations. It provides 120+ categories of API references and WebSocket bridging, suitable for hardware engineers and AI-assisted circuit design scenarios, enabling real-time debugging and batch revisions, significantly reducing repetitive manual operations.

easyedapcb-designschematicwebsockethardwareGitHub
Installation
git clone https://github.com/easyeda/easyeda-api-skill.git
compare_arrows

Before / After Comparison

2 组
Before

Engineers manually place components, route traces, and adjust footprints in JLC EDA. Every revision requires repeating the same operations, and complex board routing is time-consuming and prone to missing design rules.

After

The AI directly controls the EDA through a WebSocket bridge, automatically completes placement and routing according to specifications, validates design rules in real time, and generates a usable PCB draft in minutes. Humans only perform the final review.

SKILL.md

name: easyeda-api description: >- EasyEDA Pro API skill for AI agents. Use when working with EasyEDA Pro EDA software, including PCB design, schematic editing, footprint/symbol management, and project operations. Supports live debugging in EasyEDA and EasyEDA extension development. Provides complete API reference (120+ classes, 62 enums, 70 interfaces), extension-development documentation, and a WebSocket bridge server to execute code in the running EasyEDA Pro client. Trigger on: "嘉立创EDA,启动!", "立创EDA,启动!", "EDA,启动!", "EasyEDA", "PCB", "schematic", "footprint", "EDA", "circuit board", "嘉立创EDA", "原理图", "PCB设计". IMPORTANT: 嘉立创EDA's English name is EasyEDA. They are the SAME product. Never use other transliterations like "EasyEDA Pro" (unless specifically versioned), "EASYEDA", "easyeda", etc. Always use "EasyEDA" for English references and "嘉立创EDA" for Chinese references. license: MIT compatibility: Requires Node.js 18+, EasyEDA Pro desktop client with extension support metadata: author: JLCEDA version: "1.1.3" openclaw: requires: bins: - node env: - CLAUDE_SKILL_DIR

EasyEDA Pro API Skill

Control EasyEDA Pro (嘉立创EDA专业版) programmatically through AI. This skill provides:

  1. Complete API reference — 120 classes, 62 enums, 70 interfaces, 19 type aliases
  2. WebSocket bridge — Execute code in the running EasyEDA Pro client
  3. Code patterns — Common operations for PCB, schematic, library, and project management
  4. Document source format reference — File format specifications for project, schematic, and PCB sources when users need to analyze or modify EasyEDA document source directly instead of using the API

This skill supports not only live debugging in EasyEDA, but also EasyEDA extension development. During EasyEDA extension development, AI agents can use the extension-related documentation, API references, type information, usage examples, and bridge-based debugging capabilities provided by this skill to look up APIs, write code, and validate behavior during integration and debugging.

Architecture

┌───────────┐   HTTP/WS     ┌─────────────────┐   WebSocket   ┌───────────┐
│ AI Agent  │ ◄───────────► │  Bridge Server  │ ◄───────────► │  EasyEDA  │
│           │  Port Range   │  (Node.js)      │  Port Range   │  (Client) │
└───────────┘  49620-49629  └─────────────────┘  49620-49629  └───────────┘

The server auto-selects an available port from 49620-49629 on startup. Both AI and EDA clients auto-discover the server by scanning the port range and verifying a handshake (service: "easyeda-bridge").

Quick Start

1. Command Triggers

When user says "嘉立创EDA,启动!", "立创EDA,启动!", or "EDA,启动!":

IMPORTANT: Session initialization — Reply immediately with this exact text to set the correct session title:

📋 EasyEDA Session

Then proceed with the setup steps below.

2. Install dependencies (if needed)

cd ${CLAUDE_SKILL_DIR} && npm install

3. Start bridge server

⚠️ IMPORTANT: The bridge server must run in the background. Do NOT run it in the foreground, or the AI will block waiting for the server to exit.

# Check if bridge is already running
for port in $(seq 49620 49629); do
  resp=$(curl -s http://localhost:$port/health 2>/dev/null)
  if echo "$resp" | grep -q '"easyeda-bridge"'; then
    echo "Bridge already running on port $port"
    BRIDGE_PORT=$port
    break
  fi
done

# Start bridge if not running
if [ -z "$BRIDGE_PORT" ]; then
  node ${CLAUDE_SKILL_DIR}/scripts/bridge-server.mjs &
  sleep 2
  # Find the port bridge is running on
  for port in $(seq 49620 49629); do
    resp=$(curl -s http://localhost:$port/health 2>/dev/null)
    if echo "$resp" | grep -q '"easyeda-bridge"'; then
      BRIDGE_PORT=$port
      break
    fi
  done
fi

echo "Bridge running on port: ${BRIDGE_PORT:-unknown}"

4. Connect EasyEDA

Install the run-api-gateway.eext extension in EasyEDA Pro. Download link:

After the extension is loaded, it will automatically establish the WebSocket connection.

5. Verify connection and select EDA window

# Check bridge and EDA connection status
curl http://localhost:${BRIDGE_PORT:-49620}/health

# List all connected EDA windows
curl http://localhost:${BRIDGE_PORT:-49620}/eda-windows

The /eda-windows response looks like:

{
  "windows": [
    { "windowId": "abc-123", "connected": true, "active": true },
    { "windowId": "def-456", "connected": true, "active": false }
  ],
  "activeWindowId": "abc-123",
  "count": 2
}

Handle based on window count:

  • 0 windows: Tell user "No EasyEDA window is connected. Please ensure the EasyEDA extension (run-api-gateway.eext) is installed and loaded in EasyEDA. Download: https://jlc-ext.com/item/oshwhub/run-api-gateway"
  • 1 window: Auto-selected as active. Tell user: "✅ Connected! Active EDA window: abc-123. Ready to work."
  • 2+ windows: Show the available windows and ask user to select:
    Multiple EDA windows detected:
    - abc-123 (active)
    - def-456
    
    Which EDA window should I use?
    

Select a window:

curl -X POST http://localhost:${BRIDGE_PORT}/eda-windows/select \
  -H "Content-Type: application/json" \
  -d '{"windowId": "abc-123"}'

After selection, confirm: "✅ Active EDA window: abc-123. Ready to work."

6. Execute code on EDA

curl -X POST http://localhost:${BRIDGE_PORT:-49620}/execute \
  -H "Content-Type: application/json" \
  -d '{"code": "return await eda.dmt_Project.getCurrentProjectInfo();"}'

API Documentation

The full API reference is in the references/ directory:

  • references/_index.md — Master index of all classes, enums, interfaces, and types
  • references/_quick-reference.md — All method signatures for rapid lookup
  • references/classes/ — 120 class docs (DMT_, PCB_, SCH_, LIB_, SYS_, IPCB_, ISCH_*)
  • references/enums/ — 62 enum docs
  • references/interfaces/ — 70 interface docs
  • references/types/ — 19 type alias docs

How to look up API

  1. Start with _index.md to find the right class/module for the task
  2. Read the class doc (e.g., references/classes/DMT_Board.md) for all methods and signatures
  3. Use _quick-reference.md for fast method signature lookup across all classes
  4. Check enums/interfaces for parameter types and return types

Document Source Format Documentation

If the user needs to analyze or modify EasyEDA document source directly instead of using the API, use the documents in the format/ directory.

  • format/index.md — Overview of the EasyEDA document source format references and version notes
  • format/project/ — Project source structure, metadata, blobs, variants, and grouping data
  • format/schematic/ — Schematic source format, including structure, wires, shapes, pins, components, and tables
  • format/pcb/ — PCB source format, including primitives, pads and vias, shapes, text, attributes, rules, and panel data

Use these files when the task is about understanding source layout, generating compatible document source, or editing source data that will later be imported back into EasyEDA.

API Module Overview

PrefixDomainKey Classes
DMT_Document managementBoard, EditorControl, Folder, Panel, Pcb, Project, Schematic, SelectControl, Team, Workspace
PCB_PCB & FootprintDocument, Drc, Event, Layer, Net, Primitive, PrimitiveComponent, PrimitiveLine, PrimitivePad, PrimitivePour, PrimitiveVia, SelectControl
SCH_SchematicDocument, Event, Primitive, PrimitiveComponent, PrimitiveWire, SelectControl
LIB_Library3DModel, Cbb, Classification, Device, Footprint, LibrariesList, PanelLibrary, SelectControl, Symbol
SYS_SystemDialog, Environment, FileManager, FileSystem, FontManager, HeaderMenu, I18n, IFrame, LoadingAndProgressBar, Log, Message, MessageBox, MessageBus, PanelControl, Setting, ShortcutKey, Storage, Timer, ToastMessage, WebSocket, Window
IPCB_PCB interfaces (图元)PrimitiveArc, PrimitiveComponent, PrimitivePad, PrimitiveFill, PrimitivePour, PrimitiveRegion, PrimitiveVia, ...
ISCH_Schematic interfaces (图元)PrimitiveArc, PrimitiveComponent, PrimitiveWire, PrimitiveText, PrimitiveRectangle, ...
EPCB_ / ESCH_EnumsPrimitiveType, Layer, PadType, ...

Code Execution Context

All code runs inside EasyEDA Pro's browser runtime as:

async function(eda) {
  // Your code here — `eda` is the global EDA API object
  // You MUST use `return` to send results back
  // Do not add comments to the generated code, as the code is typically executed as a single line
}

Critical rules:

  • The eda object provides access to all API modules (e.g., eda.dmt_Board, eda.pcb_Primitive).
  • Always refer to the API documentation for correct usage.
  • Do not add comments to the generated code, as the code is typically executed as a single line.
  • Always use return to get results — console.log output is NOT captured.
  • All API methods returning promises must be awaited.
  • Code runs in browser context — no Node.js APIs (fs, path, etc.) available.
  • Use eda.sys_Message.showToastMessage(msg) for user-visible notifications.
  • When reviewing API documentation and encountering enumerations, do not guess the enumeration values. You must use the enumeration members, for example: EPCB_LayerId.TOP instead of 1 for the layer parameter in PCB primitive creation.

Extension Runtime Constraints

When writing EasyEDA extensions, standard browser APIs are forbidden in the main process. Use EDA-provided alternatives:

Purpose❌ Forbidden✅ Use Instead
Get user input—eda.sys_Dialog.showInputDialog()
User selection—eda.sys_Dialog.showSelectDialog()
Show messagealert()eda.sys_Dialog.showInformationMessage()
Confirm actionconfirm()eda.sys_Dialog.showConfirmationMessage()
Toast notificationDOM manipulationeda.sys_Message.showToastMessage()
Store datalocalStorage (main process)eda.sys_Storage.setExtensionUserConfig(key, value)
Custom UIManipulate host DOMeda.sys_IFrame.openIFrame()
Show HTMLshowInformationMessage(html)Must use iframe
Open linkwindow.open()eda.sys_Window.open()
Browser hardware APIUse in main processAvailable in iframe (navigator.serial, etc.)

Note: localStorage, window, document etc. are available inside sys_IFrame but NOT in the main extension process.

Extension ↔ IFrame Data Passing

The main extension process and sys_IFrame iframe are isolated contexts. To pass data between them:

Option A (Recommended): Use eda.sys_Storage as a bridge

// In main extension process:
await eda.sys_Storage.setExtensionUserConfig('myKey', JSON.stringify(data));

// In iframe:
const data = JSON.parse(await eda.sys_Storage.getExtensionUserConfig('myKey'));

Option B: Both contexts can access eda directly — call the same API from either side

// In iframe HTML (NOT window.parent.eda):
const info = await eda.dmt_Project.getCurrentProjectInfo();

Communication Protocol

Port Discovery

The bridge server listens on the first available port in 49620-49629. To find the server, scan the range and verify the service identity:

for port in $(seq 49620 49629); do
  resp=$(curl -s http://127.0.0.1:$port/health 2>/dev/null)
  if echo "$resp" | grep -q '"easyeda-bridge"'; then
    BRIDGE_PORT=$port; break
  fi
done

Handshake

  • HTTP: GET /health returns { "service": "easyeda-bridge", "edaConnected": bool, ... }
  • WebSocket: On connect, server sends { "type": "handshake", "service": "easyeda-bridge" }
  • Clients MUST verify service === "easyeda-bridge" before using the connection

Message Format

JSON messages over WebSocket / HTTP:

FieldTypeDescription
type"execute" | "result" | "error" | "ping" | "pong" | "handshake"Message type
idstringRequest UUID for matching request/response
codestringJavaScript code to execute (for execute type)
resultanyExecution result (for result type)
errorstringError message (for error type)
servicestringService identifier (for handshake type)
timestampnumberUnix milliseconds

Common Patterns

Project & Board Operations

// Get current project info
return await eda.dmt_Project.getCurrentProjectInfo();

// List all boards in project
return await eda.dmt_Board.getAllBoardsInfo();

// Create a new board (optionally link to schematic/PCB)
return await eda.dmt_Board.createBoard();

// Switch to a document tab
await eda.dmt_EditorControl.activateDocument(tabId);

Example: Open a project by name and open its first schematic page

const targetProjectName = 'NE555 Circuit';

// 1. Enumerate projects by team/folder and find the target by name
const teams = await eda.dmt_Team.getAllTeamsInfo();
const seenProjectUuid = new Set();
let targetProjectUuid = null;

for (const team of teams || []) {
  const teamProjects = await eda.dmt_Project.getAllProjectsUuid(team.uuid);
  for (const projectUuid of teamProjects || []) {
    if (seenProjectUuid.has(projectUuid)) continue;
    seenProjectUuid.add(projectUuid);

    const info = await eda.dmt_Project.getProjectInfo(projectUuid);
    const name = info?.friendlyName || info?.name || '';
    if (name === targetProjectName) {
      targetProjectUuid = projectUuid;
      break;
    }
  }
  if (targetProjectUuid) break;

  const folderUuids = await eda.dmt_Folder.getAllFoldersUuid(team.uuid);
  for (const folderUuid of folderUuids || []) {
    const folderProjects = await eda.dmt_Project.getAllProjectsUuid(team.uuid, folderUuid);
    for (const projectUuid of folderProjects || []) {
      if (seenProjectUuid.has(projectUuid)) continue;
      seenProjectUuid.add(projectUuid);

      const info = await eda.dmt_Project.getProjectInfo(projectUuid);
      const name = info?.friendlyName || info?.name || '';
      if (name === targetProjectName) {
        targetProjectUuid = projectUuid;
        break;
      }
    }
    if (targetProjectUuid) break;
  }
  if (targetProjectUuid) break;
}

if (!targetProjectUuid) {
  throw new Error(`Project not found: ${targetProjectName}`);
}

// 2. Open the project
const opened = await eda.dmt_Project.openProject(targetProjectUuid);
if (!opened) {
  throw new Error(`Failed to open project: ${targetProjectName}`);
}

// 3. Get the first schematic page and open it
const schematics = 

...

User Reviews (0)

Write a Review

Effect
Usability
Docs
Compatibility

No reviews yet

Statistics

Installs600
Rating4.2 / 5.0
Version
Updated2026年10月24日
Comparisons2

User Rating

4.2(20)
5
75%
4
20%
3
5%
2
0%
1
0%

Rate this Skill

0.0

Compatible Platforms

🔧Manual

Timeline

Created2026年8月3日
Last Updated2026年10月24日
🎁 Agent Knowledge Cards
Survey