Part 2: Building blocks
Tools, skills and plugins
Design tools for a model reader, package know-how as skills, and enforce policy with hooks
In short
Tools give capability, skills give method, hooks give enforcement. Design each for a model reader with no memory.
Key ideas
- Shape tools around tasks, not endpoints; split reads from writes
- Empty is not failed: errors say what to change and whether to retry
- Run skills and plugins like a package registry: owners, versions, evals, pinning; provenance is your job
A summary only. The reasoning, examples, checklist and what to do on Monday are in the chapter. Read it in the book
~1/3
tokens: concise vs detailed output (Anthropic example)
~100
tokens per skill at startup
Inside the chapter
- 1Tools are the agent's API
- 2Naming, descriptions and schemas
- 3Granularity: workflow-shaped tools, not CRUD wrappers
- 4Return values: high signal, small, structured
- 5Errors that teach the model to recover
- 6Side effects: idempotency, dry-run and confirmation
- 7How many tools the model sees
- 8Skills: method that loads on demand
- 9When a skill beats a tool, a prompt or a fine-tune
- 10Writing a good skill
- 11Subagents and hooks
- 12Plugins and skill libraries
- 13Testing tools and skills
Try it: the error contract
Tool results are the model's only view of the world.
search_docs times out. What should the tool return?
Show the answers
- A. An empty list Wrong: the model reads [] as a real answer and tells the user there is no documentation.
- B. An error object with isError, a retryable flag and a hint (Best answer) Correct: the model knows the search failed, the harness can retry transient errors, and the hint says what to do next.
- C. A made-up answer so the run continues A fabricated result is worse than none: the agent builds on it and cites it.
- D. Raise and crash the whole run The run dies on a transient fault that a retry or a fallback would have handled.
Go further: free on this site
Questions readers asked about this chapter, a 5-question self-check with explanations, and every source it cites.
Questions readers ask (5)
5 questions. Open one to read the answer.
How do I stop an agent from hammering a paid API or looping on one tool?
Enforce limits in the harness, not the prompt: maximum tool calls, calls per tool, spend and wall-clock time per run. Cache identical calls within a run and return a clear error at the limit ("Limit of 5 searches reached; answer with what you have"). Repeated near-identical calls also signal a weak result format. Track tool calls per task (Chapter 10).
Should I let the model call several tools at once?
For reads, usually yes: it cuts latency. Claude may return several tool calls per response by default; disable_parallel_tool_use in tool_choice turns that off (Claude docs). Parallel writes break: two refunds racing, or a write assuming an earlier one finished. Make tools safe in any order, or force writes to one call per turn.
How many skills can one agent handle?
Metadata is rarely the limit (fifty skills cost a few thousand tokens); selection is. As descriptions overlap, the model picks the wrong skill or none. When near-miss activations rise, merge overlapping skills, sharpen "when not" lines, or give agents different subsets. Codex caps its initial skill list at 2% of the context window by default (Codex docs).
I use ChatGPT or a no-code tool, not a coding agent. Can I use skills?
Often yes. ChatGPT reads Agent Skills, and you can call one by typing @ (ChatGPT docs). Check your platform for "skills" or "plugins" before inventing a format. Otherwise paste the skill body into its instructions: you lose progressive disclosure, so keep it short, but you keep one portable source.
How should a subagent hand results back so the parent does not lose details?
Give it an output contract, not "summarize": findings with evidence identifiers (file path, URL, ticket ID), open questions, and what it did not check. For large outputs, write to a file and return the path plus a summary. Check the contract in code: a missing field is a failed run, retried or escalated.
Answered in the book, not repeated here: See Chapter 3, Plugins and skill libraries; See Chapter 3, Granularity: workflow-shaped tools, not CRUD wrappers
Self-check (5)
Score: 0 / 5 (0 answered)
Question 1 of 5
Your search backend times out. What should the tool return to the model?
Show the answer
Answer: C.
Empty and failed must read differently, and errors should say what to do next. Returning an empty list is exactly how an agent ends up telling users there is no documentation.
Question 2 of 5
A developer marks a write tool with
readOnlyHintso users stop seeing confirmation prompts. What is wrong with that?Show the answer
Answer: B.
Hosts act on annotations, and some treat any tool without
readOnlyHintas a write needing confirmation. Rare use does not make a mislabeled write safe.Question 3 of 5
An agent has 50 skills installed. What does it load at startup?
Show the answer
Answer: B.
Progressive disclosure loads metadata first, the body on activation and references or scripts on demand. Loading every body up front is exactly what the design avoids.
Question 4 of 5
Production deploys must always require a human. Where should that rule live?
Show the answer
Answer: C.
Skills, prompts and descriptions are suggestions the model usually follows and sometimes does not. Only a deterministic guardrail guarantees the rule, and it must block when it fails (
"onFailure": "block"in Claude Code).Question 5 of 5
Your policy hook crashes on an unexpected payload in Claude Code, and
onFailureis not set. What happens to the tool call?Show the answer
Answer: A.
A failed or timed-out hook does not block by default, so policy hooks fail open unless set to
"onFailure": "block". Assuming a crash blocks is the gotcha the chapter warns about.
Sources
Sources cited
- Anthropic, Writing effective tools for agents, with agents, September 2025. anthropic.com
- Model Context Protocol, Key Changes (2025-11-25 specification changelog), November 2025. modelcontextprotocol.io
- Anthropic, Connect Claude Code to tools via MCP (Claude Code docs), accessed November 2026. code.claude.com
- Model Context Protocol, Key Changes (2025-06-18 changelog), June 2025. modelcontextprotocol.io
- Arize AI (Aryan Kargwal), Why AI Agents Break: A Field Analysis of Production Failures, January 2026. arize.com
- Model Context Protocol, Tools (2026-07-28 specification), July 2026. modelcontextprotocol.io
- OpenAI, Developer mode (API docs), accessed November 2026. developers.openai.com
- Anthropic, Effective context engineering for AI agents, September 2025. anthropic.com
- Zapier, Choose agentic or managed mode for each Zapier MCP server, September 2026. zapier.com
- Model Context Protocol, Specification 2026-07-28: changelog, July 2026. modelcontextprotocol.io
- Agent Skills, Specification, accessed November 2026. agentskills.io
- Anthropic, Extend Claude with skills (Claude Code docs), accessed November 2026. code.claude.com
- OpenAI, Build skills (ChatGPT Learn), accessed November 2026. learn.chatgpt.com
- Anthropic, Donating Agent Skills to the Agentic AI Foundation, October 2026. anthropic.com
- Anthropic, Create custom subagents (Claude Code docs), accessed November 2026. code.claude.com
- Claude Code docs, Hooks reference, accessed November 2026. code.claude.com
- Anthropic, Plugin manifest reference (Claude Code docs), accessed November 2026. code.claude.com
- Agent Plugins, Agent Plugins Specification (version 1.0.0), accessed November 2026. agent-plugins.org
- Ana Maria Constantin (The Next Web), OpenAI and four rivals just agreed on one standard for AI agents, August 2026. thenextweb.com
- Snyk, ToxicSkills: malicious AI agent skills on ClawHub, February 2026. snyk.io
- Palo Alto Networks Unit 42, OpenClaw and the AI supply chain, June 2026. unit42.paloaltonetworks.com
Further reading
- Anthropic, Introducing advanced tool use on the Claude Developer Platform, November 2025. anthropic.com
- OpenAI, Function calling (OpenAI API docs). developers.openai.com
- Luca Beurer-Kellner et al., Design Patterns for Securing LLM Agents against Prompt Injections, June 2025. arxiv.org
- Simon Willison, The lethal trifecta for AI agents, June 2025. simonwillison.net