ecto icon indicating copy to clipboard operation
ecto copied to clipboard

Added a new usage-rules.md markdown document containing general rules…

Open pcharbon70 opened this issue 4 months ago • 3 comments

Purpose: Help coding agents understand the Ecto library and generate more accurate code following the established patterns and anti-patterns.

UsageRules is a development tool for Elixir projects that:

  • helps gather and consolidate usage rules from dependencies to provide to LLM agents via mix usage_rules.sync
  • provides pre-built usage rules for Elixir
  • provides a powerful documentation search task for hexdocs with mix usage_rules.search_docs

pcharbon70 avatar Aug 21 '25 17:08 pcharbon70

Thank you! This is a good beginning but I think it is too extensive. The models already know Ecto quite a bit, so I don't think our usage rules should go over API usage like upserts and similar. We should mostly focus on: security, new APIs (such as Repo.transact), and fixing bad practices/common mistakes LLMs may commit.

josevalim avatar Aug 21 '25 19:08 josevalim

I'd also suggest removing the "LLM" verbiage. I've seen no evidence that writing these docs as if you're writing it to or about an LLM has any positive impact. It's just "the usage rules" which are a condensed documentation with a target audience of an LLM.

zachdaniel avatar Aug 21 '25 21:08 zachdaniel

I have slimmed down the usage_rules.md and tried to keep only the essential. I have not used the Transact API extensively so I suggest reviewing that part. I added some of the suggested DO NOT rules where I could express them.

pcharbon70 avatar Aug 26 '25 12:08 pcharbon70