{"id":30,"date":"2024-11-21T20:56:17","date_gmt":"2024-11-21T20:56:17","guid":{"rendered":"https:\/\/codegenblog.kinsta.cloud\/?p=30"},"modified":"2025-07-17T03:13:29","modified_gmt":"2025-07-17T03:13:29","slug":"your-ai-is-writing-bad-docs-because-it-lacks-context","status":"publish","type":"post","link":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/","title":{"rendered":"Your AI Is Writing Bad Docs Because It Lacks Context"},"content":{"rendered":"\n<p><strong>It\u2019s a truth universally acknowledged: every engineering team wrestles with the problem of documentation.<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>\u201cOur documentation sucks!\u201d<\/em><\/li>\n\n\n\n<li><em>\u201cBut our codebase changes so fast\u2014why waste time documenting it?\u201d<\/em><\/li>\n\n\n\n<li><em>&lt;irritating acute voice&gt; \u201cActually, my<\/em>&nbsp;<em>code is self-documenting.\u201d &lt;\/irritating acute voice&gt;<\/em><\/li>\n<\/ul>\n\n\n\n<p>So it goes.<\/p>\n\n\n\n<p>Obviously, AI can help document your code. But only if you use it strategically.<\/p>\n\n\n\n<p>At one extreme, you hand over your Github repo to an LLM and find that it\u2019s added a long docstring on top of every function, full of the sort of vapid vague text that LLMs love to generate.<\/p>\n\n\n\n<p>On another extreme, the status quo: documentation that\u2019s sparse, time-consuming, and quickly outdated.<\/p>\n\n\n\n<p>Ideally we want documentation that\u2019s both&nbsp;<em>useful<\/em>&nbsp;and&nbsp;<em>maintainable.<\/em>&nbsp;And, for the first time in history, you can accomplish this effortlessly\u2014by leveraging a combination of AI and static code analysis tools.<\/p>\n\n\n\n<p><strong>Here\u2019s how AI and static analysis can transform your documentation workflow.<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-1-cut-out-the-fluff\"><strong>1. Cut out the fluff<\/strong><\/h4>\n\n\n\n<p>If you just feed a function into an LLM and ask it to write some documentation, the LLM will probably generate something very annoying to read.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1486\" height=\"1242\" src=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\" alt=\"\" class=\"wp-image-41\" srcset=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp 1486w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1-300x251.webp 300w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1-1024x856.webp 1024w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1-768x642.webp 768w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1-710x593.webp 710w\" sizes=\"(max-width: 1486px) 100vw, 1486px\" \/><figcaption class=\"wp-element-caption\">A nightmare example of a ChatGPT-generated docstring that bloats the codebase with useless fluff.<\/figcaption><\/figure>\n\n\n\n<p>Good documentation in a codebase should be specific. It should highlight any weird exceptions or edge cases about the function or module. It should contain examples of how it is used, if and only if it\u2019s not obvious.<\/p>\n\n\n\n<p>The thing is: LLMs&nbsp;<em>are capable<\/em>&nbsp;of generating actual good documentation. You just need to give it enough context about your function or module, and how it\u2019s used in the codebase.<\/p>\n\n\n\n<p>That\u2019s where static analysis comes in. Tools like Codegen analyze your codebase first to understand how functions and modules depend on each other. Then, Codegen can use bi-directional usages to inform the documentation\u2014i.e., include the places the function being documented is called, as well as the whole chain of functions it calls, in the prompt for the LLM. That allows the LLM to produce a more informed docstring than it would from just the source code alone.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1280\" height=\"1032\" src=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2.webp\" alt=\"\" class=\"wp-image-40\" srcset=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2.webp 1280w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2-300x242.webp 300w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2-1024x826.webp 1024w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2-768x619.webp 768w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d9619946d_674f6d7d75b31c3099a5499f_674e0b2441a7956c51ec3ad7_code2-710x572.webp 710w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><figcaption class=\"wp-element-caption\">A Codegen-generated graph of the report_install_progress function\u2019s bidirectional usages. In yellow are all functions that call report_install_progress; in green are all functions that it calls. Given this context, the LLM can understand the function much better. As linguist J. R. Firth said: \u201cYou shall know a word [or a function!] by the company it keeps.\u201d<\/figcaption><\/figure>\n\n\n\n<p>With the help of some static analysis, Codegen can give an LLM the context it needs to generate helpful, no-BS documentation.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1494\" height=\"412\" src=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3.webp\" alt=\"\" class=\"wp-image-38\" srcset=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3.webp 1494w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3-300x83.webp 300w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3-1024x282.webp 1024w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3-768x212.webp 768w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993b1_674e11854fa33a06c22b9bc2_674e1179b42d763df6838c8b_code3-710x196.webp 710w\" sizes=\"(max-width: 1494px) 100vw, 1494px\" \/><figcaption class=\"wp-element-caption\">An example of a context-aware docstring, written by Codegen&#8217;s AI&nbsp;assistant, in the Codegen source code.<\/figcaption><\/figure>\n\n\n\n<p>So: static analysis is pretty good for helping AI document functions and modules.<\/p>\n\n\n\n<p>But the best documentation\u2014especially for complex services, modules, or even large PRs\u2014should provide context that&nbsp;<em>isn\u2019t captured in the code alone<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1188\" height=\"516\" src=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4.webp\" alt=\"\" class=\"wp-image-39\" srcset=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4.webp 1188w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4-300x130.webp 300w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4-1024x445.webp 1024w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4-768x334.webp 768w, https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d961993cd_674e1257e6780e78485c67b1_674e11b68f8d06b8c36db5d8_code4-710x308.webp 710w\" sizes=\"(max-width: 1188px) 100vw, 1188px\" \/><figcaption class=\"wp-element-caption\"><a href=\"https:\/\/twitter.com\/charliermarsh\/status\/1859416114712711518\">As many engineers have noted<\/a>, it is not useful to simply feed ChatGPT&nbsp;a function or a diff and make it generate docs.<\/figcaption><\/figure>\n\n\n\n<p>A future evolution of Codegen might feed the LLM even more context by integrating data sources like Slack threads or Notion design docs.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-2-be-strategic-about-the-level-of-detail\"><strong>2. Be strategic about the level of detail<\/strong><\/h4>\n\n\n\n<p>Not every function deserves a detailed docstring. You should prioritize writing detailed, comprehensive documentation only in the areas where it delivers the most value.<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Code that is touched by multiple teams \u2014 e.g. backend endpoints that are called by frontend developers.<\/li>\n\n\n\n<li>External-facing APIs or SDKs where clear explanations are critical for consumers.<\/li>\n<\/ul>\n\n\n\n<p>Again through static analysis, tools like Codegen can identify which areas of the codebase are most trafficked, and highlight which functions are actually used outside of a module (versus only used inside the module)\u2014and make sure to add extra detail only to those key areas.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-3-dynamically-update-documentation\"><strong>3. Dynamically update documentation<\/strong><\/h4>\n\n\n\n<p>Great, now you have all this highly-nuanced, context-aware documentation\u2026 but\u2026 what do you do when the code inevitably changes? In the example above: maybe you modify the format of the string that&nbsp;<code>codemodFactToString<\/code>&nbsp;returns. Are you really going to check the docstrings for all 12 functions that reference&nbsp;<code>codemodFactToString<\/code>, to make sure they\u2019re still up-to-date?<\/p>\n\n\n\n<p>Instead, with a tool like Codegen, you can imagine creating a lint rule to make the AI update all relevant documentation every time a PR is created, so that your docs are updated in lockstep with your code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-looking-ahead\">Looking ahead<\/h3>\n\n\n\n<p>Good documentation will be increasingly important as humans and AI agents collaborate on writing code.<\/p>\n\n\n\n<p>In a pre-AI world, it was still feasible for a few engineers to intimately understand a codebase without needing much documentation. But as we increasingly bring in AI agents to help write parts of the code, it won\u2019t be so easy anymore to keep track of exactly what\u2019s going on. In a world where humans and AIs collaborate on code, well-written inline documentation will be crucial\u2014not only to help humans navigate and remember the intricate details of a codebase, but also to provide helpful additional context to AI assistants as they debug and generate code.<\/p>\n\n\n\n<p>And, as AI tools help us ship more and more quickly, it\u2019ll be even more important to ensure that documentation evolves with the codebase.<\/p>\n\n\n\n<p>By combining AI with code analysis tools, we can finally solve the age-old dilemma between documenting well and shipping fast.<\/p>\n\n\n\n<p>If this sounds cool,&nbsp;<a href=\"https:\/\/www.codegen.com\/#:~:text=in%20the%20world-,Request%20Access,-Contact%20Us\">request to try Codegen<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s a truth universally acknowledged: every engineering team wrestles with the problem of documentation. So it goes. Obviously, AI can help document your code. But only if you use it strategically. At one extreme, you hand over your Github repo to an LLM and find that it\u2019s added a long docstring on top of every [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9,8],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-dev-tools-and-workflows","category-engineering-insights"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Your AI Is Writing Bad Docs Because It Lacks Context - The Codegen Blog<\/title>\n<meta name=\"description\" content=\"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Your AI Is Writing Bad Docs Because It Lacks Context\" \/>\n<meta property=\"og:description\" content=\"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codegen Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-21T20:56:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-17T03:13:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\" \/>\n<meta name=\"author\" content=\"Codegen Technical Staff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codegen\" \/>\n<meta name=\"twitter:site\" content=\"@codegen\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Codegen Technical Staff\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/\"},\"author\":{\"name\":\"Codegen Technical Staff\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#\\\/schema\\\/person\\\/d11d8bf8745420c643fcb0f3213aa92f\"},\"headline\":\"Your AI Is Writing Bad Docs Because It Lacks Context\",\"datePublished\":\"2024-11-21T20:56:17+00:00\",\"dateModified\":\"2025-07-17T03:13:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/\"},\"wordCount\":927,\"publisher\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\",\"articleSection\":[\"Developer Tools &amp; Workflows\",\"Engineering Insights\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/\",\"url\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/\",\"name\":\"Your AI Is Writing Bad Docs Because It Lacks Context - The Codegen Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\",\"datePublished\":\"2024-11-21T20:56:17+00:00\",\"dateModified\":\"2025-07-17T03:13:29+00:00\",\"description\":\"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#primaryimage\",\"url\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\",\"contentUrl\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/your-ai-is-writing-bad-docs-because-it-lacks-context\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codegen.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Your AI Is Writing Bad Docs Because It Lacks Context\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/codegen.com\\\/blog\\\/\",\"name\":\"The Codegen Blog\",\"description\":\"What we\u2019re building, how we\u2019re building it, and what we\u2019re learning along the way.\",\"publisher\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codegen.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#organization\",\"name\":\"Codegen\",\"url\":\"https:\\\/\\\/codegen.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/Codegen_Lockup-Black-1024h-scaled.png\",\"contentUrl\":\"https:\\\/\\\/codegenblog.kinsta.cloud\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/Codegen_Lockup-Black-1024h-scaled.png\",\"width\":2560,\"height\":528,\"caption\":\"Codegen\"},\"image\":{\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/codegen\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codegen.com\\\/blog\\\/#\\\/schema\\\/person\\\/d11d8bf8745420c643fcb0f3213aa92f\",\"name\":\"Codegen Technical Staff\",\"sameAs\":[\"https:\\\/\\\/codegenblog.kinsta.cloud\"],\"url\":\"https:\\\/\\\/codegen.com\\\/blog\\\/author\\\/cg-admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Your AI Is Writing Bad Docs Because It Lacks Context - The Codegen Blog","description":"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/","og_locale":"en_US","og_type":"article","og_title":"Your AI Is Writing Bad Docs Because It Lacks Context","og_description":"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.","og_url":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/","og_site_name":"The Codegen Blog","article_published_time":"2024-11-21T20:56:17+00:00","article_modified_time":"2025-07-17T03:13:29+00:00","og_image":[{"url":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp","type":"","width":"","height":""}],"author":"Codegen Technical Staff","twitter_card":"summary_large_image","twitter_creator":"@codegen","twitter_site":"@codegen","twitter_misc":{"Written by":"Codegen Technical Staff","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#article","isPartOf":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/"},"author":{"name":"Codegen Technical Staff","@id":"https:\/\/codegen.com\/blog\/#\/schema\/person\/d11d8bf8745420c643fcb0f3213aa92f"},"headline":"Your AI Is Writing Bad Docs Because It Lacks Context","datePublished":"2024-11-21T20:56:17+00:00","dateModified":"2025-07-17T03:13:29+00:00","mainEntityOfPage":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/"},"wordCount":927,"publisher":{"@id":"https:\/\/codegen.com\/blog\/#organization"},"image":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#primaryimage"},"thumbnailUrl":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp","articleSection":["Developer Tools &amp; Workflows","Engineering Insights"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/","url":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/","name":"Your AI Is Writing Bad Docs Because It Lacks Context - The Codegen Blog","isPartOf":{"@id":"https:\/\/codegen.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#primaryimage"},"image":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#primaryimage"},"thumbnailUrl":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp","datePublished":"2024-11-21T20:56:17+00:00","dateModified":"2025-07-17T03:13:29+00:00","description":"Learn how to effectively use AI-generated documentation to enhance the quality and relevance of your engineering documentation.","breadcrumb":{"@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#primaryimage","url":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp","contentUrl":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2024\/11\/687687e4cbd48f5d96199435_674f6cea002569efc5479a62_674e0a5e9379c36dc21ab5db_code1.webp"},{"@type":"BreadcrumbList","@id":"https:\/\/codegen.com\/blog\/your-ai-is-writing-bad-docs-because-it-lacks-context\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codegen.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Your AI Is Writing Bad Docs Because It Lacks Context"}]},{"@type":"WebSite","@id":"https:\/\/codegen.com\/blog\/#website","url":"https:\/\/codegen.com\/blog\/","name":"The Codegen Blog","description":"What we\u2019re building, how we\u2019re building it, and what we\u2019re learning along the way.","publisher":{"@id":"https:\/\/codegen.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codegen.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codegen.com\/blog\/#organization","name":"Codegen","url":"https:\/\/codegen.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codegen.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2025\/07\/Codegen_Lockup-Black-1024h-scaled.png","contentUrl":"https:\/\/codegenblog.kinsta.cloud\/wp-content\/uploads\/2025\/07\/Codegen_Lockup-Black-1024h-scaled.png","width":2560,"height":528,"caption":"Codegen"},"image":{"@id":"https:\/\/codegen.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/codegen"]},{"@type":"Person","@id":"https:\/\/codegen.com\/blog\/#\/schema\/person\/d11d8bf8745420c643fcb0f3213aa92f","name":"Codegen Technical Staff","sameAs":["https:\/\/codegenblog.kinsta.cloud"],"url":"https:\/\/codegen.com\/blog\/author\/cg-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/comments?post=30"}],"version-history":[{"count":6,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/posts\/30\/revisions"}],"predecessor-version":[{"id":21614,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/posts\/30\/revisions\/21614"}],"wp:attachment":[{"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/media?parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/categories?post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codegen.com\/blog\/wp-json\/wp\/v2\/tags?post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}