So, I feel like "Docs-as-Code" has some context I'm missing, so I'm going to comment on docs in general.<p>I think there multiple kinds of docs for software.<p>* Comments explaining a specific section of code.<p>* API docs describing functions/classes/etc.<p>* Docs on how to use a library/class/etc. Usually including simple, isolated, examples.<p>* Tutorials on how to create simplified applications using the developed tools.<p>* Docs on how to deploy, configure, and maintain an application.<p>* Docs on how to use an application.<p>* Docs on how to troubleshoot an application.<p>* Docs on how to integrate applications.<p>* And likely others I'm missing.<p>Personally, I've been seriously frustrated by how bad most of the open source (haven't done much with proprietary code) documentation is. Case in point is Drupal and Symfony. Trying to use api.drupal.org is not fun, and Symfony's docs always cover the basics, and then there's nothing on pulling everything together into something complicated. So you try to dig into the actual code, and end up finding multiple layers of uncommented abstractions. Yes, I can eventually figure out what is going on if I put the effort in, but that's a lot of time that could be save by a few lines of comments.<p>I usually end up asking JetBrains AI about what I need, then use what it says after I fix the errors it makes... It's also very good at summarizing everything I'd find if I used a normal search. But that all only works if others have already asked and answered my questions.<p>Some things I've been trying to do to improve my own code's documentation:<p>* Unless the line is super obvious, even if I think it is obvious, I try to leave a comment. Yes, it seems pointless, but I have gone back to old code I remember being obvious without said comment enough times that I think it is worth it.<p>* Avoiding "elegance" in favor of "explicitness". For example, I use full `if` statements instead of ternary operators even when ternary operators would look better. For whatever reason the syntax of ternary operators has never sunk in for me, and the explicitness of `if` is much easier to parse. I also use very descriptive function and variable names. Basically, if I have to think about what something means, I try to change it so I don't have to.<p>* Split out functions into smaller functions as much as I can't. This means I can use descriptive function names. And I'm pretty sure it's just good practice.<p>I also have been trying to figure out ways to keep higher level docs closer to my code. I have some ideas, but haven't tried them yet. Has anyone ever written something that detects changes to a method/function, and then when you save your file it pops up asking if related docs need updating? Maybe add comments to the method pointing to where related docs live, and then your IDE/tool uses that to know what docs need updating?