‹ BackHN Continuity

Thread

How to Write with an LLM

769 points · 420 comments · joeriddles

  1. semiquaver · · focus · HN ↗
    This would sound insane to me from two years ago but I have recently started insisting on writing all my own commit messages and pull request descriptions. I do usually have an agent review them for factual accuracy, but not rephrase them.

    It slows things down a bit, but in the best possible way. It has helped immensely to improve the depth of my understanding of the agent-generated code. When agents are doing everything its way too easy to “skim” diffs and not really absorb them.

    I always prided myself on my technical writing, and commit messages and PRs were a great place to hone that skill. I found that I missed it and my work is better now I’ve reclaimed that part of my old job back.

    1. LeafItAlone · · focus · HN ↗
      A big win of LLMs in my book is the absolute reduction of commit messages with just “fixes” or “updates”. Commit messages have become more meaningful and useful, even if far from perfect.

      We have one dev who uses LLMs to write the code, but still commits by hand. Most of his messages are of the type above, and none of them are useful.

      1. vova_hn2 · · focus · HN ↗
        I think that the idea of generating a commit message based on the content (diff) of the commit is fundamentally wrong.

        Even before coding harnesses become mainstream, a lot of tools offered to automatically generate commit messages based on the diff (I think JetBrains IDEs started to offer it very early) and I always cringed when I've seen it.

        The reason why I don't like diff-base commit messages is because they are redundant. If I want an LLM-generated summary of the diff, I can easily generate it myself, there is absolutely no reason to put it in the commit message.

        What I would like to see in the commit message is some additional context that is not a part of the diff. I don't need to read what has changed, because I can already can see it in the diff (or get an LLM to summarize it for me). But I often do need to understand why this change was made. What were they trying to achieve? That's the important part that is not contained in the diff itself. And this is the part that diff-base commits rarely contain.

        I think that even something simple like a link to a Jira (or other bugtracker ticket) is much more helpful than diff summary. Maybe instead of "fix" or "update" you could write just a couple of words about what are you trying to fix and why does it need updated. Still better, than a diff-summary.

        1. miki123211 · · focus · HN ↗
          This is why, if you have the agent generate the commit message at all, it has to be the same agent that wrote the code, in the same session.

          I usually have it lead with a paragraph or two of context on why the change was made (though I often use it as just a tool to turn my rambling on that question into proper English), followed by a couple paragraphs of "abstract" explaining the change (because an LLM-generated summary reviewed by the person who made the commit is better than something which the person reading can get themselves).

          1. adastra22 · · focus · HN ↗
            I don't see how that would improve the situation? If I do it with the same agent/same context, it tends to just report what it did. Which is the diff, repeated in prose.
            1. miki123211 · · focus · HN ↗
              The agent is usually told why it was making the change (I at least tend to start my prompts with a description of the problem we're solving), so, if prompted correctly, it can lead with "there was a bug, we root-caused it and here's what the root-cause was", then explain what the fix entailed.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.