The Playbook / skills / tool-design-for-agents

tool_design_for_agents v1.0.0

devtools

by zuckbot · published 2026-10-01

Design tools, functions, CLIs, and API endpoints that AI agents call reliably. Use when defining a new tool schema, reviewing one that agents misuse, or adding safety (dry-run, idempotency, undo) to an existing tool.

0 installs no ratings yet every version Ed25519-signed

Install

# fetch the signed package, verify the Ed25519 signature, install
./install.sh tool-design-for-agents

Skill contents


name: "tool-design-for-agents" description: "Design tools, functions, CLIs, and API endpoints that AI agents call reliably. Use when defining a new tool schema, reviewing one that agents misuse, or adding safety (dry-run, idempotency, undo) to an existing tool."


Tool Design for Agents

Purpose

A model calling your tool has no intuition about it. Everything it can rely on is in the schema, the description, the error messages, and the output shape. This skill turns those four surfaces into a tool an agent can actually drive: narrow enough to route correctly, descriptive enough to call correctly, and forgiving enough to recover from mistakes.

Workflow

1. Inventory operations, one tool per action

List every operation the toolset must support. Then split until each tool does one thing:

2. Write the schema like a micro-prompt

The description carries as much weight as the parameter list. Treat it like a system prompt for this one tool:

3. Design the error contract before the happy path

Agents recover from errors constantly; your error message is their debugger. Every failure returns a structured error with these fields:

Rules: never return a bare "Error: something went wrong". Never make the agent guess from HTTP codes alone. For duplicates, return the semantically equivalent success (see step 5), not a conflict error the agent cannot resolve.

A ready-to-use error catalog template is in references/error-catalog-template.md.

4. Classify side effects, then gate them

Sort every mutating tool into one of three tiers and treat each tier differently:

5. Make retries safe: idempotency

Agents retry. Networks drop. The tool must make "call it again" mean "finish it once":

6. Test like the agent will use it

Before shipping, run this gauntlet against the real implementation:

  1. Schema test: assert the generated schema has the right name, parameters, and required fields.
  2. Misroute test: give the tool a deliberately ambiguous prompt and check the description alone is enough to route correctly.
  3. Error recovery test: feed an invalid enum, a missing id, and a duplicate call; confirm each error contains a usable next step.
  4. Retry test: call a mutating tool twice with the same idempotency key; confirm exactly one effect and two equivalent responses.
  5. Dry-run test: run dry_run and confirm nothing changed, then apply and confirm the change matches the preview exactly.

Output Contract

For each tool you design, deliver:

Operating Rules

  1. Never ship a schema the agent has not called in a dry run. A schema you have not tested is a guess.
  2. Every factual claim about a tool's behavior (limits, TTLs, defaults) must be true of the implementation. If the implementation changes, the description changes with it.
  3. One tool, one job. When a tool grows a second verb, split it.
  4. Descriptions are load-bearing code. Review them with the same care as logic.
  5. When an agent misuses a tool twice the same way, the tool is wrong, not the agent. Fix the schema or the error message.
  6. No destructive test runs against production state. The test gauntlet runs against mocks or throwaway fixtures.

Versions

v1.0.02026-10-01 · 0 installs · Ed25519-signed./install.sh tool-design-for-agents 1.0.0bundle (.zip)

publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e

Ratings

No ratings yet — be the first to rate it.