News for hackers. Stuff that matters.
Re:Writing documentation for AI: best practices by emil_sorensen on Wednesday June 18, 2025 @12:37PM (#44311346)
OP here. It's kind of ironic that making the docs AI-friendly essentially just ends up being what good documentation is in the first place (explicit context and hierarchy, self-contained sections, precise error messages).
Re:Writing documentation for AI: best practices by jilles on Wednesday June 18, 2025 @02:09PM (#44312049)
It's similar for writing code. Suddenly people are articulating their problems to the LLM and breaking it down in smaller sub-problems to solve....
Re:Writing documentation for AI: best practices by arscan on Wednesday June 18, 2025 @03:07PM (#44312491)
In other words, people are discovering the value of standard software engineering practices. Which, I think is a good thing.
Re:Writing documentation for AI: best practices by corysama on Wednesday June 18, 2025 @02:19PM (#44312116)
It has changed how I structure my code. Out of laziness, if I can write the code in such a way that each step follows naturally from what came before, "the code just writes itself!" Except now it's literally true :D
Re:Writing documentation for AI: best practices by appreciatorBus on Wednesday June 18, 2025 @07:40PM (#44314191)
Maybe everyone already discovered this but I find that if I include a lot of detail in my variables names, it's much more likely to autocomplete something useful. If whatever I typed was too verbose for my liking long term, I can always clean it up later with a rename.
Re:Writing documentation for AI: best practices by QRY on Wednesday June 18, 2025 @03:10PM (#44312512)
Thank you for sharing this, it's really helpful to have this as top-down learning resource.

I'm in the process of learning how to work with AI, and I've been homebrewing something similar with local semantic search for technical content (embedding models via Ollama, ChromaDB for indexing). I'm currently stuck at the step of making unstructured knowledge queryable, so these docs will come in handy for sure. Thanks again!

Re:Writing documentation for AI: best practices by bobbiechen on Wednesday June 18, 2025 @03:07PM (#44312486)
Related: "If an AI agent can't figure out how your API works, neither can your users" (from my employer's blog)

https://stytch.com/blog/if-an-ai-agent-cant-figure-out-how-y...

Re:Writing documentation for AI: best practices by thom on Wednesday June 18, 2025 @06:32PM (#44313848)
Yeah, I've started to think AI smoke tests for cognitive complexity should be a fundamental part of API/schema design now. Even if you think the LLMs are dumb, Stupidity as a Service is genuinely useful.
Re:Writing documentation for AI: best practices by truculent on Friday June 20, 2025 @12:25PM (#44329324)
Is this you have implemented in practice? Sounds like a great idea, but I have no idea how you would make it work it a structured way (or am I missing the point…?)
Re:Writing documentation for AI: best practices by thom on Friday June 20, 2025 @03:59PM (#44331457)
Can be easy depending on your setup - you can basically just write high level functional tests matching use cases of your API, but as prompts to a system with some sort of tool access, ideally MCP. You want to see those tests pass, but you want them to pass with the simplest possible prompt (a sort of regularization penalty, if you like). You can mutate the prompts using an LLM if you like to try different/shorter phrasings. The Pareto front of passing tests and prompt size/complexity is (arguably) how good a job you're doing structuring/documenting your API.
Re:Writing documentation for AI: best practices by truculent on Monday June 23, 2025 @07:02AM (#44354399)
Lovely idea - thanks
Re:Writing documentation for AI: best practices by Cthulhu_ on Thursday June 19, 2025 @05:40AM (#44316973)
It's a good tool to use for code reviewing, especially if you don't have peers with Strong Opinions on it.

Which is another issue, indifference. It's hard to find people that actually care about things like API design, let alone multiple that check each other's work. In my experience, a lot of the time people just get lazy and short-circuit the reviews to "oh he knows what he's doing, I'm sure he thought long and hard about this".

Re:Writing documentation for AI: best practices by esafak on Wednesday June 18, 2025 @12:41PM (#44311382)
Now people just have a better incentive :)
Re:Writing documentation for AI: best practices by mooreds on Wednesday June 18, 2025 @01:01PM (#44311546)
"GEO[0] has entered the chat."

We see a surprising number of folks who discover our product from GenAI solutions (self-reported). I'm not aware of any great tools that help you dissect this, but I'm sure someone is working on them.

0: Generative Engine Optimization

Re:Writing documentation for AI: best practices by nlawalker on Wednesday June 18, 2025 @04:25PM (#44313015)
Honest question - what do you mean? What's the better incentive?
Re:Writing documentation for AI: best practices by esafak on Wednesday June 18, 2025 @06:59PM (#44314002)
The documentation is now not just for other people, but for your own productivity. If it weren't for the LLM, you might not bother because the knowledge is in your memory. But the LLM does not have access to that yet :)
Re:Writing documentation for AI: best practices by shafyy on Wednesday June 18, 2025 @04:42PM (#44313118)
It's the same for SEO also. Good structure, correct use of HTML elements, quick loading, good accessibility, etc. Sure, there are "tricks" to improve your SEO, but the general principles are also good if you were not doing SEO.
Re:Writing documentation for AI: best practices by klysm on Thursday June 19, 2025 @04:22AM (#44316569)
And yet in practice SEO slop garbage is SEO slop garbage. Devoid of any real meaning or purpose other than to increase rankings and metrics. Nobody cares if it’s good or useful, but it must appease the algorithm!
Re:Writing documentation for AI: best practices by drusepth on Wednesday June 18, 2025 @06:30PM (#44313836)
This is also the hilarious part of "prompt engineering".

It's just effective linguistics and speech; what people have called "soft skills" forever is now, obviously, trying to be a science for some reason.

Re:Writing documentation for AI: best practices by ketzo on Wednesday June 18, 2025 @06:42PM (#44313914)
A really effective prompt is created by developing an accurate “mental model” of the model, understanding what tools it does and doesn’t have access to, what gives it effective direction and what leads it astray

Otherwise known as empathy

Re:Writing documentation for AI: best practices by Cthulhu_ on Thursday June 19, 2025 @05:44AM (#44317002)
It's a bit different though; the soft skills you mention are usually realtime or a chore that people don't like doing (writing down specifications / requirements), whereas "prompt engineering" puts people in their problem solving mental mode not dissimilar to writing code.

(assumption / personal theory)

Re:Writing documentation for AI: best practices by starkparker on Wednesday June 18, 2025 @09:01PM (#44314554)
From a docs-writing perspective, I've noticed that LLMs in their current state mostly solve the struggle of finding users who both want to participate in studies, are mostly literate, and are also fundamentally incompetent
Re:Writing documentation for AI: best practices by taneq on Thursday June 19, 2025 @12:53AM (#44315545)
Reminds me of that Asimov story where the main character was convinced that some public figure was a robot, and kept trying to prove it. Eventually they concluded that it was impossible to tell whether they were actually a robot "or merely a very good man."
Re:Writing documentation for AI: best practices by alganet on Thursday June 19, 2025 @03:34AM (#44316369)
I can divide the suggestions into two categories:

1. Stuff that W3C already researched and defined 20 years ago to make the web better. Acessibility, semantic simple HTML that works with no JS, standard formats. All the stuff most companies just plain ignored or sidelined.

2. Suggestions to workaround obvious limits on current LLM tech (context size, ambiguity, etc).

There's really nothing to talk about category 1, except that a lot of people already said this and they were practically mocked.

Regarding category 2, it's the first stage of AI failure acceptance. "Ok, it can't reliably reason on human content. But what if we make humans write more dumb instead?"

Re:Writing documentation for AI: best practices by troupo on Thursday June 19, 2025 @04:29AM (#44316604)
Also it makes it human-accessible, too. There are now projects converting Apple's JS-heavy documentation sites to markdown for AI consumption.