Phoenix `phx.new` generator and AGENTS.md

@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.

My initial shotgun all-over the place unorganized reactions:

  1. I like the idea of the community having a set of AI instructions that works well for elixir projects, which brings together experimentation from all parts of the community… As someone that just wants to “be productive” and doesn’t want to waste time “prompt engineering” an AGENTS.md file from my own frustrations… seeing what others have done/shared is nice.
  2. The merged AGENTS.md reads like an “Elixir + Phoenix + Ecto” best practices or a conventions document… Phoenix has great guides, Credo is like a best practice enforcer.
  3. Is the generator a place for this? Or would a separate community contributed “Phoenix AI Suggestions Package” (maybe credo?) that usage_rules uses to add to AGENTS.md be a better place?
  4. Is there a Phoenix project’s AI Policy, like Ash Framework: AI Policy - #6 by zachdaniel ?

I’m just curious about what the community thinks about elixir plus AI agents instructions in general.

AGENTS.md is for LLMs so I wouldn’t necessarily call it a best practice or convention doc, but there will of course be overlap. The goals with this are gap-filling for SOTA LLMs to supplement their “world knowledge” only, rather than an exhaustive set of guidelines (which exist as phoenix guides). Less capable models will need more gap filling, but also being less capable they will have less world knowledge and I haven’t yet seen lower tier/local models cross be able to really cross the gap regardless of context stuffing. On the other hand, most state of the art models are closely on par with one another gap wise. Surprisingly so even. You can shop the AGENTS.md around to gpt-4.1/claude/gemini 2.5 pro/grok4 and get more or less similar results.

The generator is indeed the place for this :slight_smile:

usage_rules is great, and zach is doing some great work there! It’s hard to beat a dependency free static file value wise at this point. As folks want to customize and extend their own rules they can bring in usage_rules to manage that process and aggregate their other deps that also provide rules. I don’t think credo makes sense at all in this flow. I do think that a mix task that aggregates AGENTS.md across your deps makes total sense, and it’s one thing that fell out of the Elixir contributors summit that Zach kindly took on the burden of running with. As the community standardizes on this stuff and libraries adopt AGENTS.md I could absolutely see deep integration with a mix task/lib out of the box, but in any case, the file must be there when you run phx.new, so even if we made it library generated, it would to be programmatically run inside phx.new to ensure it’s there out of the box.

Not at this time

2 Likes

Sounds like a great idea—we could start by implementing some kind of task. I actually have a couple of ideas we could use to create our own version.

I’m thinking we could begin with something pretty basic, maybe a Bash script that clones the project guide and installs it into your Phoenix project.

Also, here’s a source of inspiration we could look at: https://youtu.be/CTMyzeKKb0o

It already exists, and the Phoenix AGENTS.md will be compatible with the format. usage_rules v0.1.23 — Documentation

2 Likes

I think you were referring to something like this? Or was it something else?

I made a small Bash script that downloads all the guides into your project—you just need to be in your project directory and run the script.

1 Like