The other AI coding thread got closed post haste, but maybe there’s room to discuss how AI would better work with Zig and maybe people have ideas about this?
I love Zig but am forced to take long breaks due to customer projects in other languages and other commitments. During breaks the language often changes a lot and I’d like to use AI to get back into a Zig mindset when prototyping a new idea, or to deal with new issues in my own code after a version upgrade while trying to keep the project afloat and avoid accumulating legacy issues over time.
I get that core devs and many people continuously working with Zig consider AI a waste of time. It can’t produce sufficient quality and Zig is about code crafted with love and thought. AI has a tendency to generate slop inspired by existing code and solutions of variable quality, while Zig is about breaking new ground that AI has never seen or been trained on.
That said, I do benefit from AI a lot in my consulting work, speeding up learning new tools, reviewing code from another POV or approaching research papers through examples tailored to my use case. It also helps in a very limited way every time I want to get back to Zig.
Just now I learned that a popular JavaScript framework called Svelte has published documentation specifically to be consumed by AI / LLM:
https://svelte.dev/docs/llms
It has a particular writing style often seen in AI prompts, leaked or otherwise, and could serve to steer the model away from outdated syntax learned from countless legacy examples. Would that kind of documentation, if maintained and fed to AI prompts or local rules files, help new users approach the latest release through tailored examples and answers to newbie questions that are more likely to compile?
I’m sort of interested to learn about AI prompt design for coding. It seems to be maturing into best practices usable across different LLM models. Improving LLM reliability in successfully producing working Zig code seems like an interesting application, but I really won’t have time to produce something very broad not to mention maintain it, since I’m just now looking at Zig again after a 6-month break. Continued maintenance of the AI rules/documentation after each release would be their whole point and best handled by people who actually enjoy using such tools. Does anyone have thoughts or experience about these things?
I asked ChatGPT about an example rules file (also using the entire text above as a prompt). It thought 0.13 is newest. Details are irrelevant but I thought the structure, style and topics are interesting. Overall content illustrates its current understanding of contemporary Zig and issues with AI:
https://gist.github.com/jjrv/2cecbf9700f490075773b9f220e5ed51