Recreate KiCad parsing library "kicad-skip"
I'd like to create a Typescript version of this library:
https://www.youtube.com/watch?v=EP1GtsZ2VfM
We can use it as a foundation to build a new tscircuit <> KiCad Importer/Exporter
As we learned with the DSN Converter, it's important to have a really clean architecture for these libraries, not AI-generated slop code (AI can work inside a good architecture, but it often doesn't architect well)
I think we can define a "class-based" system and mostly use a similar API of kicad-skip, that way there's less arguing about the API
This project is very valuable and will open a lot of bounties, but needs to be architected.
CC @Rishabh @shibo @Anas @Abse @Cascaderay @Niharika for thoughts
Psychogenic Technologies
YouTube
Kicad schematics and PCB Python scripting
Not just for layout anymore! Kicad schems can be easily edited or generated with this open source Python library, and I'll be doing both through the course of this short tutorial, including creating a simple LED grid design generator, to demonstrate some possibilities.
The skip modules are designed to parse the kicad s-expression source files a...

12 Replies
We already have a AI-generated somewhat sloppy project here: https://github.com/tscircuit/kicad-converter/tree/main
But I think like the DSN converter, it's quite hacky with long single files and no classes. I'm not a huge class guy but sometimes when you're parsing these formats it fits very naturally with classes.
Moreover, I'm not completely sure we want to always go from kicad -> circuit json, we might want to go from kicad directly to tscircuit core. So it'd be useful to have something that is very good and just parsing and manipulating kicad.
GitHub
GitHub - tscircuit/kicad-converter
Contribute to tscircuit/kicad-converter development by creating an account on GitHub.
This is quite interesting, specially the idea going directly from kicad to core. As experienced with dsn-converter where the code is hacky and messy with circuit json. If possible going to and fro directly from core would be quite a neat approach
100%, also separating the S-Expression -> Class into it's own dedicated library/test suite to avoid having too many converters in the same place. The most annoying thing about not having circuit json is you don't get to do snapshot testing easily, but i think we may be able to work around that
I think there will be some way to get around that, given that we can convert the kicad to our core specifics then we can easily generate the circuit json needed for snapshot testing
yes i agree we could do that, but I think it might be simpler to have a library that replicates the library in the youtube video without having any tscircuit-specific code in it. This way we wouldn't have the additional complexity of converting to tscircuit inside the library.
so i'm suggesting we have two libraries:
* @tscircuit/kicad
* @tscircuit/kicad-to-tscircuit
Something like that
So the @tscircuit/kicad libaray will be converting the S-Expression to Classes which are used in core, right?
No, we'd be replicating the functionality of the youtube video inside @tscircuit/kicad. It would probably not need any tscircuit imports.
@tscircuit/kicad-to-tscircuit
would use @tscircuit/kicad and @tscircuit/coreI see, makes sense now
we'd need new classes in @tscircuit/kicad to create the functionality
So, first we will be creating a libaray similar to skip just for typescript and then will later use that for tscircuit
yep!
Something like this:
So we could use classes to make sure that we have really detailed/useful object representations
as opposed to interfaces in DSN converter which were a bit tricky to work with
Gotcha!