The title speaks for itself – just trying to get the best possible Zig setup within Cursor/Cline so I can put in best practises
Thank you
The title speaks for itself – just trying to get the best possible Zig setup within Cursor/Cline so I can put in best practises
Thank you
Does no-one use Zig with Cursor or Cline?
AI is extremely BAD and WRONG with Zig.
Please don’t do it.
Given this new world/new environment that we’re in I would say that’s not how you grow the language for further reach…just saying…
I’ve used it in Cursor and Cline and its worked well – I just need better defaults
They aren’t saying AI bad.
The language changes, ofc AI won’t be good at zig, it will have been trained on old information.
My opinions aside… I don’t use Cursor or Cline, so I can’t help that much, but I did find some rule files on GitHub: https://github.com/search?q=path:/\.(cline|cursor)rules|\.cursor\/rules/+/\bZig\b/&type=code. Most of them aren’t very good though :/
One of them contains small amounts of Zig programming advice, but it’s primarily focused on creating web APIs and servers. Also, Zig 0.13.0 doesn’t have language-level async features, so I’m not sure why the rules say to “utilize Zig’s … async capabilities”.
This one barely touches on best practices. The lists are (reasonably enough) labeled “preferences”, although the naming conventions are nearly universal, and Zig generally encourages robust error handling.
So much for “thorough”, but that’s all I have… Maybe you can reach out on the Zig Discord server?
I do think the Zig ‘philosophy’ is hostile to AI-based workflows. It’s a language that’s not shy about making your workflow less convenient if it means nudging you towards writing (sometimes marginally) better code.
See for example the rather livid discussion under compile errors for unused things.
I don’t think that makes it hostile to AI, I think the main problem with AI is that it is rarely trained on a data set that is specifically tuned for Zig usage and additionally it would need some knowledge about different Zig versions so that it doesn’t mix up different versions together.
With languages that have huge sets of example programs and are in a later development cycle (where more programs are compatible across multiple versions) there is less of a need to manually curate a good training data set, thus for those languages lazy/naive approaches to training a model, deliver good enough results.
If anything, giving specific errors should make it easier for an AI to figure out how to generate programs, because it could use reinforcement learning, but that would require that the training program actually tries to compile the code, which most large language models probably never even attempt.
An AI that is purely trained on how most programming languages do it, will be bad for Zig, because Zig does some things in ways that aren’t common and for those things it would need some kind of training/specializing.
I would argue that with javascript it is way more difficult to learn how to write a good program, because a lot more garbage programs are syntactically valid in the language, the difference is just that there is a lot more human written code for javascript that can be used as training data.
So yeah maybe it doesn’t directly support AI solutions that make zero effort trying to understand what they actually generate and use some tools adapted to the language, for example they could use a tool that automatically fixes unused variable errors like zls with autofix configured.
Anthropic’s Claude Sonnet-3.5v2 is better for Zig than any ChatGPT model I tried (o1, 4o).