Agent instructions for working on Jig #
Design goals #
Always keep the following design goals and principles in mind when evaluating tradeoffs and decisions.
-
Performance and small resource footprint
Jig should consume as few system resources as possible. Avoid unnecessary memory allocations, optimize CPU bound sections, avoid doing work at runtime when it can be done at compile time.
-
Cross platform
Use conditional compilation with
comptimeto create generic cross platform interfaces. Use cross platformstdAPIs instead ofstd.corstd.posixwherever possible. -
Extensible
Jig has a small core that can be extended with Lua scripts. The core and UI communicate over a channel so that the core can run headless. The core sends UI events to attached UIs and the UI is responsible for rendering.
Behavior #
Write tests that test behavior and interfaces. Write tests first based on the requirements or specification, then prove that the test fails before writing the implementation.
Keep comments spare. Comments should never describe or narrate what code is doing, they should exist only to explain "why" when non-obvious. When you DO write comments, keep them BRIEF, FOCUSED, and free of jargon.
Doc comments are comments on public interfaces (functions, APIs, types, etc). Doc comments must describe BEHAVIOR and INTERFACES only, NOT implementation details. Use generic examples (if at all) in doc comments, do not couple doc comments to the implementation.
Zig #
Use Zig cross platform APIs and avoid std.posix and std.c. Use std.Io. Use comptime to do computation at compile time when possible.