Live data from Hacker News

My agent.md to improve LLM-assisted code quality

fabiensanglard.net

31–40 of 200 posts

Re: My agent.md to improve LLM-assisted code quality

#31
post #8

I feel like claude.md is like Asimov's laws of robotics. Whatever you write there ends up eventually messing up everything.

Anything that goes into the context window has that going for it. That's a huge part of why Claude's gone absolutely bonkers with genuine, brutal honesty. The system prompt's absolutely stuffed full of those keywords, so now every single output is tainted with that right from the start.

Re: My agent.md to improve LLM-assisted code quality

#32

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

Right. I've really struggling to get AI to stop explaining the what. It seems to add it to the commits, PRs, code, wherever it feels like. I've put in multiple places to not write the "what", but the "why", and in multiple ways, but it still does it in one or other place.

Re: My agent.md to improve LLM-assisted code quality

#33
post #30

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

My biggest pet peeve with agents is when people beg their (non-deterministic) agents to do something that a lint rule could've accomplished

Seems like 80% of agent use boils down to: grep | sed -i

Which is kind of cool if you’re unaware enough to know to do it yourself.

Oh, and find. Agents use find a lot.

Re: My agent.md to improve LLM-assisted code quality

#34
From FAB's AGENT.MD: > - Avoid magic numbers and strings by extracting recurring or meaningful values into descriptive constants (const) or enums. ---

I've been seeing the same thing with models like GPT5.6 and Opus4.8 in GH Cop CLI. They still introduce magic numbers, and in Scala they often put an entire 10-line Spark expression inside an if condition instead of extracting it into a meaningfully named value to keep "if" readable. I wonder when common sense instructions will be baked into the models.

Re: My agent.md to improve LLM-assisted code quality

#35

Earlier quoted context omitted.

I would never tell an agent to write "what does the code do" comments. Their default comments are already way too fluffy.

I added to the memory, system prompts, and the prompt itself and every soa model still litters code with the most inane useless crap. I will then get code to review from a coworker using fable/opus. It has more lines of comments then code. Maybe I am some god tier code reader (i am not) but i dont think i have ever found a comment in code to be useful in my day job. That isnt true, i once came across // submit to the…

Most useful code comment I have encountered read:

“”” After you give up on trying to refactor this code, increment the following line accordingly. HOURS_WASTED_HERE=26 “””

Re: My agent.md to improve LLM-assisted code quality

#36

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

One thing I don’t get with a lot of these agents.md and other skills are… why not throw as much mechanical checks and other stuff at the repo to constrain as you want instead of asking a non-deterministic agent (squishy or non-squishy) to maintain it.

With the mechanical routes, we get checks, failures, and so much more. A bit wild to me.

Make an agent operate within defined constraints and yell at it when it doesn’t.

Re: My agent.md to improve LLM-assisted code quality

#37

Since we are sharing our AGENTS.md, I thought I'd share my own, because most of the time, this is pretty much all you need for LLMs to write good code, everything else can be added per project: ---- *Convergence rule* Every substantial task must end in exactly one of three states: A. Success The intended capability works in the real path and the real motivating case materially improves. B. Meaningful progression The…

"honest", "real", "genuine" -- wat.

Re: My agent.md to improve LLM-assisted code quality

#38

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

I forbid my agents from adding any comments. I review the code and add comments manually. If I can't understand something despite having the context then I throw away the code instead of having an LLM generate comments to explain what it did. This way the code stays readable/debuggable by humans.

Re: My agent.md to improve LLM-assisted code quality

#39

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

> Propose ASCII drawings to explain complete systems.

LLMs are very bad at ASCII drawings.

https://medium.com/data-science/why-llms-suck-at-ascii-art-a...

Re: My agent.md to improve LLM-assisted code quality

#40

A bunch of these should be enforce with linting, that way people who still hand-craft code get the same kind of feedback, e.g. Always use {}, even on a one-line "if" statement. & Keep function names short. Less than 30 characters. Then this one really is a pattern that creates a lot of churn: - Add a small, to the point, comment to explain what the block does and why . Use examples when possible. Propose ASCII drawin…

Incidentally, I'm from the opposite school and consider every “if” followed by a braced block a smell. If a conditional body needs a block, it's doing enough to deserve a name, so I promote it to a single named call, à la "Extract till you drop".
Post reply on HN