serial
Original:🇨🇳 Chinese
Translated
6 scripts
Embedded serial port debugging tool for serial port scanning, real-time monitoring, data sending, log recording, and Hex viewing. Automatically triggered when users mention serial port, COM port, UART, AT command debugging, baud rate, Hex streaming, serial port log capturing, serial port monitoring, viewing MCU output, or binary protocol joint debugging. It also supports explicit invocation via /serial. Even if users only say "check serial port output", "send an AT command", or "capture logs", this skill should be triggered as long as the context involves serial port communication.
2installs
Sourcezhinkgit/embeddedskills
Added on
NPX Install
npx skill4agent add zhinkgit/embeddedskills serialTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Serial — Embedded Serial Port Debugging Tool
Unified encapsulation of port discovery, real-time monitoring, data sending, log recording, and Hex viewing capabilities.
Configuration
Environment-level Configuration (skill/config.json
)
skill/config.jsonThe environment-level configuration for the serial skill is currently an empty object since serial port parameters belong to project-level configuration and are managed uniformly in of the workspace.
{}.embeddedskills/config.jsonProject-level Configuration (.embeddedskills/config.json
)
.embeddedskills/config.jsonThe under the workspace stores project-level serial port configurations:
.embeddedskills/config.jsonjson
{
"serial": {
"port": "",
"baudrate": 115200,
"bytesize": 8,
"parity": "none",
"stopbits": 1,
"encoding": "utf-8",
"timeout_sec": 1.0,
"log_dir": ".embeddedskills/logs/serial"
}
}| Field | Description | Default Value |
|---|---|---|
| Serial port number, e.g., | |
| Baud rate | |
| Data bits | |
| Parity: none/even/odd/mark/space | |
| Stop bits: 1/1.5/2 | |
| Text encoding | |
| Read/write timeout (seconds) | |
| Log output directory | |
Parameter Parsing Priority
- CLI parameters (,
--port, etc.) - Highest priority--baudrate - Project-level configuration (the section in
serial).embeddedskills/config.json - State file (historical records in )
.embeddedskills/state.json - Default values - Lowest priority
Automatic Scanning Behavior
When is not specified, the script automatically scans system serial ports:
port- If only one serial port is found, it is automatically used and written to the project configuration
- If multiple serial ports are found, a candidate list is returned for the user to select (specify via )
--port - If no serial ports are found, an error is prompted
Subcommands
| Subcommand | Purpose | Risk |
|---|---|---|
| Scan available serial ports | Low |
| View text output in real-time | Low |
| Send text or Hex data | Medium |
| View binary stream in real-time | Low |
| Save serial port logs to files | Low |
Execution Flow
- Check if is available; prompt
pyserialif not installedpip install pyserial - Parse parameters by priority: CLI > Project-level configuration > State file > Default values
- Execute by default when no subcommand is specified
scan - use the parsed connection parameters
monitor / send / hex / log - If is not specified, automatically scan system serial ports:
port- Unique candidate: automatically use and write to project configuration
- Multiple candidates: return list for user selection
- After successful execution, write the confirmed parameters back to the project configuration
- Run the corresponding script and output structured results
- When failed, prioritize feedback on port occupation, driver, baud rate, and encoding issues
Script Invocation
All scripts are located in the directory of the skill, and can be directly called via .
Scripts read parameters from CLI parameters, project-level configuration, and state files according to priority.
scripts/pythonbash
# Scan serial ports
python scripts/serial_scan.py [--filter <keyword>] [--json]
# Real-time monitoring
python scripts/serial_monitor.py [--port <serial port>] [--baudrate <baud rate>] [--timestamp] [--filter <regex>] [--timeout <seconds>] [--json]
# Send data
python scripts/serial_send.py [--port <serial port>] [--baudrate <baud rate>] <data> [--hex] [--crlf] [--repeat <times>] [--wait-response] [--json]
# Hex viewing
python scripts/serial_hex.py [--port <serial port>] [--baudrate <baud rate>] [--width <columns>] [--timeout <seconds>] [--json]
# Log recording
python scripts/serial_log.py [--port <serial port>] [--baudrate <baud rate>] [--output <file>] [--duration <seconds>] [--format text|csv|json] [--json]Output Format
Single command returns standard JSON:
json
{
"status": "ok",
"action": "scan",
"summary": "Found 2 serial ports",
"details": { ... }
}Continuous commands (monitor --json, hex --json) output JSON Lines, and the end summary is written to stderr.
Error output:
json
{
"status": "error",
"action": "monitor",
"error": { "code": "port_busy", "message": "Serial port is occupied by another program" }
}Core Rules
- Do not automatically guess ports and baud rates; do not automatically select when multiple candidate serial ports are found
- Parameter parsing priority: CLI > Project-level configuration > State file > Default values
- Automatically scan when is not specified; automatically write the unique candidate to configuration, require user selection for multiple candidates
port - After successful execution, automatically write confirmed parameters back to
.embeddedskills/config.json - Do not actively send any serial port data when the purpose is not clearly stated
- Continuous streams of output use JSON Lines, and summaries are written to stderr without polluting the data stream
--json - Regular expression filtering failure should not cause monitoring to exit
References
- : VID/PID mapping of common USB-to-serial chips
references/common_devices.json