Agent skill

Agent Harness Builder

by FareedKhan-dev in FareedKhan-dev/claude-code-from-scratch

Gives patterns, a tool design checklist and an architecture decision tree for building agent harnesses, tools and multi-agent setups around a model.

MITAuto-check passedAI & LLM Engineering

Install Agent Harness Builder

skills CLI
$ npx skills add FareedKhan-dev/claude-code-from-scratch --skill agent-builder -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install FareedKhan-dev/claude-code-from-scratch agent-builder --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/FareedKhan-dev/claude-code-from-scratch.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/agent-builder .claude/skills/agent-builder && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agent-builder
GitHub stars
298
Token cost
~1.1k tokens
SKILL.md length
266 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
MIT

At a glance

Gives patterns, a tool design checklist and an architecture decision tree for building agent harnesses, tools and multi-agent setups around a model.

  • Building a new agent loop from scratch
  • SKILL.md covers When to use this skill, Core principle, The minimal agent (always… and Tool design checklist, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Designing a tool and writing its description for an agent

What it does

The central idea is that the model is the agent and your code is the harness: tools, knowledge, observation, action and permissions. The skill says to leave judgment to the model rather than the harness, and to start from a minimal loop that calls the Anthropic client in Python, adding mechanisms only when a real need appears.

A checklist covers tool design: verb-style names, descriptions that say when to use the tool, minimal input schemas, plain-text results, a hard timeout and output truncated to a safe length of 50,000 characters. A description formula and an example show how to word them. A decision tree helps choose among agent architectures, from a single loop with a shell tool up to multi-agent systems.

Common mistakes are listed with fixes: logic hard-coded into the harness, oversized system prompts, loops blocked by slow operations, and shared mutable state between subagents. A subagent template shows how to give each one an isolated context.

When your agent uses it

  • Building a new agent loop from scratch
  • Designing a tool and writing its description for an agent
  • Structuring a multi-agent workflow with subagents
  • Debugging an agent loop that is not behaving

Example prompts

  • “I want to build a coding agent in Python; set up the smallest working loop.”
  • “Review my tool definitions and tell me which descriptions are too vague.”
  • “Should this task use a single loop or subagents?”

Requirements

  • Python with the anthropic package for the sample loop

What it can do on your machine

Read from SKILL.md and the folder at commit fb9709e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agent Harness Builder loads about 1.1k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 266 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from FareedKhan-dev/claude-code-from-scratch at commit fb9709e, republished under its MIT licence (© FareedKhan-dev). 266 words, ~1,148 tokens.

Download SKILL.mdSave it as .claude/skills/agent-builder/SKILL.md (or your agent's skills folder).
name
agent-builder
description
Use when building a new agent harness, designing tool systems, or structuring multi-agent workflows. Provides patterns, templates, and decision trees for harness engineering.

Agent Builder Skill

When to use this skill

Load this skill when the user wants to:

  • Build a new agent from scratch
  • Design a tool for an agent
  • Structure a multi-agent system
  • Debug an agent loop that isn't working
  • Choose between agent architectures

Core principle

The agent is always the model. Your job is the harness.

Harness = Tools + Knowledge + Observation + Action + Permissions

Never try to encode intelligence in your harness code. Give the model clean tools, clear context, and get out of the way.

The minimal agent (always start here)

python
from anthropic import Anthropic
client = Anthropic()

def agent_loop(messages, tools, dispatch, system):
    while True:
        response = client.messages.create(
            model="claude-sonnet-4-20250514",
            system=system, messages=messages,
            tools=tools, max_tokens=8000,
        )
        messages.append({"role": "assistant", "content": response.content})
        if response.stop_reason != "tool_use":
            return
        results = []
        for block in response.content:
            if block.type == "tool_use":
                output = dispatch[block.name](block.input)
                results.append({"type": "tool_result",
                                 "tool_use_id": block.id, "content": output})
        messages.append({"role": "user", "content": results})

Do not add anything until you need it. Every mechanism should earn its place.

Tool design checklist

Before writing a tool, ask:

  • Is the name a verb? (bash, read, write — not "file_manager")
  • Does the description say WHEN to use it, not just what it does?
  • Is the input schema minimal? No optional fields unless truly needed.
  • Does it return plain text the model can reason about?
  • Does it have a hard timeout?
  • Is output truncated to a safe length (≤50k chars)?

Tool description formula

"[Action verb] [what it does]. Use when [specific situation].
[What it returns]. [Any important limits]."

Example:

"Read a file and return numbered lines. Use when you need to inspect
file content or reference specific line numbers. Returns up to 50,000
characters. Use start_line/end_line for large files."

Architecture decision tree

One task, one user, no persistence needed?
    → s01: minimal loop + bash

Need file read/write/search?
    → s02: extended tool dispatch

Need the agent to plan before acting?
    → s03: add todo_write tool

Task too big for one context window?
    → s04: subagent isolation

Need domain-specific knowledge?
    → s05: skill loading

Long-running session, context will overflow?
    → s06: compression + memory file

Complex multi-step project spanning sessions?
    → s07: task graph with dependencies

Slow operations (builds, tests)?
    → s08: background tasks

Work that parallelises across specialties?
    → s09+: agent teams with mailboxes

Need isolation between parallel tasks?
    → s12/s23: git worktrees

Common mistakes

Putting logic in the harness instead of trusting the model Bad: if "error" in output: retry_with_different_approach() Good: return the error to the model and let it decide

Giant system prompts Bad: 5,000-word system prompt covering every scenario Good: load domain knowledge on-demand via skills (s05)

Blocking the loop on slow operations Bad: output = subprocess.run("npm test", timeout=300) Good: run in background thread, notify when done (s08)

Shared mutable state between subagents Bad: subagents writing to the same dict/file without locks Good: each subagent has its own isolated context (s04, s12)

Subagent pattern template

python
def spawn_subagent(prompt: str, tools=EXTENDED_TOOLS, dispatch=EXTENDED_DISPATCH) -> str:
    messages = [{"role": "user", "content": prompt}]
    while True:
        response = client.messages.create(
            model=MODEL, system=SUBAGENT_SYSTEM,
            messages=messages, tools=tools, max_tokens=8000,
        )
        messages.append({"role": "assistant", "content": response.content})
        if response.stop_reason != "tool_use":
            break
        results = dispatch_tools(response.content, dispatch)
        messages.append({"role": "user", "content": results})
    return "".join(b.text for b in messages[-1]["content"] if hasattr(b, "text"))

© FareedKhan-dev, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/agent-builder of FareedKhan-dev/claude-code-from-scratch.

Open the folder on GitHubat commit fb9709e

Compare with similar skills

Agent Harness Builder next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agent Harness Builder compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agent Harness Builder this skillFareedKhan-dev/claude-code-from-scratch298—~1.1kAutomated safety check: PassMIT
Pydantic AI Harnesspydantic/pydantic-ai20k—~4.9kAutomated safety check: PassMIT
Agent BuildershareAI-lab/lab-skills314—~1.4kAutomated safety check: PassApache-2.0
Deep Agents Corelangchain-ai/langchain-skills1.3k1 repos~3.1kAutomated safety check: PassMIT
Openhands SDKOpenHands/extensions157—~6.9kAutomated safety check: PassMIT
Swarms Multi-Agent Frameworkkyegomez/swarms7.2k—~5.5kAutomated safety check: PassApache-2.0

Similar skills

  • Pydantic AI Harness

    pydantic/pydantic-ai

    Official

    Adds optional capabilities to Pydantic AI agents from pydantic-ai-harness, led by Code Mode, which runs many tool calls as one sandboxed Python script.

    20k GitHub stars~4.9k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Agent Builder

    shareAI-lab/lab-skills

    Helps design and build AI agents for any domain around a minimal loop of capabilities, knowledge and context, adding planning or subagents only when needed.

    314 GitHub stars~1.4k tokensUpdated 21 days ago
    AI & LLM EngineeringAuto-check passed
  • Deep Agents Core

    langchain-ai/langchain-skills

    Official

    Explains how to build agents with the Deep Agents framework: create_deep_agent, the built-in middleware, the harness, SKILL.md format and configuration options.

    1.3k GitHub starsUsed in 1 repo~3.1k tokens
    AI & LLM EngineeringAuto-check passed
  • Openhands SDK

    OpenHands/extensions

    Reference skill for the OpenHands Software Agent SDK - the Python framework for building AI agents that write software.

    157 GitHub stars~6.9k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Teaches the Swarms Python framework: the Agent class, tools, loops, memory and multi-agent structures such as sequential, concurrent and graph workflows.

    7.2k GitHub stars~5.5k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Agent Squad Python Guide

    2FastLabs/agent-squad

    Map of the agent-squad Python framework for async multi-agent orchestration: which agent, classifier, storage and tool provider to pick, and the pitfalls to avoid.

    7.8k GitHub stars~4.7k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed

More from FareedKhan-dev/claude-code-from-scratch

  • Structured Code Review

    FareedKhan-dev/claude-code-from-scratch

    Gives the agent a five-step review routine that reads the full file first, labels each finding as bug, security, performance, style or suggestion, and ends with a summary.

    298 GitHub stars~809 tokensUpdated 6 mo ago
    Auto-check passed
  • PDF Library Guide

    FareedKhan-dev/claude-code-from-scratch

    Picks the right Python library for PDF jobs, with examples for text and table extraction, merging, splitting and page extraction, plus OCR and memory fixes.

    298 GitHub stars~785 tokensUpdated 6 mo ago
    Auto-check passed

Works with

Questions about Agent Harness Builder

What does Agent Harness Builder do?

Gives patterns, a tool design checklist and an architecture decision tree for building agent harnesses, tools and multi-agent setups around a model. The central idea is that the model is the agent and your code is the harness: tools, knowledge, observation, action and permissions. The skill says to leave judgment to the model rather than the harness, and to start from a minimal loop that calls the Anthropic client in Python, adding mechanisms only when a real need appears.

When should I use Agent Harness Builder?

Agent Harness Builder fits situations like: building a new agent loop from scratch; designing a tool and writing its description for an agent; structuring a multi-agent workflow with subagents; debugging an agent loop that is not behaving.

How do I install Agent Harness Builder in Claude Code?

Run `npx skills add FareedKhan-dev/claude-code-from-scratch --skill agent-builder -a claude-code`. Or copy the skill folder (skills/agent-builder in FareedKhan-dev/claude-code-from-scratch) into .claude/skills/agent-builder in your project. Claude Code loads it when a task matches its description.

How do I install Agent Harness Builder in Codex?

Run `npx skills add FareedKhan-dev/claude-code-from-scratch --skill agent-builder -a codex`. Or copy the skill folder (skills/agent-builder in FareedKhan-dev/claude-code-from-scratch) into .agents/skills/agent-builder in your project. Codex loads it when a task matches its description.

Can I use Agent Harness Builder in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add FareedKhan-dev/claude-code-from-scratch --skill agent-builder -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agent-builder, .gemini/skills/agent-builder, .github/skills/agent-builder and .opencode/skills/agent-builder in your project.

What does Agent Harness Builder need to run?

SKILL.md names no scripts, command-line tools or credentials: Agent Harness Builder is instructions for the agent only. Our summary lists: Python with the anthropic package for the sample loop.

Does Agent Harness Builder access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Agent Harness Builder safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Agent Harness Builder use?

Agent Harness Builder is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agent Harness Builder use?

About 1.1k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Agent Harness Builder?

Skills that share tags, products or a category with Agent Harness Builder: Pydantic AI Harness (pydantic/pydantic-ai, 20k stars), Agent Builder (shareAI-lab/lab-skills, 314 stars), Deep Agents Core (langchain-ai/langchain-skills, 1.3k stars) and Openhands SDK (OpenHands/extensions, 157 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agent Harness Builder?

FareedKhan-dev (a GitHub user) maintains it in FareedKhan-dev/claude-code-from-scratch, which has 298 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on April 5, 2026.

Source: FareedKhan-dev/claude-code-from-scratch on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.