Sexp

Parses, formats, and manipulates KiCad S-expressions via Python API.

3.6k|225|Updated Dec 19, 2023
One-click install
npx skills add https://github.com/atopile/atopile --skill sexp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Sexp
Source: https://github.com/atopile/atopile/tree/main/.claude/skills/sexp
Command: npx skills add https://github.com/atopile/atopile --skill sexp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a Zig-based S-expression engine and KiCad model bindings, exposing them to Python to enable seamless parsing, formatting, and manipulation of KiCad data within Python tooling.

Core Features & Use Cases

  • Fast Zig tokenizer, parser, and pretty-printer for S-expressions used in KiCad data.
  • Typed KiCad models exposed to Python via the pyzig_sexp extension, enabling Pythonic interaction with PCB, footprint, and schematic data.
  • Use Case: Automate validation and transformation of KiCad files in a Python workflow or integrate S-expression tooling into KiCad design pipelines.

Quick Start

from pathlib import Path from faebryk.libs.kicad.fileformats import kicad

pcb = kicad.loads(kicad.pcb.PcbFile, Path("board.kicad_pcb")) _text = kicad.dumps(pcb)

Frequently Asked Questions about Sexp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse and format KiCad S-expressions in Python?

Parse and format KiCad S-expressions in Python using the pyzig_sexp extension, which exposes a fast Zig tokenizer and pretty-printer to manipulate PCB and schematic data programmatically.

Can I automate KiCad file validation and editing using Python?

Automate KiCad file validation and editing using Python by loading typed KiCad models via the pyzig_sexp extension, manipulating the data, and dumping it back to the file format.

Does this S-expression tooling work with Zig and Python together?

The S-expression tooling works with Zig and Python together by implementing the core tokenizer, parser, and pretty-printer in Zig and exposing these capabilities through a Python extension API.

What is the best way to convert KiCad formats for automated design pipelines?

Convert KiCad formats for automated design pipelines using a typed KiCad model parser that loads schematic or PCB files and dumps them back consistently via Python.

Why use a Zig parser for KiCad S-expression data instead of pure Python?

Using a Zig parser for KiCad S-expression data provides fast tokenizing and pretty-printing performance while maintaining Pythonic interaction with the data through the Python extension API.