14days-build-claude-code-cli

Teaches building a Claude Code-style agent CLI in Python with tool calling and permissions.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/reason-machines/devtools-skills --skill 14days-build-claude-code-cli-reason-machines
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: 14days-build-claude-code-cli
Source: https://github.com/reason-machines/devtools-skills/tree/main/skills/14days-build-claude-code-cli
Command: npx skills add https://github.com/reason-machines/devtools-skills --skill 14days-build-claude-code-cli-reason-machines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires typer, anthropic.

What problem does it solve? Developers who want to understand how AI coding agents like Claude Code work internally lack a structured, hands-on path to learn the harness layer around LLMs, including tool calling, file editing, and permission systems. ## Core Features & Use Cases - 14-Day Progressive Curriculum: Build an agent CLI from a minimal REPL loop up to subagents, hooks, worktree isolation, and MCP integration, with a working snapshot per day. - Reference Implementations: Includes code for Anthropic Messages API tool calling, safe file edits with diff preview, bash execution with a permission engine, and session persistence. - Use Case: A developer follows the day-by-day tutorials to implement their own agent-code CLI, testing it against DeepSeek's Anthropic-compatible endpoint while learning agent loop architecture. ## Quick Start Help me build an AI code agent CLI in Python following the 14-day tutorial, starting with the Day 1 REPL and agent loop.

Frequently Asked Questions about 14days-build-claude-code-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an AI code agent CLI in Python?▼

Follow the 14-day progression starting with a Typer CLI entry, REPL, and mock provider, then add a real Anthropic provider with tool_use handling on Day 2. Each day adds one capability such as file tools, safe edits, bash permissions, or sessions.

How to implement tool calling with the Anthropic Messages API?▼

Register tools with a name, description, and JSON input_schema, then pass them to create_message. Loop on the response: when stop_reason is not end_turn, execute each tool_use block and append tool_result messages with matching tool_use_id values.

Can I use DeepSeek instead of Claude for agent development?▼

Yes, the project defaults to DeepSeek's Anthropic-compatible endpoint by setting ANTHROPIC_BASE_URL to https://api.deepseek.com/anthropic with your auth token. It also works with Claude or any Anthropic Messages API compatible service.

How do code agents safely edit files?▼

Use a read-before-edit pattern: read current content, verify the model's old_content matches the actual file to detect concurrent changes, show a unified diff preview, and write only after user confirmation.

Why does my agent block file access outside the working directory?▼

This is an intentional security boundary from Day 3 that resolves paths against the current working directory and rejects anything outside it. You can expand allowed roots or replace the hard block with a permission prompt.

Is this tutorial a production-ready Claude Code replacement?▼

No, it is explicitly a teaching project focused on understanding agent harness architecture, tool calling, and permission systems. Production robustness, full Claude Code feature parity, and enterprise-scale performance are stated non-goals.