You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI Skill for building EasyEDA Pro extension plugins. Used when users need to create, modify, or debug EasyEDA Pro plugins, including generating plugin code, querying API documentation, configuring extension.json, and handling i18n localization. Trigger words: "EasyEDA", "嘉立创EDA", "EDA plugin", "EDA extension", "extension.json", "pro-api-types", "原理图", "PCB设计"
tags
EDA
EasyEDA
plugin
extension
PCB
schematic
嘉立创
license
MIT
compatibility
Build requires Node.js 18+; runtime is EasyEDA Pro browser sandbox
metadata
author
version
JLCEDA
2.0.0
extension-dev-skill
AI Skill for EasyEDA Pro extension plugin development. Provides scenario-driven recipes, complete API reference, code generation standards, and debugging toolchain.
Core Principles
Never guess APIs — Check resources/references/ first; no matching doc = does not exist
Verify mount path — Class name ≠ eda property name. Always confirm via the mapping table below
Verify return types — get() and getAll() on the same class may return different interface types
Browser APIs forbidden in main process — No localStorage, window, document; allowed inside iframe only
Document type values — SCH=1, PCB=3, FOOTPRINT=4 (PCB is NOT 2)
console.log forbidden — Only console.warn and console.error are allowed in generated code
When to Use
Applicable:
Creating or modifying EasyEDA Pro extension plugins
Querying API method signatures via resources/ documentation
Configuring extension.json, locales i18n files, or build processes
Automating plugin import/debugging via eext-dev-mcp MCP tools
Not applicable:
General TypeScript/JavaScript questions unrelated to EasyEDA Pro
Non-EasyEDA Pro EDA tools
Workspace has no extension.json and user did not request initialization
Scenario Quick Reference (Recipes)
When user intent matches a scenario below, read the corresponding recipe first — it contains the complete call chain, step-by-step instructions, common errors, and code examples.
Plugin Scaffolding & Document Info
recipe
scenario
recipes/create_menu_plugin.md
Create a new plugin with menu registration and basic structure
recipes/get_current_document.md
Get current document info (type, UUID, project) — the most common starting point
Document Tree Management (DMT)
recipe
scenario
recipes/dmt_board_management.md
Board management — create/delete/copy boards, get board info
recipes/dmt_editor_control.md
Editor control — open/close/activate documents, split screen, zoom, markers
Manufacturing data — Gerber, BOM, pick-and-place, PCB/SMT ordering
recipes/pcb_math_polygon.md
Polygon math — boolean operations, area, image-to-polygon
Library Operations (LIB)
recipe
scenario
recipes/lib_device_search.md
Search devices, get device info — canvas UUID ≠ library UUID pitfall
recipes/lib_symbol_footprint.md
Symbol and footprint search/get/preview
recipes/lib_libraries_management.md
Library list, classification, 3D models, CBB modules
System Operations (SYS)
recipe
scenario
recipes/iframe_custom_ui.md
Create custom UI with iframe (data exchange)
recipes/user_dialog_input.md
Get user input via built-in dialogs (input, select, confirm)
recipes/sys_storage_operations.md
Data storage — extension user config (key required!)
recipes/sys_http_request.md
External HTTP requests (cURL)
recipes/sys_file_operations.md
File system — save/read files
recipes/sys_menu_shortcut.md
Header menu and shortcut key management
recipes/sys_notification_message.md
Toast messages, message box, loading/progress bar
recipes/sys_environment_info.md
Runtime environment info — version, theme, language
recipes/sys_i18n_localization.md
Internationalization (i18n) — multi-language support
recipes/sys_window_operations.md
Window, right-click menu, panel control, message bus
recipes/sys_timer_websocket.md
Timer and WebSocket operations
recipes/sys_format_conversion.md
Format conversion — Altium Designer, KiCad import/export
recipes/sys_font_unit_tool.md
Font management, unit conversion (mil), utility tools, logging
eda Property Mapping Table
This is the authoritative mapping. Use eda.<property> to access the corresponding class.
DMT (Document Tree)
eda property
Class
Description
eda.dmt_Board
DMT_Board
Board management
eda.dmt_EditorControl
DMT_EditorControl
Editor tab/split-screen control
eda.dmt_Folder
DMT_Folder
Folder management
eda.dmt_Panel
DMT_Panel
Panel management
eda.dmt_Pcb
DMT_Pcb
PCB document management
eda.dmt_Project
DMT_Project
Project management
eda.dmt_Schematic
DMT_Schematic
Schematic document management
eda.dmt_SelectControl
DMT_SelectControl
Current document info (getCurrentDocumentInfo())
eda.dmt_Team
DMT_Team
Team management
eda.dmt_Workspace
DMT_Workspace
Workspace management
SCH (Schematic & Symbol)
eda property
Class
Description
eda.sch_Document
SCH_Document
Save, import changes, auto-layout
eda.sch_Drc
SCH_Drc
Schematic DRC
eda.sch_Event
SCH_Event
Schematic events
eda.sch_ManufactureData
SCH_ManufactureData
Manufacturing data export
eda.sch_Netlist
SCH_Netlist
Netlist operations
eda.sch_Primitive
SCH_Primitive
Unified primitive operations (abstract)
eda.sch_PrimitiveArc
SCH_PrimitiveArc
Arc primitives
eda.sch_PrimitiveAttribute
SCH_PrimitiveAttribute
Attribute primitives
eda.sch_PrimitiveBus
SCH_PrimitiveBus
Bus primitives
eda.sch_PrimitiveCircle
SCH_PrimitiveCircle
Circle primitives
eda.sch_PrimitiveComponent
SCH_PrimitiveComponent
Component primitives (get/create/modify/delete)
eda.sch_PrimitivePin
SCH_PrimitivePin
Pin primitives (symbol editor only)
eda.sch_PrimitivePolygon
SCH_PrimitivePolygon
Polygon primitives
eda.sch_PrimitiveRectangle
SCH_PrimitiveRectangle
Rectangle primitives
eda.sch_PrimitiveText
SCH_PrimitiveText
Text primitives
eda.sch_PrimitiveWire
SCH_PrimitiveWire
Wire primitives
eda.sch_SelectControl
SCH_SelectControl
Selection control
eda.sch_SimulationEngine
SCH_SimulationEngine
Simulation engine
eda.sch_Utils
SCH_Utils
Utilities
PCB (PCB & Footprint)
eda property
Class
Description
eda.pcb_Document
PCB_Document
Save, import changes, coordinate conversion
eda.pcb_Drc
PCB_Drc
PCB DRC
eda.pcb_Event
PCB_Event
PCB events
eda.pcb_Layer
PCB_Layer
Layer operations
eda.pcb_ManufactureData
PCB_ManufactureData
Manufacturing data / Gerber export
eda.pcb_MathPolygon
PCB_MathPolygon
Polygon math utilities
eda.pcb_Net
PCB_Net
Net operations
eda.pcb_Primitive
PCB_Primitive
Unified primitive operations (abstract)
eda.pcb_PrimitiveArc
PCB_PrimitiveArc
Arc primitives
eda.pcb_PrimitiveAttribute
PCB_PrimitiveAttribute
Attribute primitives
eda.pcb_PrimitiveComponent
PCB_PrimitiveComponent
Component primitives (get/create/modify/delete)
eda.pcb_PrimitiveDimension
PCB_PrimitiveDimension
Dimension primitives
eda.pcb_PrimitiveFill
PCB_PrimitiveFill
Fill primitives
eda.pcb_PrimitiveImage
PCB_PrimitiveImage
Image primitives
eda.pcb_PrimitiveLine
PCB_PrimitiveLine
Line primitives
eda.pcb_PrimitiveObject
PCB_PrimitiveObject
Binary embedded objects
eda.pcb_PrimitivePad
PCB_PrimitivePad
Pad primitives
eda.pcb_PrimitivePolyline
PCB_PrimitivePolyline
Polyline primitives
eda.pcb_PrimitivePour
PCB_PrimitivePour
Pour border primitives
eda.pcb_PrimitivePoured
PCB_PrimitivePoured
Pour fill primitives
eda.pcb_PrimitiveRegion
PCB_PrimitiveRegion
Region primitives
eda.pcb_PrimitiveString
PCB_PrimitiveString
Text primitives
eda.pcb_PrimitiveVia
PCB_PrimitiveVia
Via primitives
eda.pcb_SelectControl
PCB_SelectControl
Selection control
LIB (Library)
eda property
Class
Description
eda.lib_3DModel
LIB_3DModel
3D model library
eda.lib_Cbb
LIB_Cbb
Reuse module library
eda.lib_Classification
LIB_Classification
Library classification index
eda.lib_Device
LIB_Device
Device library (search/get devices)
eda.lib_Footprint
LIB_Footprint
Footprint library
eda.lib_LibrariesList
LIB_LibrariesList
Library list
eda.lib_PanelLibrary
LIB_PanelLibrary
Panel library
eda.lib_SelectControl
LIB_SelectControl
Library selection control
eda.lib_Symbol
LIB_Symbol
Symbol library
SYS (System)
eda property
Class
Description
eda.sys_ClientUrl
SYS_ClientUrl
External HTTP requests (cURL)
eda.sys_Dialog
SYS_Dialog
Dialogs (message, input, select, confirm)
eda.sys_Environment
SYS_Environment
Runtime environment info
eda.sys_FileManager
SYS_FileManager
File manager
eda.sys_FileSystem
SYS_FileSystem
File system interaction
eda.sys_FontManager
SYS_FontManager
Font management
eda.sys_FormatConversion
SYS_FormatConversion
Format conversion (Altium/KiCad)
eda.sys_HeaderMenu
SYS_HeaderMenu
Header menu control
eda.sys_I18n
SYS_I18n
Internationalization
eda.sys_IFrame
SYS_IFrame
IFrame windows (custom UI)
eda.sys_LoadingAndProgressBar
SYS_LoadingAndProgressBar
Loading / progress bar
eda.sys_Log
SYS_Log
Logging
eda.sys_Message
SYS_Message
Non-intrusive notifications
eda.sys_MessageBox
SYS_MessageBox
Message box
eda.sys_MessageBus
SYS_MessageBus
Message bus
eda.sys_PanelControl
SYS_PanelControl
Panel control
eda.sys_RightClickMenu
SYS_RightClickMenu
Right-click menu
eda.sys_Setting
SYS_Setting
Settings
eda.sys_ShortcutKey
SYS_ShortcutKey
Shortcut key registration
eda.sys_Storage
SYS_Storage
Storage (extension user config)
eda.sys_Timer
SYS_Timer
Timer
eda.sys_ToastMessage
SYS_ToastMessage
Toast notifications
eda.sys_Tool
SYS_Tool
Utility tools
eda.sys_Unit
SYS_Unit
Unit conversion (mil-based)
eda.sys_WebSocket
SYS_WebSocket
WebSocket
eda.sys_Window
SYS_Window
Window operations
PNL (Panel)
eda property
Class
Description
eda.pnl_Document
PNL_Document
Panel document operations
Critical Pitfalls (Must Read)
These are the most common errors. Violating any of these will produce broken code.
1. getCurrentDocumentInfo is on dmt_SelectControl, NOT sch_Document
// ❌ WRONG — does not existeda.sch_Document.getCurrentDocumentInfo();// ✅ CORRECTconstdocInfo=awaiteda.dmt_SelectControl.getCurrentDocumentInfo();
2. SCH modify() vs PCB setState_*().done()
// ❌ SCH: setState_* does NOT commit changescomponent.setState_Designator("B2");// no effect// ✅ SCH: use class-level modify()awaiteda.sch_PrimitiveComponent.modify(primitiveId,{designator: "B2"});// ✅ PCB: setState_* chain + done() commitsline.setState_StartX(100).setState_StartY(200).done();
3. get() vs getAll() return different interface types
// get() returns ISCH_PrimitiveComponent — may NOT have getState_Designator()// getAll() returns ISCH_PrimitiveComponent$1 — HAS getState_Designator()constcomponents=awaiteda.sch_PrimitiveComponent.getAll();components[0].getState_Designator();// ✓ works
4. SCH_Primitive / PCB_Primitive are abstract — no getAllPrimitiveId
// ❌ WRONG — abstract class, no getAllPrimitiveIdeda.sch_Primitive.getAllPrimitiveId();// ✅ CORRECT — use concrete classconstids=awaiteda.sch_PrimitiveComponent.getAllPrimitiveId();
6. IFrame data passing — window objects are isolated
// ❌ WRONG — main process and iframe window are isolated(windowasany).__data=data;window.parent.eda;// unnecessary// ✅ Option A (recommended): use storageawaiteda.sys_Storage.setExtensionUserConfig('myKey',data);// In iframe: const data = await eda.sys_Storage.getExtensionUserConfig('myKey');// ✅ Option B: use eda directly in iframe (both contexts have access)// In iframe: const doc = await eda.dmt_SelectControl.getCurrentDocumentInfo();
// ❌ WRONG — HTML tags shown as plain texteda.sys_Dialog.showInformationMessage('<b>Hello</b>');// ✅ CORRECT — use iframe for HTML contenteda.sys_IFrame.openIFrame('/iframe/result.html',600,400);
9. Pins/Pads do NOT have getState_Net
// ❌ WRONG — no getState_Net on pinspin.getState_Net();// ✅ SCH nets: get from wiresconstwires=awaiteda.sch_PrimitiveWire.getAll();wires[0].getState_Net();// ✅ PCB nets: use pcb_Netconstnets=awaiteda.pcb_Net.getAll();
10. Canvas UUID ≠ Library UUID
// ❌ WRONG — canvas primitiveId is not a library device UUIDconstcomp=awaiteda.sch_PrimitiveComponent.get(id);comp.getState_Component().uuid;// this is a primitiveId, NOT device UUID// ✅ CORRECT — use lib_Device.search() to get library device UUIDconstresults=awaiteda.lib_Device.search({keyword: 'STM32'});
11. Menu Title i18n Uses locales/extensionJson/, NOT locales/
// ❌ WRONG — menu titles are NOT translated via locales/en.json// extension.json: "title": "%myplugin.menu.title%" ← wrong syntax// locales/en.json: { "myplugin.menu.title": "My Plugin" } ← wrong location// ✅ CORRECT — use plain text title, translate in locales/extensionJson/// extension.json: "title": "My Plugin"// locales/extensionJson/en.json: { "My Plugin": "My Plugin" }// locales/extensionJson/zh-Hans.json: { "My Plugin": "我的插件" }
12. npm Packages Work in iframe, NOT in Main Process
// ❌ WRONG — npm packages that depend on DOM/Node.js APIs won't work in src/importChartfrom'chart.js';// fails in EDA sandbox// ✅ CORRECT — use npm packages in iframe/ code (standard browser context)// iframe/app.ts: import Chart from 'chart.js'; // works fine
API Documentation Structure
resources/
experience.md # All pitfalls and lessons learned (15 items)
guide/ # Developer guide (concepts, best practices)
index.md # What is the Extension API
how-to-start.md # Environment setup and first extension
invoke-apis.md # How to call APIs + debugging methods
extension-json.md # extension.json configuration reference
i18n.md # Multi-language support
inline-frame.md # IFrame custom UI windows
error-handling.md # Error handling and safety mode
stability.md # API versioning and stability policy
extensions-marketplace.md # Extensions marketplace guide
ancillary-projects.md # Ancillary projects overview
ancillary-projects/ # Ancillary project details
references/ # Complete API reference
_index.md # Master index of all classes, enums, interfaces, types
_quick-reference.md # All method signatures for rapid lookup
classes/ # 120 class docs
enums/ # 62 enum docs
interfaces/ # 70 interface docs
types/ # 19 type alias docs
How to Look Up API
Recommended decision path:
User need is a multi-step scenario (e.g., "export BOM", "create plugin with UI") → find the matching recipes/ file
User need is a single API detail (e.g., "what params does modify() take") → read references/classes/<ClassName>.md
Need to find which class has a method → search in references/_quick-reference.md
Need enum values or interface properties → check references/enums/ or references/interfaces/
Need concepts or patterns → read guide/ files
Execution Workflow
Plan — Understand requirements, confirm target editor (home/sch/pcb) and core functionality
Init — If workspace has no extension.json, run project initialization; otherwise skip
Recipe — Check if a matching recipe exists in recipes/; if yes, follow its call chain
Query — For APIs not covered by recipes, query resources/references/ using the four-step method (find class → verify mount path → confirm signature → verify return interface)
Validate — Verify all type signatures are complete with no guesswork; if uncertain, return to Query
Confirm — Always present the implementation plan to the user before writing any code. The plan must include: API list, dependencies, data flow, and file changes. Then explicitly ask the user whether to proceed. Do not start code generation until the user confirms
Execute — After user confirmation, generate code; each API call corresponds to a verified signature, wrapped in try/catch with proper logging
Lint — Run npm run lint to check for syntax, type, and style issues; fix any errors before proceeding
Check — Check runtime environment constraints; confirm no forbidden operations; verify all headerMenus IDs in extension.json are globally unique across all editor pages; verify menu title translations are in locales/extensionJson/ (not locales/); if violations found, return to Execute to fix
Doc — Generate or update README.md and CHANGELOG.md
Deploy — Run npm run build; if eext-dev-mcp MCP tools are available, auto-import via dev_plugin; otherwise inform user to manually upload
API Verification Checklist
Found class doc in resources/references/classes/; confirmed method exists
Read full method signature; confirmed all parameter types and counts
Failures: API call failed, data missing, operation aborted
✅ Yes
Debug
console.log(...)
—
❌ Forbidden
Always prefix with plugin name: [MyPlugin]
Only console.warn and console.error are allowed — console.log is strictly forbidden
try/catch Rules
Every eda.* API call must be wrapped in try/catch
Catch blocks must log with console.error and include the error object
Group related API calls in a single try/catch when they share a logical operation
Provide user-facing feedback on failure via eda.sys_Dialog.showInformationMessage() or eda.sys_Message.showToastMessage()
Standard Code Pattern
constPLUGIN_TAG='[MyPlugin]';exportasyncfunctionmyFeature(){try{constdocInfo=awaiteda.dmt_SelectControl.getCurrentDocumentInfo();if(!docInfo){console.warn(PLUGIN_TAG,'No active document found, aborting');return;}// ... business logic}catch(err){console.error(PLUGIN_TAG,'Failed to execute myFeature:',err);awaiteda.sys_Dialog.showInformationMessage('Operation failed. Check console for details.');}}
Defensive Checks
constcomponents=awaiteda.sch_PrimitiveComponent.getAll();if(!components||components.length===0){console.warn(PLUGIN_TAG,'No components found in current schematic');return;}
Plugin Documentation Generation
README.md
After generating plugin code, always create or update README.md: