Advanced Techniques for Documenting Code with GitHub Copilot

In this episode, Maxin Soniggov demonstrates how GitHub Copilot can automate and enhance code documentation by generating comprehensive README files, detailed API docs, and inline comments using community prompts and various Copilot modes. He also highlights the “Bring Your Own Key” feature for flexible AI model integration, showcasing Copilot as a powerful tool that transforms documentation from a tedious task into an efficient and enjoyable process.

In this episode of Prompt-Driven Development, Maxin Soniggov, a senior solution engineer at Microsoft, demonstrates how developers can efficiently generate comprehensive documentation for their projects using GitHub Copilot. He begins by introducing his example project, a personal expense tracker app, which initially lacks proper documentation. Instead of manually writing documentation, Maxin leverages GitHub Copilot’s powerful prompting capabilities to automate the creation of a detailed README file, showcasing how the right prompts can transform documentation from a tedious task into a fast and enjoyable process.

Maxin explains that great projects start with great README files that clearly explain the project’s purpose, setup, and usage. To generate this, he uses a pre-made prompt called the “README generator” from the community-driven “Awesome Copilot” GitHub repository. By placing this prompt in the project’s prompts folder and following naming conventions, he can easily invoke it within GitHub Copilot’s agent mode. The resulting README file is well-formatted, complete, and validated by running key commands, ensuring accuracy and usability for other developers and future reference.

Next, Maxin focuses on documenting the backend API layer, which requires more detailed and structured documentation than what typically goes into a README. Using GitHub Copilot’s edit mode, he prompts the tool to create detailed API documentation following best practices. Within minutes, Copilot generates two files: a human-readable API documentation file and a YAML file compliant with the OpenAPI specification. This dual documentation approach ensures both developers and automated tools can easily understand and interact with the API.

An important feature Maxin highlights is GitHub Copilot’s “Bring Your Own Key” option, which allows developers to connect their own AI model API keys. This feature offers enhanced flexibility, security, and cost management by enabling organizations to use their preferred AI models or comply with specific requirements. Maxin demonstrates how to select and switch between models within Copilot, emphasizing the added control this provides to developers and teams.

Finally, Maxin documents the frontend part of the project using GitHub Copilot’s inline mode. He shows how to quickly add JSDoc-style comments to individual methods and entire files, significantly improving code readability and maintainability. Wrapping up, he recaps the best practices demonstrated: using community prompts, leveraging different Copilot modes for various documentation needs, and validating generated content. The key takeaway is that GitHub Copilot is much more than an autocomplete tool—it can serve as a powerful documentation assistant, helping developers ship clearer, better-documented projects with minimal time investment.