{"name":"learn-claude-code: Build AI Coding Agents from Scratch with Python","description":"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.","github":"https://github.com/shareAI-lab/analysis_claude_code","url":"https://osrepos.com/repo/shareai-lab-analysis_claude_code","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/shareai-lab-analysis_claude_code","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/shareai-lab-analysis_claude_code.md","json":"https://osrepos.com/repo/shareai-lab-analysis_claude_code.json","topics":["agent","claude-code","teaching","Python","AI","machine learning","development","open-source"],"keywords":["agent","claude-code","teaching","Python","AI","machine learning","development","open-source"],"stars":null,"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.","content":"## Introduction\n\nThe `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.\n\n## Installation\n\nGetting started with `learn-claude-code` is straightforward. Follow these steps to set up the environment and run the agent versions:\n\nbash\n# Install dependencies\npip install -r requirements.txt\n\n# Configure your API\ncp .env.example .env\n# Edit .env with your API key (supports Anthropic, OpenAI, Gemini, etc.)\n\n# Run any version\npython v0_bash_agent.py  # Minimal\npython v1_basic_agent.py # Core agent loop\npython v2_todo_agent.py  # + Todo planning\npython v3_subagent.py    # + Subagents\npython v4_skills_agent.py # + Skills\n\n\n## Examples\n\nThe repository presents a unique learning path through five distinct agent versions, each building upon the last:\n\n*   **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.\n*   **v1: Model as Agent** (~200 lines): Expands to four core tools (bash, read, write, edit), showcasing the complete agent loop within a single function.\n*   **v2: Structured Planning** (~300 lines): Integrates a Todo tool to enable explicit planning and manage complex tasks with constraints.\n*   **v3: Subagent Mechanism** (~450 lines): Introduces a Task tool to spawn isolated child agents, maintaining clean context management.\n*   **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.\n\nThe core pattern for every coding agent is elegantly simple:\npython\nwhile True:\n    response = model(messages, tools)\n    if response.stop_reason != \"tool_use\":\n        return response.text\n    results = execute(response.tool_calls)\n    messages.append(results)\n\n\nAdditionally, the repository includes an **Agent Builder Skill** to help scaffold new agent projects:\nbash\n# Scaffold a new agent project\npython skills/agent-builder/scripts/init_agent.py my-agent\n\n# Or with specific complexity level\npython skills/agent-builder/scripts/init_agent.py my-agent --level 0  # Minimal\npython skills/agent-builder/scripts/init_agent.py my-agent --level 1  # 4 tools (default)\n\n\n## Why Use learn-claude-code?\n\nThis 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:\n\n*   **Fundamental Agent Concepts**: Learn the core principles of tool use, planning, subagents, and skills that power sophisticated AI systems.\n*   **Practical Implementation**: Get hands-on experience with Python code that demonstrates these concepts in a clear, incremental manner.\n*   **Demystifying AI**: Break down the complexity of AI agents into manageable, understandable components, proving that \"the model is 80%, code is 20%.\"\n*   **Foundation for Custom Agents**: Use this project as a template to fork and customize for your own agent development needs.\n\nIt's an educational journey that reshapes your understanding of what makes a true AI agent.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/shareAI-lab/learn-claude-code](https://github.com/shareAI-lab/learn-claude-code){target=\"_blank\"}\n*   **Related Projects**:\n    *   [Kode: Full-featured open source agent CLI](https://github.com/shareAI-lab/Kode){target=\"_blank\"}\n    *   [shareAI-skills: Production-ready skills for AI agents](https://github.com/shareAI-lab/shareAI-skills){target=\"_blank\"}\n    *   [Agent Skills Spec: Official specification](https://github.com/anthropics/agent-skills){target=\"_blank\"}\n*   **Deep Dive Documentation**:\n    *   [v0: Bash is All You Need](https://github.com/shareAI-lab/learn-claude-code/blob/main/docs/v0-bash-is-all-you-need.md){target=\"_blank\"}\n    *   [v1: Model as Agent](https://github.com/shareAI-lab/learn-claude-code/blob/main/docs/v1-model-as-agent.md){target=\"_blank\"}\n    *   [v2: Structured Planning](https://github.com/shareAI-lab/learn-claude-code/blob/main/docs/v2-structured-planning.md){target=\"_blank\"}\n    *   [v3: Subagent Mechanism](https://github.com/shareAI-lab/learn-claude-code/blob/main/docs/v3-subagent-mechanism.md){target=\"_blank\"}\n    *   [v4: Skills Mechanism](https://github.com/shareAI-lab/learn-claude-code/blob/main/docs/v4-skills-mechanism.md){target=\"_blank\"}","metrics":{"detailViews":4,"githubClicks":3},"dates":{"published":null,"modified":"2026-01-24T00:00:38.000Z"}}