Skip to content

jguy/sigrok-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 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 130+ 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/skills/sigrok
cp SKILL.md ~/.claude/skills/sigrok/
cp -r devices scripts ~/.claude/skills/sigrok/

Installing as a skill (~/.claude/skills/sigrok/) rather than a slash command lets Claude Code discover it automatically: the skill's description is always visible to the model, so mentioning "logic analyzer" or "capture I2C" triggers it without an explicit command. It also keeps the device profiles and WSL scripts reachable via paths relative to the skill directory.

Verify

# Check device is detected
sigrok-cli --scan

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

Then in Claude Code, just ask about capturing signals — "capture 3 seconds of I2C on D0/D1" — and the skill triggers automatically.

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 of sigrok's protocol decoders — 130+ on current builds (CAN, FlexRay, USB, IR, RF, ARM debug, and more). Run sigrok-cli -L for the full list on your installation.

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.

Note: the first-time usbipd bind step requires an elevated (administrator) shell on Windows. Subsequent attaches don't.

Repository layout

SKILL.md                        # Core skill — copy to ~/.claude/skills/sigrok/
devices/
  sipeed-slogic16u3.md          # Device profile — ships inside the skill directory
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 (the skill matches sigrok-cli --scan output against each profile's Driver field, so this must be exact)
    • Supported sample rates
    • Channel naming convention
    • Voltage threshold range
    • Trigger support
    • Known quirks
  3. Copy it to ~/.claude/skills/sigrok/devices/

No SKILL.md edits needed — profiles are discovered dynamically.

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 — use the Sipeed fork: upstream libsigrok does NOT include
# the sipeed-slogic-analyzer driver needed for SLogic devices.
# (If you're using a different analyzer, upstream git://sigrok.org/libsigrok works.)
git clone https://github.com/sipeed/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

Packages

Contributors

Languages