Ever stared at a new codebase written by others feeling completely lost? This tutorial shows you how to build an AI agent that analyzes GitHub repositories and creates beginner-friendly tutorials explaining exactly how the code works.
This is a tutorial project of Pocket Flow, a 100-line LLM framework. It crawls GitHub repositories and builds a knowledge base from the code. It analyzes entire codebases to identify core abstractions and how they interact, and transforms complex code into beginner-friendly tutorials with clear visualizations.
-
Check out the YouTube Development Tutorial for more!
-
Check out the Substack Post Tutorial for more!
🔸 🎉 Reached Hacker News Front Page (April 2025) with >800 up‑votes: Discussion »
🤯 All these tutorials are generated entirely by AI by crawling the GitHub repo!
-
AutoGen Core - Build AI teams that talk, think, and solve problems together like coworkers!
-
Browser Use - Let AI surf the web for you, clicking buttons and filling forms like a digital assistant!
-
Celery - Supercharge your app with background tasks that run while you sleep!
-
Click - Turn Python functions into slick command-line tools with just a decorator!
-
Codex - Turn plain English into working code with this AI terminal wizard!
-
Crawl4AI - Train your AI to extract exactly what matters from any website!
-
CrewAI - Assemble a dream team of AI specialists to tackle impossible problems!
-
DSPy - Build LLM apps like Lego blocks that optimize themselves!
-
FastAPI - Create APIs at lightning speed with automatic docs that clients will love!
-
Flask - Craft web apps with minimal code that scales from prototype to production!
-
Google A2A - The universal language that lets AI agents collaborate across borders!
-
LangGraph - Design AI agents as flowcharts where each step remembers what happened before!
-
LevelDB - Store data at warp speed with Google's engine that powers blockchains!
-
MCP Python SDK - Build powerful apps that communicate through an elegant protocol without sweating the details!
-
NumPy Core - Master the engine behind data science that makes Python as fast as C!
-
OpenManus - Build AI agents with digital brains that think, learn, and use tools just like humans do!
-
Pydantic Core - Validate data at rocket speed with just Python type hints!
-
Requests - Talk to the internet in Python with code so simple it feels like cheating!
-
SmolaAgents - Build tiny AI agents that punch way above their weight class!
-
Showcase Your AI-Generated Tutorials in Discussions!
-
Clone this repository
git clone https://github.com/The-Pocket/Tutorial-Codebase-Knowledge.git cd Tutorial-Codebase-Knowledge
-
Set up a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure LLM access
The tool supports multiple LLM providers. Configure at least one:
-
Google Gemini (default):
# For Vertex AI: export GEMINI_PROJECT_ID="your-project-id" export GEMINI_LOCATION="us-central1" # OR for AI Studio: export GEMINI_API_KEY="your-api-key"
-
Anthropic Claude:
export ANTHROPIC_API_KEY="your-api-key" # Uncomment Claude function in utils/call_llm.py
-
OpenAI:
export OPENAI_API_KEY="your-api-key" # Uncomment OpenAI function in utils/call_llm.py
-
-
Set up GitHub token (recommended)
export GITHUB_TOKEN="your-github-token"
-
Verify your setup
python utils/call_llm.py
-
Generate a tutorial
# From a GitHub repository python main.py --repo https://github.com/username/repo --include "*.py" "*.js" # Or from a local directory python main.py --dir /path/to/your/codebase --include "*.py"
For detailed setup instructions, see SETUP.md.
-
Set up environment variables (choose one option):
Option 1: For Google Gemini (default):
export GEMINI_PROJECT_ID="your-project-id" export GEMINI_LOCATION="us-central1" # OR for AI Studio instead of Vertex AI: export GEMINI_API_KEY="your-api-key"
Option 2: For Anthropic Claude (uncomment in call_llm.py):
export ANTHROPIC_API_KEY="your-api-key"
Option 3: For OpenAI O1 (uncomment in call_llm.py):
export OPENAI_API_KEY="your-api-key"
-
Test LLM connection:
python utils/call_llm.py
-
Generate a tutorial from a GitHub repository:
python main.py --repo https://github.com/username/repo --include "*.py"
-
Or analyze a local codebase:
python main.py --dir /path/to/your/code --include "*.py" "*.js"
-
Check the generated output:
cd output # View the generated tutorial files
-
I built using Agentic Coding, the fastest development paradigm, where humans simply design and agents code.
-
The secret weapon is Pocket Flow, a 100-line LLM framework that lets Agents (e.g., Cursor AI) build for you
-
Check out the Step-by-step YouTube development tutorial: