ryanzidago
Up until then, I found it very hard to communicate to LLMs that I specifically do not want to handle X case because maybe it has never happened on production so far and I’d rather move on to other higher priority tasks.
I could agree with this in one session but the next will forget, and the automated code review LLM will flag my PR …
I know this may be VERY obvious to some but only recently I realised that you can use Doctests to document the cases that your code won’t handle.
Trending in Blog Posts
Up until then, I found it very hard to communicate to LLMs that I specifically do not want to handle X case because maybe it has never ha...
New
An automated trigger fired every two minutes for 8 hours. 243 agent runs. 31M tokens. $63 wasted. The problem: nobody noticed until morni...
New
TL;DR: Give https://cure-lang.org a try—perhaps you will like it.
New
I finally found time to write down my journey away from ExMachina, including the workaround I tried first and the API experiments that fo...
New
The words are insufficient to describe what transpired. What we tried to do met what the people wanted it to be. It became beautiful.
Th...
New
Hi all,
I’ve built a small demo app to understand what an “AI agent” actually is under the hood, and to show it with Elixir’s own tools ...
New
A backtest worker and a live trading node had to share one broker rate limit and one set of OAuth tokens, and both only work if there’s e...
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
- #metaprogramming










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
udoschneider
I can fully relate to this one.
The project I’m working on right now includes complete documentation, plus the thought and backlog workflows in the repo. Being heavily AI-assisted, I found this a good way to make sure that the LLM has access to thoughts/backlogs as well as the “design” and “thoughts” which are not directly code but still shape the way the product behaves and should develop.
I have to admit that, in this sense, I no longer differentiate between code and documentation - both help the LLM understand the lay of the land. E.g. I have several doc gates as well - the simplest one being public function documentation being at 100%. Another “simple” thing I try to enforce is pushing the LLM to document why something is implemented the way it is, rather than how.
ryanzidago
Yes exactly, couldn’t agree more!
karlosmid
Hi, I totally agree. Related to documentation, in docs we always put the how. But why this code exists is also important question!
udoschneider
I didn’t necessarily mean why it exists. More like why it’s implemented this way and not another. Things that are hard to deduce just by looking at how the code works.
dimitarvp
Maybe I am misunderstanding the article and the comments here but I have found LLM-generated code comments to be a huge liability. In a team of just a few devs which use LLMs every day, heavily, they get outdated literally three days later in the best-case scenario.
What is being described in the article seems like a fragmented product spec to me, put right inside the code. It’s an interesting idea but I am guessing that it highly depends on the LLM you are using on whether it reads that or tries to find docs another place first.
Have you had improved success and less LLM turns the way you are proposing in the article, @ryanzidago?
ryanzidago
Hey @dimitarvp,
In the article (and professionnally) I do not use of any code comments, I use
doctestsandmoduledoc.I use doctests to document a case what I do not want to handle right now, the doctest itself will fail loudly as soon as the edge case is fixed (which is the behaviour that I want).
So I guess I could return the question back to you, what do you suggest to use when we do not want to handle an edge case? How can we communicate these decisions to LLMs beyond the sessions during which we’ve made these decisions?
To me
doctestsseems the best compromise for that (they allow me to use prose to explains stuff AND I can encode assertions that fail loudly when they aren’t true anymore); though I’m very happy to hear from how other teams are handling those cases!I use moduledoc to document the high level product and business processes that are less likely to go stale any time soon. Look at how the moduledoc does not contain:
Of course you could have a separate .md file, a separate skill, but to me, putting those high level product processes near where they matter most seems also the best compromise.
I have to be honest too, I do not have empirical evidence or benchmark that this drastically improves LLMs ability to recall the correct rules when doing something. I only have a preference, an educated guess / gut feeling.
udoschneider
Doctests are indeed very helpful.
WRT comments going stale: Yes, that’s a real risk, and doctests do help mitigate it. I’ve also had very good experiences with doc gates—for example, holding documentation to the same standard as the code itself. Incorrect comments should be treated as build failures, just like broken code. In my case, though, this means I spend quite a lot of tokens on each gate run to make sure the docs are still correct. But I think the risk of documentation drifting is too high to ignore, since it can quickly undermine LLMs’ ability to add new code correctly.
dimitarvp
Thanks for the clarification.
Moduledocs are kind of code comments anyway IMO but I do get your point: they are a better target. Random code comments are indeed much easier to go stale. Claude Fable is doing a bang-up job of auto-updating moduledocs for me, but that might be because me & it spent a lot of time together and probably at one point I told it “always maintain moduledocs” and it just started doing it. Not sure at this point.
Doctests are indeed a good way and they are something I plan to use more going forward, supposedly, however most of our tests are integration-level and the unit tests are also complemented by property tests so still not sure how I’d slot them in.
Again, thank you. Good ideas to think about.
dimitarvp
Full agreement, it’s just that in my observation even an excellent model like Claude Fable still forgets to do it and I am not sure I want to spend as much time to craft more skills, more prompts, or even tooling (though Fable is very capable). Me and my team moved all documentation to a bunch of topical Markdown files and Fable is doing very well at updating them when the code changes; I barely had to do anything more than just tell it to remember to maintain them.