logoalt Hacker News

kuczmamayesterday at 12:25 PM2 repliesview on HN

I'm curious as to what guardrails you've tried.

This is something I have been trying to get right as well. I've attempted to use lots of linting and things like strong typing, duplicate checks, cyclomatic complexity, and robust tests. However, I still happen to find issues, which requires me to look at the code (at least at a high level)

For example, I can say "Don't repeat yourself, and don't re-write helper functions" and I will even have a duplicate linter check, but inevitably the LLM will always want to re-write a similar yet slightly different helper function. Like it will always want to re-write something small like a trim() or a toString() function in every file.


Replies

bucket2015yesterday at 12:30 PM

I find that if I leave an instruction in AGENTS.md to "do not do X", there's a good chance the agent will forget it.

But if I add a separate post-implementation pass to "find and fix X" by the agent, it'll usually find and fix the issues.

So I've started doing it for everything from naming conventions to duplicate code to other problems. It does cost more tokens, but now I get less frustrated at having to fix basic issues in the PRs.

esprehnyesterday at 12:30 PM

Have you tried something like "Always consult the utils/ package before writing helper functions. When adding a new generic helper function justify it in your design or PR description."

I have better luck telling it positive things rather than lots of "never do X" style things.

show 1 reply