My agent.md to improve LLM-assisted code quality
In mid-2025, the reporter first attempted to utilize an LLM for coding, but was not satisfied with the results. The code produced did not even compile when working on libadbmdns, a Rust implementation of mDNS. In January 2026, the reporter revisited LLMs with better success. The model not only wrote a complex indexed-binary heap class but also identified an obscure bug in the polling crate due to the Windows IOCP implementation.
However, the code quality was poor, with no comments or structure, making it challenging to use LLMs for production-level work.
In March 2026, the reporter tried agentic IDEs like Antigravity and VS Code's Claude Code plugin. This allowed for iterative coding, and the reporter found themselves reviewing the code with suggestions such as avoiding magic numbers, adding comments, and using short function names. The code quality improved significantly, but the process was tedious, as the reporter had to repeat suggestions in each new session.
To fine-tune coding style preferences, the reporter placed a file named agent.md in the root of a project. This allowed the coding harness to load the file and inject it into the prompt. The reporter shared their version of agent.md as a starting point. Although this trick improved the generated code, LLMs still hallucinate and cannot be fully trusted, requiring constant verification and iteration.
The reporter still focuses on architecture and design rather than code style. The phenomenon of context dilution or attention dilution, where LLMs pay less attention to instructions in the middle of the context, can be minimized by asking the agent to update agent.md instead of opening an editor each time a new rule is added.
Written by urgent.news from Hacker News's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.