How AI is becoming the personal assistant in large documentations

Searching for a specific function definition in large, complex documentation is often like looking for a needle in a haystack. It's like standing in front of a huge library full of books and looking for a quote from one of them. It helps a lot if you can go to a librarian who may not know the exact quote, but can quickly find the book you want based on the title. AI can perform exactly this function for code documentation, except that it only needs the quote.

The world of development has changed fundamentally in a very short time. Two years ago, we were still laboriously scrolling through documentation or trying to understand what was happening in the code of an open-source project.

Today, we can use AI assistants like GitHub Copilot to quickly and accurately find the information we need.

Why source code instead of documentation?

Many open source projects evolve rapidly and extensively. However, this often means that documentation quickly becomes outdated or incomplete. In addition, it often fails to cover the one edge case that you need to solve. Source code, on the other hand, is the only source of truth. It shows not only what is theoretically possible, but also how it was actually implemented.

If you search the code directly, you can see the real implementation with all its details. You can recognize patterns that are never explicitly mentioned in the documentation. You can find out how different components actually interact, which parameters are really supported, and which hidden options exist.

When developing a web shop with Medusa.js, we repeatedly encountered questions that the documentation could not answer at first glance. With the help of AI, we were able to quickly answer these questions based on the code.

How AI helps when searching through codebases

Getting started with this workflow is surprisingly easy. You need VS Code, GitHub Copilot with your preferred language model, and the desired codebase on your computer. For our Medusa.js example, simply clone the repository and open it in VS Code. Make sure to check out the version of the code that you are using in your project.

And just like that, you have your own personal assistant who can answer all your questions about the codebase. Here are a few examples:

Quick orientation in new codebases: When you first start working on a project like Medusa.js, you can ask the assistant, “Show me where product management is implemented” or “How does the checkout process work?” The AI semantically searches the entire codebase and takes you directly to the relevant files and functions.

Finding implementation examples: Want to write a custom service? Just ask, “Show me examples of custom services in this codebase.” The assistant will find not only the definitions, but also concrete implementations that you can use as a guide. This saves hours of manual searching.

Understanding relationships: Complex dependencies between modules or functions are difficult to understand. With questions such as “How are ProductService and InventoryService related?”, you get an analysis of the relationships, including code references and explanations of data flows.

API exploration: Do you need all the methods available for a service? Instead of scrolling through hundreds of lines, ask: “What public methods does CartService offer?” The AI extracts this information, shows you the signatures, and explains what each method is for.

Debugging and problem solving: When something doesn't work, the AI helps you trace it back. “Where is this exception thrown?” or “What validations are performed when creating an order?” will lead you directly to the critical code locations.

Migration assistance: In the event of breaking changes between versions, you can ask, “How has the plugin API changed between versions 1.x and 2.x?” The AI compares the relevant code sections and shows you the differences.

Conclusion:

The “Code Checkout and Consult AI Assistant” workflow revolutionizes the way we work with large codebases. Instead of relying on potentially outdated documentation, we go directly to the source of truth. With GitHub Copilot, this work becomes not only more efficient, but also much more enjoyable.

For your next project with Medusa.js or another framework: check out the code, open it in VS Code, and start a dialogue with your AI assistant. You'll be surprised at how much faster you become productive and how much deeper your understanding of the code becomes.