zachdaniel
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 ![]()
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sodapopcan
Since this includes the caveat of “even if you don’t use LLMs,” are “usage rules” plain English phrases like Please don’t friggin’ comment
# arrange, act, assertevery time you write a test. Thanks!(*)? I by no means think it’s the job of this package to explain this in its docs, I’m just asking as a slow-to-the-party Elixir Forum user realizing I need to understand this stuff or fulfill alternate dream of being a crossing guard (I’m in the market for a golden stop sign if anyone has any leads).(*) “friggin’” is optional but helps the robots know you really care about this—I wouldn’t dare not say “please” and “thank you” though.
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.mdfrom 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:
/notes/features/<number>-<name>.mdunder the## Planheading. THIS MUST BE COMPLETED BEFORE ANY IMPLEMENTATION WORK BEGINS./notes/features/<number>-<name>.mdunder the## Logheading./notes/features/<number>-<name>.mdunder the## Conclusionheading.For bugs and fixes:
/notes/fixes/<number>-<name>.mdunder the## Issueheading./notes/fixes/<number>-<name>.mdunder the## Fixheading./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.
sevenseacat
I’ve been testing that rules file
and it’s pretty useful!
It also allows the LLM to restart and resume the implementation process after its written the plan, useful for when Claude starts being like
E_TOO_MANY_TOKENS!!.sodapopcan
Wow, thanks for the detailed answer and sample! This is indeed inline with what my buddy was showing with his Cursor usage. Just finished watching Chris’ keynote and guess it’s time to bite the bullet here.
alexslade
@zachdaniel What’s your workflow for using the output? I’m currently copying the contents to a claude.md config AND a cursor rules file (I use both tools). Feels clumsy though, I assume there are better ways.
zachdaniel
I sync it directly to the file in question. i.e
mix usage_rules.sync CLAUDE.md --all --sync.zachdaniel
I’m working on a new addition currently which will sync each package’s package rules to a folder and link to them using
@folder/package.mdstyle syntax, which should help with too many tokens being used.zachdaniel
zachdaniel
Various updates to usage_rules include:
usage-rulesfolder (in addition to or instead ofusage-rules.mdfiles) which can selectively synchronized, or synchronized in fullSmall demo of what it looks like in practice: https://www.youtube.com/watch?v=SdhMseoCpqw
ivanminutillo
I wonder if it would be interesting to coordinate a community effort to make a PR to a list of most commons/used/preferred elixir libraries to add a usage-rules.md to each of them to push its adoption…
I’ve started adding usage-rules and I’m very intrigued by its potential, especially if combined with custom sub-agents that are highly specialised in narrow tasks (eg ecto agent, graphql agent, testing agent, liveview etc etc)