Recently, I've been trying to shape the cli arguments of a tool I'm building in Zig to fit zli and zig-cli.

It's not the first time. cobra has its own opinions in Go, clap in Rust, docopt in Python, and so on.

One library doesn't support repeated arguments.
Another doesn't allow ordering the args alphabetically in help.
This one doesn't support arguments with optional values.
That one has a small UI bug.
Another won't fold long descriptions.

I kept adding small hacks to bring the implementation closer to what I had in mind, but a) it was not 100% there, and b) it felt like a hack.

Writing a cli parser is not rocket science. A coding agent like codex or claude can definitely do it, as long as you provide it with clear specs. Which is what I did, since I already had a lot of boilerplate code.

Twenty minutes later, everything works exactly the way I want it to work, and now I can tweak it at will, and re-implement it in the next project, regardless of the language used.


A library of agent specs

Instead of rediscovering the requirements every time, I put them down in a form that AI agents can use.

That's the idea behind github.com/vrypan/agent-specs. It will probably become a small collection of specifications designed to be used by agents.

One can think of it as a higher-level code library. Instead of the language-level import/include/use, you have a spec for an agent.

> Implement cli arguments and options according to specs/cli/CLI.md.

Each section of CLI.md has an identifier, like CMD-SUBCOMMANDS, FLAGS-SHORT-VALUES and OPT-COLOR. This makes it easy to tell the agent, use this, don't implement this, override that. There are also test cases, to help the agent test the implementation.

So, you could also ask something like this

> Use specs/cli/CLI.md as the CLI parser specification.
Implement all required sections.
Do not implement OPT-COLOR.
Translate specs/cli/tests.yaml into automated tests.
Report any deviations.