brightball
I’ve been enjoying great results on my personal projects using AI tools with Elixir recently, thanks largely to the guardrails that are available to provide great structure to a developer. I wanted to share my current default precommit task and see if any of you have suggestions to improve it and/or for anyone else to use on their own projects.
My default stack at this point is Elixir, Phoenix, Ash, LiveView, PostgreSQL and TailwindCSS. I find that the structural consistency of Ash is an excellent guide for coding agents.
Anyway, here it is. Let me know if you have suggestions, thoughts or questions.
precommit: [
"compile --warnings-as-errors", # Fail compilation if any warnings exist
"deps.unlock --check-unused", # Fail if unused dependencies are unlocked
"deps.audit", # Scan dependencies for known security vulnerabilities
"cmd mix hex.audit", # Audit Hex packages for retired or vulnerable versions
"migrations.safety", # Check database migrations for unsafe operations
"format --check-formatted", # Verify code matches the formatter style
"credo --strict", # Run strict static code analysis checks
"sobelow --exit --threshold high --skip", # Fail on high-confidence security issues only
"ash.codegen --check", # Ensure Ash generated code is up to date
"usage_rules.sync --check", # Verify usage rules are synchronized
"cmd bun run lint", # If there's JS beyond LiveView
"test" # Run the full test suite
]
Trending in Dev Env & Tools
Curious whether anyone is taking any specific precautions, such as creating new non-administrative user-accounts and then simply copying ...
New
I’ve been enjoying great results on my personal projects using AI tools with Elixir recently, thanks largely to the guardrails that are a...
New
Other Trending Topics
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
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
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #performance










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
caleb-bb
I would add some more Credo checks. There are some custom ones here.
You should also look into the Boundary library for your projects.
I don’t see any Dialyzer here, either. I think that, if you’re spinning up a new PETAL stack application in this day and age, you should be rigorous about specs on everything and running Dialyzer. You should also think long and hard about your philosophy on specs. For my part, I define a custom type for every custom struct in my Elixir codebases and any function that takes/returns any custom struct must use the corresponding custom type in its spec. There are also important questions about how you handle specs for behaviours/callbacks, e.g. whether callbacks should have specs or just implementations or both and if so, how those should relate.
Look into PropEr or StreamData for property-based testing if you haven’t already. And make sure your agent contract enforces TDD discipline, i.e. failing tests first and property tests over normal ones.
brightball
I do use Boundary as well! It’s great.
I’ll look at the additional credo checks. That’s a good call out.
When it came to dialyzer I haven’t seen as much benefit since 1.20 with the addition of the compiler checks. It seemed like there was a lot of overlap there. You make strong points though, I’ll re-evaluate.
I’ll check on PropEr and StreamData.
Thank you!
brightball
I’m looking into both of these now and I’m curious if there’s a way to use them together? Particularly to cover this case…
It seems like automatically storing the failure from the stream as a counter-example would be a good idea (similar to how fuzz testers work when they identify data that causes a failure state).
EDIT: Update. I looked into this a little further. Ash actually already includes StreamData and apparently my AI was already using to generate some property tests that I didn’t know about yet. We’ll be doing more now!
srowley
I would love to hear yours/others’ tips for using Boundary. I use it and it is very helpful as a sort of tripwire to force the LLM to tell you it is going to do something not-smart, but I have found that LLMs don’t really get the concept that well and as often as not will try to talk me into working around it as opposed to designing more cleanly. If anyone has some tricks that help them get more out of it that would be interesting to hear.
caleb-bb
My experience using Boundary has been pretty seamless, but I also introduced Boundary fairly early in the current codebase I’m working on. Adding Boundary later on to something with some spaghetti already in it is a totally different challenge.
The way I see it, your app’s architecture should make Boundary basically unnecessary. The AI should, when it looks at the codebase, naturally build without breaking the hierarchy. Boundary itself shouldn’t have to really make this clear. Boundary is more like a tripwire, like you said.
So if the LLM keeps trying to work around Boundary, there’s likely something about your app’s architecture suggesting to the agent that it should do that. You ought to take a look at how your app is built and ask if there are places where kinks in the dependency chain are likely to arise.
Also, how consistently are you using it? Do you have Boundary applied evenly across your codebase? The idea is to define one big dependency graph that makes it obvious what depends on what. Does every module in your app have an obvious place in that graph, even if it doesn’t
use Boundary?If your agent keeps adding things to
depsandexportsthen a rule in your agent contract can help. Something like “Do not changedepsorexportslists for Boundary without human review”. If there’s anything worth human review in your. codebase, it’s this.