Repolode
shareAI-lab

shareAI-lab/learn-claude-code

A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash.

Open-source alternative to:Claude Code

Stars
78,839
Forks
12,616
Open issues
70
Last commit
22 days ago

What is it?

This repository is a teaching course on harness engineering: building the tools, permissions, context management and coordination code that wrap around an LLM so it can act as an agent. It argues that agency comes from the trained model, while the harness supplies the environment, tools and boundaries the model operates in.

The course is organized as 17 progressive chapters, s01 through s17. Each chapter isolates one mechanism, such as the core agent loop, tool dispatch, a permission system, hooks, planning with todos, subagents, skill loading, context compaction, memory, a file-backed task graph, background tasks, cron scheduling, multi-agent teams with task-bound worktrees, MCP tool integration, workflow runtime and goal-based loop control. Chapters include a runnable code.py, and s15 combines the mechanisms into one integrated loop.

The code targets the Anthropic messages API and is run with Python after configuring an API key. A legacy 12-lesson track is kept for older links, and a web platform renders the course.

Key features

  • 01Builds an agent loop around tool_use blocks, starting from one bash tool.
  • 02Covers permission rules, approval pipelines and pre/post tool hooks.
  • 03Includes planning, subagents with isolated message lists and context compaction.
  • 04Demonstrates a file-backed task graph, background execution and cron scheduling.
  • 05Shows multi-agent teams with task-bound worktrees and MCP tool integration.
  • 06Each chapter ships a standalone runnable code.py alongside Chinese and Japanese translations.

Use cases

  • Learning how coding agents like Claude Code are structured internally.
  • Building a custom agent harness for a specific domain using the course's mechanism patterns.
  • Teaching agent design concepts in a workshop or course setting.
  • Comparing tool dispatch, context compaction and multi-agent coordination designs in small runnable examples.

Quick start

  1. 1

    Clone the repository

    git clone https://github.com/shareAI-lab/learn-claude-code
  2. 2

    Open the first lesson folder and follow its README

  3. 3

    Run the lesson's code file

    python s01_agent_loop/code.py

Things to know

  • The README does not give an install command, so you must set up the Python dependencies and API key yourself.
  • The lesson code calls the Claude API, which requires a paid API key.

Topics

FAQ

What is learn-claude-code?
A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash. This repository is a teaching course on harness engineering: building the tools, permissions, context management and coordination code that wrap around an LLM so it can act as an agent. It argues that agency comes from the trained model, while the harness supplies the environment, tools and boundaries the model operates in.
Is learn-claude-code free to use? What license does it have?
learn-claude-code is open source under the MIT license. Check the license terms before using it in commercial products.
Is learn-claude-code still maintained?
Actively maintained. The last commit to learn-claude-code was on Sep 28, 2026.
What can I use learn-claude-code for?
Learning how coding agents like Claude Code are structured internally. Building a custom agent harness for a specific domain using the course's mechanism patterns. Teaching agent design concepts in a workshop or course setting. Comparing tool dispatch, context compaction and multi-agent coordination designs in small runnable examples.
How do I install learn-claude-code?
Clone the repository: git clone https://github.com/shareAI-lab/learn-claude-code Open the first lesson folder and follow its README Run the lesson's code file: python s01_agent_loop/code.py
Where can I get learn-claude-code?
The source code and installation instructions are on GitHub: https://github.com/shareAI-lab/learn-claude-code

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects