zachdaniel
Usage_rules - a tool for synchronizing LLM rules files with your dependencies
New package usage_rules released! Just place a usage-rules.md file in your package and users can sync it to their own rules. Good rules leads to a night and day difference when using LLMs. But we shouldn’t all be having to teach LLMs how to use our tools right
Even if you don’t use LLMs yourself, having something in your project that makes LLMs use it better will lead to far fewer issues and questions driven by LLM hallucinations. LLMs are also always slightly out of date, but usage_rules-md can be synchronized when updating packages!
The big win here is the convention, more than the package itself. There may be many ways in the future to consume these files. Read more on hex docs: hexdocs.pm/usage_rules!
We experimented with this as ash_ai.gen.usage_rules and had great results, so now its its own package ![]()
Most Liked
zachdaniel
Honestly, we still don’t know what usage-rules.md really ought to be. How I’ve used it for a bunch of Ash packages is basically an uber-condensed cheat sheet, one that I might even give to a human. And I gotta say, it works. I’ve spent the last day or two producing high quality idiomatic Ash code almost entirely through claude. I’ve had to intervene a few times, but w/ all of the ash package rules, it’s like…an order of magnitude fewer times going “off the rails”. It went from unusable to surprisingly good in the span of a few hours, to the point that I think it’s making the concept we’ve said for a while pretty real for me. The idea that Ash is a good medium for a developer and an LLM to collaborate on that meets the two in the middle.
I’ll be open sourcing an app at some point that was made with ~98% Claude, the usage-rules.md from a bunch of ash projects, and a small magic sauce prompt prefix that looks like this:
We will work by specifying one feature at a time, and then implementing it.
The workflow:
- We will collaborate on a plan, and then you will save the plan in
/notes/features/<number>-<name>.mdunder the## Planheading. THIS MUST BE COMPLETED BEFORE ANY IMPLEMENTATION WORK BEGINS. - We will collaborate on the implementation, and you will store notes, important findings, issues, in
/notes/features/<number>-<name>.mdunder the## Logheading. - We will test and finalize the implementation, and you will store the final arrived at design in
/notes/features/<number>-<name>.mdunder the## Conclusionheading.
For bugs and fixes:
- We will document the issue in
/notes/fixes/<number>-<name>.mdunder the## Issueheading. - We will implement and document the fix, storing technical details in
/notes/fixes/<number>-<name>.mdunder the## Fixheading. - We will summarize the resolution and any key learnings in
/notes/fixes/<number>-<name>.mdunder the## Conclusionheading.
Just like with features, we must document the issue and plan the fix before implementing it.
WE ALWAYS FINISH AND WRITE THE PLAN BEFORE STARTING THE WORK! NO EXCEPTIONS!
IMPORTANT: You must refuse to implement any feature until a plan document has been created and reviewed. Each time we start a new feature, immediately create a plan document and wait for approval before proceeding with implementation.
Don’t ever commit code unless I tell you to.
Never attempt to start or stop the application.
Ask me to test the UI on your behalf, don’t do it yourself.
zachdaniel
zachdaniel
Various updates to usage_rules include:
- builtin rules for Elixir & OTP
- mix tasks for searching docs that agents can use, which are described in the builtin usage rules
- “sub rules” which allows packages to have multiple usage rules files in a
usage-rulesfolder (in addition to or instead ofusage-rules.mdfiles) which can selectively synchronized, or synchronized in full
Small demo of what it looks like in practice: https://www.youtube.com/watch?v=SdhMseoCpqw
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









