DEV Community

Cover image for I built an AI Agent that creates README file for your code
Ayush Thakur for Potpie

Posted on

I built an AI Agent that creates README file for your code

As a developer, I always feel lazy when it comes to creating engaging and well-structured README files for my projects. And I’m pretty sure many of you can relate. Writing a good README is tedious but essential. I won’t dive into why—because we all know it matters.

So, I built an AI Agent called "Readme Generator" to handle this tedious task for me. This AI Agent analyzes your entire codebase, deeply understands how each entity (functions, files, modules, packages, etc.) works, and generates a well-structured README file in markdown format.

I used Potpie to build this AI Agent.

Checkout our Github Repo and give us a star⭐

GitHub logo potpie-ai / potpie

Prompt-To-Agent : Create custom engineering agents for your codebase

Momentum logo


App | Documentation | API Reference | Chat with 🥧 Repo

Apache 2.0 GitHub Repo stars
Join our Discord
tweet

Prompt-To-Agent: Create custom engineering agents for your code

Potpie is an open-source platform that creates AI agents specialized in your codebase, enabling automated code analysis, testing, and development tasks. By building a comprehensive knowledge graph of your code, Potpie's agents can understand complex relationships and assist with everything from debugging to feature development.

Screenshot 2025-01-09 at 2 18 18 PM

📚 Table of Contents

🥧 Why Potpie?

  • 🧠 Deep Code Understanding: Built-in knowledge graph captures relationships between code components
  • 🤖 Pre-built & Custom Agents: Ready-to-use agents for common tasks + build your own
  • 🔄 Seamless Integration: Works with your existing development workflow
  • 📈 Flexible: Handles codebases of…

I simply provided a descriptive prompt to Potpie, specifying what I wanted the AI Agent to do, the steps it should follow, the desired outcomes, and other necessary details. In response, Potpie generated a tailored agent for me.

The prompt I used:

I want an AI Agent that understands the entire codebase to generate a
high-quality, engaging README in MDX format. It should:

Understand the Project Structure

  • Identify key files and folders.
  • Determine dependencies and configurations from package.json, requirements.txt, Dockerfiles, etc.
  • Analyze framework and library usage.

Analyze Code Functionality

  • Parse source code to understand the core logic.
  • Detect entry points, API endpoints, and key functions/classes.

Generate an Engaging README

  • Write a compelling introduction summarizing the project’s purpose.
  • Provide clear installation and setup instructions.
  • Explain the folder structure with descriptions.
  • Highlight key features and usage examples.
  • Include contribution guidelines and licensing details.
  • Format everything in MDX for rich content, including code snippets, callouts, and interactive components.

MDX Formatting & Styling

  • Use MDX syntax for better readability and interactivity.
  • Automatically generate tables, collapsible sections, and syntax highlighted code blocks.

Based upon this provided descriptive prompt, Potpie generated prompts to define the System Input, Role, Task Description, and Expected Output that works as a foundation for our README Generator Agent.

Here’s how this Agent works:

  • Contextual Code Understanding - The AI Agent first constructs a Neo4j-based knowledge graph of the entire codebase, representing key components as nodes and relationships. This allows the agent to capture dependencies, function calls, data flow, and architectural patterns, enabling deep context awareness rather than just keyword matching

  • Dynamic Agent Creation with CrewAI - When a user gives a prompt, the AI dynamically creates a Retrieval-Augmented Generation (RAG) Agent. CrewAI is used to create that RAG Agent

  • Query Processing - The RAG Agent interacts with the knowledge graph, retrieving relevant context. This ensures precise, code-aware responses rather than generic LLM-generated text.

  • Generating Response - Finally, the generated response is stored in the History Manager for processing of future prompts and then the response is displayed as final output.

This architecture ensures that the AI Agent doesn’t just perform surface-level analysis—it understands the structure, logic, and intent behind the code while maintaining an evolving context across multiple interactions.

The generated README contains all the essential sections that every README should have -

  • Title
  • Table of Contents
  • Introduction
  • Key Features
  • Installation Guide
  • Usage
  • API
  • Environment Variables
  • Contribution Guide
  • Support & Contact

Furthermore, the AI Agent is smart enough to add or remove the sections based upon the whole working and structure of the provided codebase.

With this AI Agent, your codebase finally gets the README it deserves—without you having to write a single line of it.

Here's an Output:

Image description

Top comments (7)

Collapse
 
devshefali profile image
Shefali

Well-written article, Ayush!

Collapse
 
nathan_tarbert profile image
Nathan Tarbert

Nice Ayush!

Collapse
 
johnwoods12 profile image
johnwoods12

This AI Agent is super handy

Collapse
 
alexhales67 profile image
Alexhales67

This is exactly what I wanted for my coding projects

Collapse
 
samcurran12 profile image
Sammy Scolling

This looks super cool. Can you share this AI Agent so I can try it

Collapse
 
johncook1122 profile image
John Cook

Will try to create a similar AI Agent using Potpie

Collapse
 
time121212 profile image
tim brandom

This AI Agent is super handy for a person likes me who avoids writing README