Agent skill · software engineering · aradotso
claude-code-book-agent-harness
claude-code-book-agent-harness — an agent skill for coding agents.
Why this skill is useful
Provides a comprehensive architectural guide with executable code patterns for building AI agent harnesses, including conversation loops and tool systems.
What it needs
Requires git installed locally. About 10k tokens when loaded. Last updated 2026-07-09. 70 stars on the source repository.
What this skill does
https://lintsinghua.github.io bash git clone https://github.com/lintsinghua/claude-code-book.git cd claude-code-book 第一部分-基础篇/01-智能体编程的新范式.md 第一部分-基础篇/02-对话循环-Agent的心跳.md 第一部分-基础篇/03-工具系统-Agent的双手.md 第一部分-基础篇/04-权限管线-Agent的护栏.md 第二部分-核心系统篇/05-设置与配置-Agent的基因.md 第二部分-核心系统篇/06-记忆系统-Agent的长期记忆.md 第二部分-核心系统篇/07-上下文管理-Agent的工作记忆.md 第二部分-核心系统篇/08-钩子系统-Agent的生命周期扩展点.md 第三部分-高级模式篇/09-子智能体与Fork模式.md 第三部分-高级模式篇/10-协调器模式-多智能体编排.md 第三部分-高级模式篇/11-技能系统与插件架构.md 第三部分-高级模式篇/12-MCP集成与外部协议.md 第四部分-工程实践篇/13-流式架构与性能优化.md 第四部分-工程实践篇/14-Plan模式与结构化工作流.md 第四部分-工程实践篇/15-构建你自己的Agent-Harness.md 附录/A-源码导航地图.md 附录/B-工具完整清单.md 附录/C-功能标志速查表.md 附录/D-术语表.md typescript // Core Agent Harness conversation loop pattern async function agentLoop( initialMessages: Message[], deps: QueryDeps ): AsyncGenerator<AgentEvent> { const messages = [...initialMessages]; while (true) { // 1. Pre-process: inject system context, memory, tool definitions const prepared = await prepareContext(messages, deps); // 2. Call LLM API with streaming yield { type: 'thinking' }; const stream = await deps.llmClient.stream(prepared); // 3. Collect streamed response let assistantMessage = ''; for await (const chunk of stream) { assistantMessage += chunk.text; yield { type: 'textdelta', delta: chunk.text }; } messages.push({ role: 'assistant', content: assistantMessage }); // 4. Parse tool calls from response const toolCalls = parseToolCalls(assistantMessage); if (toolCalls.length === 0) { // No tools needed — task complete yield { type: 'done', messages }; return; } // 5. Execute tools and backfill results const toolResults = await executeTools(toolCalls, deps); for (const result of toolResults) { yield { type: 'toolresult', result }; messages.push({ role: 'tool', content: result }); } // 6. Check termination conditions const termination = checkTermination(messages, deps); if (termination.shouldStop) { yield { type: 'stopped', reason: termination.reason }; return; } // Loop continues... …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aradotso/claude-code-book-agent-harness