Skip to content

Tutorials · Tutorial

Write your first skill

Write a skill that teaches an agent to buy daily prices from a paid API, check it until it passes, and pack it for upload. You need Node and a checkout of the repository, and no desk or wallet.

A skill named price-history for the Example Prices API at prices.example.com, an API that sells daily closing prices and asks for payment over x402. When an agent loads the skill, it knows when to call the API, how to call it, what it may spend there and whom it may pay.

A skill is a folder of text with two files:

  • SKILL.md: the instructions the agent reads.
  • shipped.json: the hosts the agent may call under the skill, what it may spend and whom it may pay. The runtime enforces this file, whatever the instructions say.

The finished skill is close to the price-history example, which you can compare it with at the end. Skills is the reference for every field used here.

You need Node 24 and a checkout of shippedagents/shipped-agents with npm ci run in it. Nothing is published to npm, so the command line runs from the checkout as npm run -s cli -- (the -s keeps npm’s own lines out of the output), and the skill’s folder sits in the checkout’s root while you work on it. Work from there:

cd shipped-agents
npm run -s cli -- skills init price-history
Started price-history in price-history.
SKILL.md the instructions the agent reads
shipped.json the hosts it may call, what it may spend and whom it pays
Next: write the steps in SKILL.md, fill in shipped.json, then run npm run cli -- skills check price-history.

The folder’s name becomes the skill’s name, so it has to be lowercase letters, digits and single hyphens. init writes a SKILL.md to fill in and a shipped.json with a comment on every field, and it refuses a folder that already exists and is not empty.

Open price-history/SKILL.md and replace everything in it with this:

---
name: price-history
description: >-
Buy daily closing prices for a token or a listed stock from the Example Prices API, paid per request over x402.
Use when the brief needs prices over a period and free sources do not have a close for every day of it.
compatibility: Written for Shipped Agents. Calls prices.example.com and pays it at most 0.05 USDG a request.
---
# Price history
The Example Prices API sells daily closes, one request per symbol and period. It answers an unpaid request with an
x402 offer in USDG on Robinhood Chain, which `http_request` pays within your limits.
## When to use it
Use it when the brief asks for prices over days, weeks or months. Do not use it for one current price: a free quote
page has that.
## Steps
1. Choose the symbol and the shortest period that answers the brief.
2. Call `http_request` with:
- `url`: `https://prices.example.com/v1/history?symbol=TSLA&from=2026-10-01&to=2026-10-31`
- `skill`: `price-history`
- `maxPay`: `0.05`
- `purpose`: what the prices are for, such as "Daily TSLA closes for the October chart".
3. The answer is JSON: `{ "symbol", "currency", "closes": [{ "date", "close" }] }`. Check that the first and last
dates are the ones you asked for.
4. If later work needs the closes again, save them with `notes_write`.
## When a call is refused or fails
- Status 402 with `paid: null`: nothing was paid, and `refused` says why. If the offer was over your `maxPay`, ask
once for a shorter period. Otherwise report it as stuck.
- `over_skill_requests`: this skill's requests for the task are used up. Work with what you have.
- Status 404: the API does not cover the symbol. Say so, and do not guess another symbol.
## What good output looks like
Name the source as "Example Prices API" with the date you called it. Give the period, the number of trading days and
the figures the brief asked for. List any missing days under stuck.

The parts that matter most:

  • The front matter between the --- lines. name matches the folder. description is the line an agent reads to decide whether the skill fits the work in front of it, so it says what the skill does and when to use it.
  • The steps name the tool each one uses. A call to prices.example.com runs under this skill because the skill declares that host, so its payee and limits apply; "skill": "price-history" keeps that so even if another active skill declares the same host. maxPay refuses any offer dearer than 0.05 USDG before anything is signed.
  • The refusals say what the agent sees and what to do. A payment the runtime refuses comes back as status 402 with paid: null and a refused line, and nothing is signed.

Check what you have so far:

npm run -s cli -- skills check price-history
SKILL.md
warning Mentions prices.example.com, which the manifest does not declare. Calls to it will be refused.
price-history 0.1.0 passes: 2 files, 3.7 KB, 1 warning.
hosts none
spend none
payees none
hash 0x11783e6671540f5cf9ab53a7adf70f02792c5495495aaaa926ad119445b087b6

The skill passes, with one warning: the instructions call a host that shipped.json does not declare yet, so the agent’s calls there would be refused. A warning never stops a skill. The next step clears this one.

Open price-history/shipped.json and replace everything in it with this:

{
"schema": 2,
"name": "price-history",
"version": "0.1.0",
// The only host the skill calls.
"hosts": ["prices.example.com"],
// USDG on Robinhood Chain, in its smallest unit (6 decimals): at most 0.05 a payment,
// 0.50 a task and 2 in any 24 hours.
"spend": [
{
"chainId": 4663,
"asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
"perCall": "50000",
"perJob": "500000",
"perDay": "2000000"
}
],
// The address the Example Prices API is paid at.
"payees": ["0x8ba1f109551bD432803012645Ac136ddd64DBA72"],
"secrets": [],
"mcp": [],
"limits": { "requests": 40 }
}

Line by line:

  • hosts lists every host the skill may call, written as the bare host name. A call under the skill to any other host is refused.
  • spend holds the most the skill may pay, for each chain and asset it pays in. Amounts are text in the asset’s smallest unit: USDG has 6 decimals, so "50000" is 0.05 USDG. These are ceilings for the agent: the API sets its own price in each offer, and a payment has to fit both this file and the agent’s own caps.
  • payees lists every address the skill may pay. A payment to any other address under the skill is refused, and a skill that spends has to name at least one.
  • limits.requests caps the HTTP requests one task makes under the skill, across restarts and resumed runs.
  • secrets and mcp stay empty: this API needs no key. MCP connectors and secrets by reference shows a skill that uses both.

The file may carry // and /* */ comments.

npm run -s cli -- skills check price-history
price-history 0.1.0 passes: 2 files, 2.5 KB.
hosts prices.example.com
spend 50000 a payment, 500000 a job, 2000000 a day of 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 on chain 4663
payees 0x8ba1f109551bD432803012645Ac136ddd64DBA72
requests 40 a task
hash 0xdccde7aaaa64d5333f0bda093543c483a551fe5deaa9aa800b4e3a11630a593b

The first line says the skill passes, with its file count and size. The lines under it are what the skill may reach and spend, read back from shipped.json, so you can see exactly what an agent would be allowed. The last line is the skill’s hash, which a seat’s public record shows for it.

The warning is gone, because the host the instructions call is now declared. skills check exits with 0 when the skill passes and 1 when it is refused.

A common mistake is to write a host as a URL. In shipped.json, change the hosts line to this:

"hosts": ["https://prices.example.com"],

Check again:

npm run -s cli -- skills check price-history
echo $?
shipped.json
problem hosts 1: "https://prices.example.com" is not a host name. Write the host alone, without https:// or a path, such as api.example.com.
price-history is refused: 1 problem. Fix the problems and run npm run cli -- skills check again.
1

Each problem is listed under the file it is about, with what to change. A refused skill cannot be installed on a seat or submitted to the catalog, and a desk skips it when it loads. Put the line back:

"hosts": ["prices.example.com"],

and run npm run -s cli -- skills check price-history once more. It passes with the same hash as before, since the files are back to the same bytes.

A seat installs a skill from a bundle: one JSON file holding every file of the skill, each in base64.

npm run -s cli -- skills pack price-history --out price-history.skill.json
Wrote price-history.skill.json: price-history 0.1.0, 2 files.
skill hash 0xdccde7aaaa64d5333f0bda093543c483a551fe5deaa9aa800b4e3a11630a593b
bundle hash 0x7d26e7c4f184b367d83330b5f693afda5d5b9a998617929b56bac6674627d00b
The skill hash is what a seat's record shows. The bundle hash is what a seat's client signs to install it.

pack checks the skill first and writes nothing when it is refused. The two hashes serve different readers:

  • The skill hash covers each file’s path and SHA-256. It is what a seat’s public record and the catalog show, and anyone holding the files can recompute it.
  • The bundle hash covers the bundle itself. It is what the seat’s wallet signs when it installs the skill, so the desk installs exactly the files you checked.

skills hash prints the skill hash on its own, for scripts:

npm run -s cli -- skills hash price-history
0xdccde7aaaa64d5333f0bda093543c483a551fe5deaa9aa800b4e3a11630a593b
  • Install the skill on a seat you hold, and give it secrets when a skill needs them: Skills and secrets on a seat. npm run -s cli -- seat skills <agentId> install ./price-history checks and packs the folder for you.
  • List it in the catalog so agents on other clients’ paid work can find and pay for your product: List your product.
  • Compare it with the price-history example, which adds a reference file the agent opens only when a step calls for it, and a publisher.
  • Look up every field and every rule the checker applies in Skills.