learn-claude-code: Build AI Coding Agents from Scratch with Python

This repository profile is provided by osrepos.com, an open source repository discovery platform.

learn-claude-code: Build AI Coding Agents from Scratch with Python

Summary

The learn-claude-code repository offers a progressive tutorial to demystify AI coding agents like Claude Code, Kode, and Cursor Agent. It teaches users how modern AI agents work by building them from scratch, starting with a minimal 16-line Bash agent. This project emphasizes the core concept of "Model as Agent" through five evolving versions.

Repository Information

Analyzed by OSRepos on January 24, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

The learn-claude-code repository by shareAI-lab provides a comprehensive, progressive tutorial for understanding and building AI coding agents. This project aims to demystify how powerful agents like Claude Code, Kode, and Cursor Agent function, guiding you through the process of creating one from the ground up. Starting with a remarkably concise 16-line Bash agent, the tutorial evolves through five versions, each introducing a fundamental concept to build a sophisticated AI agent. The core philosophy, "Model as Agent," is central to this learning journey, demonstrating that the model's capabilities, combined with simple tools, are the secret to effective agent design.

Installation

Getting started with learn-claude-code is straightforward. Follow these steps to set up the environment and run the agent versions:

# Install dependencies
pip install -r requirements.txt

# Configure your API
cp .env.example .env
# Edit .env with your API key (supports Anthropic, OpenAI, Gemini, etc.)

# Run any version
python v0_bash_agent.py  # Minimal
python v1_basic_agent.py # Core agent loop
python v2_todo_agent.py  # + Todo planning
python v3_subagent.py    # + Subagents
python v4_skills_agent.py # + Skills

Examples

The repository presents a unique learning path through five distinct agent versions, each building upon the last:

  • v0: Bash is All You Need (~50 lines, ~16 lines for mini version): Introduces the simplest agent with just one Bash tool, demonstrating that the core agent logic can be incredibly compact. It uses recursive self-calls for subagents.
  • v1: Model as Agent (~200 lines): Expands to four core tools (bash, read, write, edit), showcasing the complete agent loop within a single function.
  • v2: Structured Planning (~300 lines): Integrates a Todo tool to enable explicit planning and manage complex tasks with constraints.
  • v3: Subagent Mechanism (~450 lines): Introduces a Task tool to spawn isolated child agents, maintaining clean context management.
  • v4: Skills Mechanism (~550 lines): Adds a Skill tool and SKILL.md files, providing on-demand domain expertise and treating knowledge as a first-class citizen.

The core pattern for every coding agent is elegantly simple:

while True:
    response = model(messages, tools)
    if response.stop_reason != "tool_use":
        return response.text
    results = execute(response.tool_calls)
    messages.append(results)

Additionally, the repository includes an Agent Builder Skill to help scaffold new agent projects:

# Scaffold a new agent project
python skills/agent-builder/scripts/init_agent.py my-agent

# Or with specific complexity level
python skills/agent-builder/scripts/init_agent.py my-agent --level 0  # Minimal
python skills/agent-builder/scripts/init_agent.py my-agent --level 1  # 4 tools (default)

Why Use learn-claude-code?

This repository is an invaluable resource for anyone looking to truly understand the mechanics behind modern AI coding agents. By building agents from scratch, you gain deep insights into:

  • Fundamental Agent Concepts: Learn the core principles of tool use, planning, subagents, and skills that power sophisticated AI systems.
  • Practical Implementation: Get hands-on experience with Python code that demonstrates these concepts in a clear, incremental manner.
  • Demystifying AI: Break down the complexity of AI agents into manageable, understandable components, proving that "the model is 80%, code is 20%."
  • Foundation for Custom Agents: Use this project as a template to fork and customize for your own agent development needs.

It's an educational journey that reshapes your understanding of what makes a true AI agent.

Links

Related repositories

Similar repositories that may be relevant next.

open-slide: An AI-Native Slide Framework for React Presentations

open-slide: An AI-Native Slide Framework for React Presentations

September 9, 2026

open-slide is a powerful slide framework built for AI agents, enabling users to create presentations by describing them in natural language. Coding agents then generate the React components, while open-slide handles the canvas, scaling, navigation, and presentation modes. This allows agents to focus entirely on content, streamlining the creation of polished, agent-driven decks.

agentreactslides
best-skills: Daily-Updated Rankings for Top Agent Skills

best-skills: Daily-Updated Rankings for Top Agent Skills

September 8, 2026

The LinklyAI/best-skills repository offers daily-updated rankings of the top 100 agent skills. It aggregates data on installs, growth, and social buzz from various platforms like skills.sh, ClawHub, Tencent SkillHub, GitHub, and X. This open-data project provides a comprehensive, cross-ecosystem view of agent skill performance, making it an invaluable resource for developers and researchers.

agentagent-skillsai-skills
Context Engineering Kit: Enhance AI Agent Quality with Advanced Skills

Context Engineering Kit: Enhance AI Agent Quality with Advanced Skills

September 6, 2026

The Context Engineering Kit is a powerful collection of hand-crafted Claude Code Skills designed to significantly improve the quality and predictability of AI agent results. It offers advanced context engineering techniques with a minimal token footprint, ensuring efficiency and effectiveness across platforms like OpenCode, Cursor, and Gemini CLI. This kit provides granular control over plugins and includes an open-source alternative to CodeRabbit, enhancing development workflows.

agentaiclaude
Agent Factory: Generate AI Agents with Natural Language Descriptions

Agent Factory: Generate AI Agents with Natural Language Descriptions

September 3, 2026

Agent Factory, developed by Mozilla-AI, is a powerful tool designed to generate AI agents and workflows. It allows users to describe tasks in natural language, which it then transforms into executable Python code for agentic workflows. Leveraging the Model Context Protocol (MCP) and the any-agent library, it simplifies the creation of complex AI solutions.

agentagentic-aicli

Source repository

Open the original repository on GitHub.

13 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️