Skip to content
The AI Agent Factory

16.2 Choosing the right piece

Approved by
Panaversity ·
9 min read

In everyday life. A kitchen has a recipe card, a kitchen scale and a lock on the cabinet that holds the cleaning chemicals. The card says what to do. The scale gives the same weight every time. The lock works even when nobody reads the card. You would not write "do not open the chemicals cabinet" on a recipe card and call it locked.

What you will learn. What belongs in a skill, and what belongs somewhere else: in code, in a setting, or in a piece you will build in a later chapter.

Why it matters. A skill is words, and an agent usually follows words. For a number or a "never", usually is not enough.

What belongs in a skill?

The steps of a job, where judgment is needed: what to do, in what order, what to report, and who gets the result. Two things do not belong in its words.

This part of the jobGoes inBecause
The steps, the order, the reportA skillThe agent needs guidance, and words give it
A number that must be exactTested code that the skill runsCode gives the same answer every time
A "never" that must always holdA setting in your toolA setting works even when instructions are ignored

Where do calculations go?

Into tested code, never into a skill's words. This is the rule from Chapter 13. A skill that says "add up the amounts" asks the model to do arithmetic. A skill that says "run the triage script and copy its totals" does not. So most good skills have a script beside them. The skill says when to run it and how to report what it printed.

What is the difference between a skill and a setting?

A skill guides. A setting enforces. "Never edit the AP export" in a skill's steps is a request. A permission setting that denies edits to data/ is a lock. If a "never" must hold every time, set the lock, and write the line in the skill as well, so the agent knows why.

What about the other pieces?

You build three more pieces in later chapters. For now, know what each is for.

PieceWhat it isUse it for
ConnectorA link that gives the agent data and tools from another systemAn accounting system, a database, a shared drive
SubagentA helper agent with its own context that reports backSide work whose reading would crowd the session
HookCode your tool runs before or after an action, which can block itAn approval gate

Chapter 17 builds a connector, and Chapter 25 builds a hook. Chapter 20 gives a connector its own screens inside the chat, called an MCP App.

And if the agent can already do the job well with the tools it has, such as reading a file, it needs no new piece at all.

How do I choose?

Ask these questions in order, and stop at the first yes. If a job has parts, ask for each part.

  1. Must it never happen? A setting or a hook.
  2. Is the data in another system? A connector.
  3. Must a number be calculated exactly? Your own tested code.
  4. Is it side work that would crowd the session? A subagent.
  5. Can the agent already do it well? A built-in tool, so nothing new.
  6. None of these? A skill.

A decision ladder of six questions, asked in order. Must it never happen? Then a hook or setting. Is the data in another system? Then a connector. Must a number be calculated exactly? Then your own tested code. Is it side work that would crowd the session? Then a subagent. Can the agent already do it well? Then a built-in tool. Otherwise, it is a procedure with judgment: a skill.

Figure 16.4. Choosing the piece. Reading a long contract is side work, so it goes to a subagent, even though the agent could read it in the main session.

At work. Ana and the builder place six AP jobs:

JobPieceWhy
Read the weekly invoice exportNothing newThe agent can already read a file
Compute due datesTested code: src/due-date.tsA number people act on
Sort invoices into piles and reportA skill, which runs a scriptSteps and a report shape, with the sorting in code
Look up a vendor in the accounting systemA connectorAnother system
Never edit data/A settingIt must hold even if instructions are ignored
Pause before scheduling a paymentA hookAn approval gate

Try it

Predict. On paper, place each job below as one piece, with one reason. Ask the six questions in order.

  • Read the files in docs/ to answer a question about how the team works.
  • Add up the open invoices for one vendor.
  • Write the weekly note to the controller, in the shape the controller wants.
  • Find a contract in the company's shared drive.
  • Never print a bank account number.
  • Read a 300-page contract to answer one question.

Check. In practice-16, send: "Here are my six placements. For each one, say whether you would place it differently, and why. Don't change anything." Then paste your list.

What you should see. In order: nothing new, tested code, a skill, a connector, a setting or hook, and a subagent. If you and the agent disagree on one, ask which of the six questions it answered differently.

The operating rule: put the steps in a skill, every number in tested code, and every "never" that must hold in a setting.

Building Skills and Plugins with Coding Agents

Question 1 / 7

0 answered

An agent must compute each invoice's due date the same way every time. Which piece?

Owner
Panaversity