You may have seen the headlines lately about the latest iteration of AI chat technology. In conjunction with its GPT-3 family of large language models, OpenAI announced ChatGPT, a dialogue-based AI chat interface. OpenAI accounts can use it for free during testing. While playing around with this new tech, I got to wondering how it could be used to help web developers.
By utilizing natural language processing (NLP), this tool understands a user’s context and intent and offers relevant answers and suggestions. We’ve seen how AI code tools like GitHub Copilot improves web developer workflows when it comes to writing code, but the advanced language capabilities of ChatGPT show even more potential. A powerful tool like ChatGPT can help developers create accurate and comprehensive documentation for their projects.
“I love writing documentation!” is not something you will hear from most developers. In fact, documentation is regarded as a boring topic and is often relegated to the back burner on most product teams. As a result, web apps and internal software deploy with spotty docs and substandard internal resources.
So how can AI help write developer documentation? Can ChatGPT really be of any help? Let’s get into it!
Why does good documentation matter for web apps?

Good documentation is important for web apps for several reasons. Some of the key benefits of having high-quality documentation for a web app include the following:
Improved user experience
A well-documented app offers a better user experience, plain and simple. In other words, good documentation can help users understand and use the web app more easily and effectively. This can improve the overall user experience, as users can find the information they need and use the app more efficiently.
Enhanced developer productivity
Good documentation can also help developers understand the web app and its features quicker, instead of having to figure out what the previous developer meant by their poorly documented spaghetti code. This can enhance developer productivity, as developers are able to use the app more efficiently and effectively.
Increased adoption and usage
High-quality documentation can also help to increase the adoption and usage of the web app. By providing clear and comprehensive information about the app, users are more likely to try it out and continue using it.
Better support and maintenance
Good documentation can also make supporting and maintaining the web app easier. By providing clear and comprehensive information about the app, it is easier for support teams to troubleshoot and resolve issues and for developers to make updates and improvements to the app.
Does ChatGPT really know the code?
I took a few minutes to experiment with how ChatGPT can help with adding some comments to a bit of code:

Not expecting much initially, I was surprised with a pretty detailed output:

So far so good! But what if I wanted to add these comments right into the code? I gave it a shot:

Overall, I am pretty impressed. And I can say that this tech is definitely going to transform the way web development is done.
So how can ChatGPT be used to write developer documentation?
One way that ChatGPT can be used for writing developer documentation is by providing instant access to relevant information and examples.
I think this article delves into precisely how well ChatGPT can jump into a codebase and provide comments and optimization.
As an example, suppose a developer writes documentation for a particular function. In that case, they can ask ChatGPT for details on how to use that function or method, and ChatGPT will provide them with the appropriate syntax and examples. This can save time and effort, as developers don’t have to search through multiple sources or rely on their memory to recall the correct syntax and usage.
ChatGPT can also be helpful for writing developer documentation by providing suggestions for common pitfalls and mistakes. For example, suppose a developer writes documentation for a function that takes an argument. In that case, ChatGPT can provide suggestions for how to handle common cases, such as invalid input or missing arguments. This can help developers avoid common pitfalls and ensure that their documentation is comprehensive and easy to understand.
In addition, ChatGPT can also be used to verify the accuracy of existing documentation. For example, if a developer is unsure about the syntax or usage of a particular function or method, they can ask ChatGPT for confirmation and clarification. This can help to ensure that the documentation is up-to-date and accurate and can prevent misunderstandings or confusion among users of the project.
What are some issues product teams face while creating documentation with current methods?

Product teams often face several challenges when creating documentation using current methods. Some of the most common issues include a lack of time and resources. Writing documentation can be a time-consuming and resource-intensive task, especially for large and complex projects.
Product teams often struggle to allocate sufficient time and resources to writing docs for their web app, leading to web developers having to pick up the slack. Overworked developers without sufficient review processes can spit out incomplete or inaccurate documentation.
There is also the difficulty in keeping documentation up-to-date. As projects evolve and change over time, keeping documentation up-to-date and accurate can be difficult. This can lead to misunderstandings and confusion among users and make it difficult for future developers to understand and use the project. Your code might make sense to you now, but six months from now, it will look as foreign as any other code. If you don’t write docs when you write the code, keeping everything up to date can be virtually impossible.
Another common issue is a lack of consistency and clarity in the documentation. Different web developers and product team members may have different writing styles, leading to inconsistency in the documentation. Additionally, the documentation may not be written clearly and concisely, making it difficult for end users to understand and use the app.
Finally, verifying the accuracy of documentation can be challenging, especially for large and complex projects. This can lead to misunderstandings and confusion among users and can also make it difficult for other developers to use the project effectively. If there is no review process in place, who can know when someone writes inaccurate documentation?
What aspects of the technical writing workflow could be automated?

There are a few ways AI can take over the technical writing workflow. Some examples include:
Providing instant access to relevant information and examples
As mentioned earlier, ChatGPT can be used to provide instant access to relevant information and examples when writing documentation. It seems to know all the syntax for common web development languages like JavaScript, Python, Ruby, and others. This can save time and effort, as developers don’t have to search through multiple sources or rely on their own memory to recall the correct syntax and usage.
Generating templates or boilerplate text
ChatGPT can also be used to generate templates or boilerplate text for common documentation tasks, such as describing a function or method or creating a step-by-step guide for completing a particular task. This can save time and ensure consistency in the documentation.
Checking for accuracy and consistency
ChatGPT can also be used to check the accuracy and consistency of existing documentation. For example, it can verify the syntax and usage of code snippets or check for spelling and grammar errors. This can help to ensure that the documentation is high-quality and easy to understand.
Providing suggestions for common pitfalls or mistakes
As mentioned earlier, ChatGPT can provide suggestions for handling common pitfalls or mistakes when writing documentation. This can help developers avoid common mistakes and ensure that their documentation is comprehensive and easy to understand.
Final Thoughts: Can AI help write developer documentation?
Overall, there are many potential uses for ChatGPT in the technical writing workflow. It can be used to provide instant access to relevant information and examples, generate templates or boilerplate text, check for accuracy and consistency, and provide suggestions for common pitfalls or mistakes. However, AI is nowhere near perfect, and definitely has its drawbacks for writing developer documentation.
It could easily be argued that the ChatGPT is simply writing existing code/boilerplate, but consider the cognitive load that is being lifted off of developers who take advantage of it. Saving time on a tedious process like documentation frees developers up to focus on more challenging problems.
So, can AI help write developer documentation? ChatGPT already impresses me with its ability to generate working code fragments and break down technical information. While I don’t think it will take over writing documentation in the next year or even the next five, it could definitely have an impact on the way product teams and web developers navigate the process.