Skip to content

jguy/sigrok-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sigrok-skill

A Claude Code skill for controlling sigrok-compatible logic analyzers via sigrok-cli. Capture, decode, and analyze digital signals (I2C, SPI, UART, JTAG, and 130+ protocols) directly from your terminal through natural language.

What it does

Tell Claude what you want to capture, and it handles the rest:

  • Detects your connected logic analyzer automatically
  • Builds the correct sigrok-cli commands for your protocol and wiring
  • Captures raw data to .sr session files (capture-first pattern for reliability)
  • Decodes offline using sigrok's 132 protocol decoders
  • Analyzes results and summarizes findings (NACKs, framing errors, register values, etc.)

Works in two modes:

  • Interactive — walks you through channel mapping, protocol settings, triggers, and sample rate selection
  • Autonomous — give a complete request like "capture 3 seconds of I2C on D0/D1" and it runs end-to-end

Supported devices

The skill uses a multi-device architecture with per-device profile files. Currently includes:

Device Driver Channels Max Sample Rate
Sipeed SLogic16 U3 sipeed-slogic-analyzer 16 (D0-D15) 200 MHz

Adding support for another sigrok-compatible analyzer means adding one device profile markdown file. See Adding a new device.

Installation

Prerequisites

  • sigrok-cli with libsigrokdecode (protocol decoder support)
  • A sigrok-compatible logic analyzer
  • Claude Code

To check if your sigrok-cli has decoder support:

sigrok-cli --help | grep -q "\-P" && echo "Decoders available" || echo "Missing libsigrokdecode"

If missing, you'll need to build libsigrokdecode and rebuild sigrok-cli. See Building from source below.

Install the skill

git clone https://github.com/jguy/sigrok-skill.git
cd sigrok-skill
mkdir -p ~/.claude/commands/sigrok
cp SKILL.md ~/.claude/commands/sigrok.md
cp devices/sipeed-slogic16u3.md ~/.claude/commands/sigrok/

Verify

# Check device is detected
sigrok-cli --scan

# Check decoders work
sigrok-cli --protocol-decoders i2c --show

Then in Claude Code, invoke with /sigrok or just ask about capturing signals.

Supported protocols

The skill includes decode recipes for:

  • I2C — with stacked decoders (EEPROM, sensors, etc.)
  • SPI — configurable CPOL/CPHA/word size/bit order
  • UART/Serial — configurable baud, parity, inversion
  • JTAG — TCK/TMS/TDI/TDO mapping
  • 1-Wire — link + network layer stacking

Plus access to all 132 sigrok protocol decoders (CAN, FlexRay, USB, IR, RF, ARM debug, and more).

WSL: USB passthrough scripts

If you're running sigrok-cli inside WSL, you need usbipd-win to forward the USB device. The scripts/ directory provides helpers:

# Attach the logic analyzer to WSL
./scripts/slogic-attach

# Detach it back to Windows
./scripts/slogic-detach

Edit scripts/slogic.conf to set your device's VID:PID if using a different analyzer.

Repository layout

SKILL.md                        # Core skill — copy to ~/.claude/commands/sigrok.md
devices/
  sipeed-slogic16u3.md          # Device profile — copy to ~/.claude/commands/sigrok/
scripts/
  slogic.conf                   # USB device config (VID:PID, device name)
  slogic-attach                 # Bind + attach device to WSL via usbipd-win
  slogic-detach                 # Detach device from WSL back to Windows
sigrok-cli-full-reference.md    # Full sigrok-cli option reference (for humans)

Adding a new device

  1. Connect the device and run sigrok-cli -d <driver> --show to get capabilities
  2. Create a profile at devices/<device-name>.md (see devices/sipeed-slogic16u3.md as a template) with:
    • Driver name
    • Supported sample rates
    • Channel naming convention
    • Voltage threshold range
    • Trigger support
    • Known quirks
  3. Copy it to ~/.claude/commands/sigrok/
  4. Add a scan-match entry in SKILL.md under the "Detect device" workflow step

PRs with new device profiles are welcome!

Building sigrok from source

If your distro's sigrok-cli package doesn't include protocol decoders, build from source:

# Dependencies (Ubuntu/Debian)
sudo apt install build-essential autoconf automake libtool pkg-config \
  libglib2.0-dev python3-dev libusb-1.0-0-dev libzip-dev

# Build libsigrok
git clone git://sigrok.org/libsigrok
cd libsigrok && ./autogen.sh && ./configure && make -j$(nproc) && sudo make install
cd ..

# Build libsigrokdecode
git clone git://sigrok.org/libsigrokdecode
cd libsigrokdecode && ./autogen.sh && ./configure && make -j$(nproc) && sudo make install
cd ..

# Build sigrok-cli (will detect libsigrokdecode)
git clone git://sigrok.org/sigrok-cli
cd sigrok-cli && ./autogen.sh && ./configure && make -j$(nproc) && sudo make install
cd ..

sudo ldconfig

Verify: sigrok-cli --help | grep "\-P" should show protocol decoder flags.

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors

Languages