# Chapter 1 — A Tutorial Introduction

> Build and test a revenue-bridge skill through five worked stages.

*Felix Reyes · The Skills Pack · First edition, 2026 · [CC BY 4.0](../LICENSE) · [Router](../SKILL.md)*

<a id="ch-tutorial"></a>

This chapter takes one recurring finance report, the FY2025 revenue bridge, and turns it into a pack that an agent host runs and a program checks, in five stages. Each stage is a folder in the companion files that you can install as it stands. Everything the later chapters take apart is assembled here once: the skill file, the script, the display block, the output contract, the house rules, the router, the shared layer, the checks and a host run.

The method has ten steps, and the five stages walk through all ten at speed. Section [1.10](01-a-tutorial-introduction.md#sec-tutorial-what-follows) lists them. Hosts change and models change, and a process split into what a program computes and what a person judges outlasts both, because the split lives in plain files that a host reads and a program checks.

## Five departments

<a id="sec-tutorial-departments"></a>

InterStationary is a fictional distributor of office and stationery supplies, with a calendar fiscal year and its books in US dollars. In FY2025 it had \$11,238K of revenue from 48 customers in three business lines, Enterprise, Mid-Market and SMB. It has five departments, Data, Finance, Legal, Sales and Product, each with a head and its own recurring deliverables: a weekly sales and margin dashboard, the revenue bridge, a weekly customer contract review summary, a monthly bookings and renewals report and a monthly product family performance report. Finance has sixteen such deliverables, and they are the sixteen leaf skills of the four packs this book builds.

Every department is about to install an agent host and write skills for its recurring work. Each will write its own instructions, down to the format of a figure and the names of a note’s headings, so five departments produce five sets of rules before any model reads one.

Take FY2025 revenue, `11238378.00` to the cent. Finance’s note prints `$11,238K`, a Data dashboard prints the exact figure, and Sales’ bookings and renewals report writes “11.2 million”. A reader who sees all three stops to check whether they agree. The top panel of Figure [1.1](01-a-tutorial-introduction.md#fig-five-departments) shows the five deliverables as five departments would write them alone.

What keeps two finance notes alike keeps five departments’ deliverables alike: a script prints the figures, every figure in the text matches what the script printed, the text has one voice, and each deliverable has a fixed shape. The first three are written once, as house skills that a central team keeps and copies into every department’s packs (the lower panel). Section [1.7](01-a-tutorial-introduction.md#sec-tutorial-pack) puts two of them in this chapter’s pack, and Chapter [8](08-the-shared-layer.md#ch-shared) keeps the copies in step.

**Figure — text equivalent.**

Without house skills, Data's sales and margin dashboard writes revenue as `11238378.00`, Finance's revenue bridge writes `$11,238K`, and Sales' bookings and renewals report writes `11.2 million`. Legal's customer contract review starts with Background; Product's family performance report starts with Summary. Each department has its own rules. With the shared `executive-voice`, `source-trace` and `company-branding` skills in `house/`, the reports share one voice and a Headline; the three revenue figures use `$11,238K`. Departments keep their own packs. Finance's four packs are management-reporting, variance-bridge, close-reconciliation and forecast-planning.

<a id="fig-five-departments"></a>

Five departments’ deliverables without and with house skills: one figure, FY2025 revenue, three ways above and one way below.

The tutorial takes the first of Finance’s deliverables in `org.csv`, the revenue bridge.

## The work by hand

<a id="sec-tutorial-by-hand"></a>

Each year Finance writes a revenue bridge: a page that walks prior-year revenue to current-year revenue, customer by customer, and says which customers drove the change. The input is the customer file for FY2024 and FY2025, one row for each of 48 customers. Each row has an id, a name, a segment, revenue in each year, and a timing amount: current-year revenue that billing attributes to a shift in the renewal date rather than to a change in what the customer buys.

The first six lines:

File: `data/interstationary/customers_fy24_fy25.csv` (lines 1–6).

```csv
customer_id,customer_name,segment,fy2024_revenue,fy2025_revenue,timing_amount
IS-001,Alder Logistics,Enterprise,687721.00,813460.00,0.00
IS-002,Birchway Foods,Enterprise,503177.00,0.00,0.00
IS-003,Cobalt Dental,Enterprise,887180.00,985703.00,53231.00
IS-004,Driftwood Media,Enterprise,466892.00,353493.00,0.00
IS-005,Ember Analytics,Enterprise,600256.00,735900.00,0.00
```

`bridge-note.md`

**Headline**

FY2025 revenue was \$11,238K against \$11,243K in FY2024, a change of (\$5K), or (0.04%).

**Bridge**

| Step | Amount |
| --- | --- |
| FY2024 | \$11,243K |
| Timing | \$53K |
| Loss | (\$1,288K) |
| Decline | (\$443K) |
| Upsell | \$1,211K |
| New | \$463K |
| FY2025 | \$11,238K |

**Drivers**

- Fenwick Legal lost (\$686K) and Birchway Foods lost (\$503K); 4 customers were lost in total.

- 23 customers upsold, led by Harbor Freight Partners, which added \$148K, and Ember Analytics, which added \$136K.

- 6 new customers added \$463K, led by Thistle Gardens at \$116K.

- Driftwood Media declined (\$113K) and Juniper Schools declined (\$107K). The data does not show why; contract or usage records would answer it.

**Data notes**

customers_fy24_fy25.csv, 48 rows, sha256 `742a2059e0fd`\
Each amount is rounded on its own, so the Bridge rows do not add exactly to FY2025.

<a id="fig-render-bridge-note"></a>

The revenue-bridge note a host wrote with this chapter’s pack. It passed every automated check, yet three Drivers bullets name two customers where the contract allows at most one (Section [1.9](01-a-tutorial-introduction.md#sec-tutorial-run)).

The preparer opens the file and totals both years. For each customer, the timing amount comes out of the current year, and the customer goes in one movement: Loss if it stopped buying, New if it started, Upsell if it bought more, Decline if it bought less, Flat if it bought the same. The preparer totals each movement and checks that the prior year plus Timing plus the four movements that have an amount (Flat has none) adds back to the current year. If it does not, a customer was placed twice or not at all. Then the preparer sorts each movement by size, picks the customers that matter, and writes the page: a headline, the bridge as a table, a few bullets on the movers, and the name of the source file.

Totalling and placing are arithmetic with a rule: every preparer gets the same answer, and so does a program. The adding-back is a check, a test with a yes-or-no answer. Choosing which customers to name and what to say about them is judgment. Writing it so that the reader can follow is a matter of the house’s rules. Chapter [3](03-sorting-the-work.md#ch-sorting) defines these four kinds of work and gives each its home.

The page is the deliverable: what the reader of the bridge receives. Figure [1.2](01-a-tutorial-introduction.md#fig-render-bridge-note) is one, written by a host with the pack this chapter builds (Section [1.9](01-a-tutorial-introduction.md#sec-tutorial-run)).

## A first skill

<a id="sec-tutorial-first-skill"></a>

A skill is a folder with a file named `SKILL.md` in it. The file, the skill file, has two parts: frontmatter between two `---` lines, and below it the instructions. If Markdown is new to you, Appendix [F](appendix-f-markdown-and-yaml.md#app-markdown) is a short primer.

The first stage is a skill that asks for the revenue bridge:

File: `examples/ch01/revenue-bridge-1/SKILL.md` (lines 1–4).

```markdown
---
name: revenue-bridge-1
description: Computes a prior-year to current-year revenue bridge by customer (timing, loss, decline, upsell, new) and writes a one-page commentary note. Use when asked for a revenue bridge, a PY-to-CY revenue walk, a customer bridge, why revenue changed year over year, or which customers drove the change. Needs a customer CSV with prior-year and current-year revenue columns.
---
```

File: `examples/ch01/revenue-bridge-1/SKILL.md` (lines 6–11).

```markdown
# Revenue bridge

The input is a customer CSV with one row per customer: `customer_id`,
`customer_name`, a prior-year revenue column, a current-year revenue column,
and an optional `timing_amount`, the current-year revenue that billing puts
down to a renewal-date shift.
```

File: `examples/ch01/revenue-bridge-1/SKILL.md` (lines 13–18).

```markdown
Build the bridge from prior-year to current-year revenue in seven rows: prior
year, Timing, Loss, Decline, Upsell, New, current year. Take each customer's
timing amount out first, then put the customer in one movement: Loss if it
stopped buying, New if it started, Upsell if it bought more, Decline if it
bought less, none if it bought the same. The rows must add up to the current
year to the cent.
```

File: `examples/ch01/revenue-bridge-1/SKILL.md` (lines 20–22).

```markdown
Write the note to `output/bridge-note.md`: a one-sentence headline with both
years and the change, the bridge as a table, two to four bullets naming the
customers who moved the most, and the name of the source file.
```

The frontmatter has two fields. The `name` must equal the name of the folder the file is in (the stage number is in the name because the five stages sit side by side in the companion files). The `description` says what the skill does and when to use it. A host reads every description it has at startup, to decide which skill to load for a request, and reads the instructions only when the skill is chosen. The description printed here is the one the finished skill keeps, and it does not change through the five stages. Chapter [4](04-the-skill-file.md#ch-skillfile) says why it has to stand alone.

The instructions are the preparer’s method in three paragraphs, and they ask the model to do all of it, arithmetic included. Nothing in this folder can tell you whether the model added correctly, because the figures in the note come from the same place as the prose and no program sees either. The next stage moves the arithmetic out.

Before that, check the folder with the validator in the companion files, which reports whether a skill or a pack meets the specification and this book’s rules:

File: `examples/ch01/outputs/validate-stage-1.txt` (lines 1–2).

```text
$ python3 tools/validate_pack.py --auto examples/ch01/revenue-bridge-1
examples/ch01/revenue-bridge-1: ok (split, 0/20 files, 0 bytes below the root)
```

`ok` means the name matches the folder, the description is within its limit and the frontmatter parses. The parentheses give two things: the shape (split for a skill installed alone, bundle for a pack, Chapter [7](07-packs.md#ch-packs)) and the file count below the root, which Section [1.7](01-a-tutorial-introduction.md#sec-tutorial-pack) explains.

To install the stage, copy its folder to wherever your host looks for skills. Chapter [12](12-the-host-interface.md#ch-hosts) says where that folder is on each host.

**Exercise 1-1.** Change the description of `revenue-bridge-1` so that it also triggers on “customer churn walk”. Keep it under 1,024 characters and check the folder with `python3 tools/validate_pack.py --auto`.

## A script does the arithmetic

<a id="sec-tutorial-script"></a>

The second stage adds the script, `scripts/bridge.py`, with its saved run under `output/`, and rewrites the instructions as steps that run it. In the frontmatter only the name changes.

The body opens by naming the two files the skill produces, `bridge.json` and `bridge-note.md`, then gives the steps:

File: `examples/ch01/revenue-bridge-2/SKILL.md` (lines 12–38).

```markdown
## Steps

1. Find the input CSV the user named. Open only its header row. It needs
   `customer_id`, `customer_name`, a prior-year and a current-year revenue
   column, and optionally `timing_amount`. If any are missing, ask.
2. Run the script, `scripts/bridge.py`. Its path is relative to the skill
   root, the folder that holds this SKILL.md:

       python3 <skill root>/scripts/bridge.py \
           --input <the CSV> --output output/bridge.json

   If the revenue columns are not named `py_revenue`/`cy_revenue` or
   `fyNNNN_revenue`, add `--py-col <name> --cy-col <name>`.
3. If the script exits with an error, show the error and stop. Exit code 3
   means the bridge does not reconcile; never report its figures. Before
   exit 0 the script checks that PY + Timing + Loss + Decline + Upsell + New
   = CY to the cent.
4. Read `output/bridge.json`. Use only the strings under `display`.
5. Write `output/bridge-note.md` in four parts:
   - Headline: one sentence with current-year revenue, prior-year revenue
     and the change with its percentage.
   - Bridge: a table from the prior year through Timing, Loss, Decline,
     Upsell and New to the current year.
   - Drivers: two to four bullets naming the customers or movements that
     drove the change.
   - Data notes: the input file's name, its row count and its hash, then
     display.rounding when it is not empty.
```

The script’s path is written from the skill root, with the placeholder `<skill root>` standing for wherever the skill was installed.

The script is a plain Python program that reads a CSV and writes a JSON file. Its docstring opens with what it is for:

File: `examples/ch01/revenue-bridge-2/scripts/bridge.py` (lines 1–7).

```python
#!/usr/bin/env python3
"""Revenue bridge: prior year to current year, by customer movement.

    PY + Timing + Loss + Decline + Upsell + New = CY

The model never computes these numbers. It runs this script, then writes
commentary using only the strings in the output's "display" block.
```

Below the docstring’s first line is the bridge identity: prior year plus Timing plus Loss plus Decline plus Upsell plus New equals the current year. The script checks it before it exits 0, and exits 3 when it fails. Exit 2 is bad input, such as a missing column, a non-numeric value or a timing amount larger than the current-year revenue. Step 3 of the skill file turns each code into an instruction.

The script builds its output in one place, the end of `build`. The last block gives the figures as strings for the note:

File: `examples/ch01/revenue-bridge-2/scripts/bridge.py` (lines 188–198).

```python
        "display": {
            "input": {"file": path.name, "rows": f"{counts['customers']:,}", "sha12": sha[:12]},
            **{k: fmt_k(v, places) for k, v in totals.items()},
            "change": fmt_k(change, places),
            "change_pct": "n/a" if pct is None else fmt_pct(pct),
            "counts": {k: f"{v:,}" for k, v in counts.items()},
            "movers": {k: [{"customer_name": e["customer_name"], "amount": fmt_k(e["amount"], places)} for e in v]
                       for k, v in top.items()},
            "rounding": f"Each amount is rounded on its own, so {' and '.join(off)}." if off else "",
        },
    }
```

The `totals` block, above this excerpt, has the exact figures to the cent, as strings. The `display` block has the same figures as the note prints them, `$11,238K`, `($443K)`, `(0.04%)`, with negatives in parentheses, and step 4 of the skill file says the model may use nothing else. The display block is the line Section [1.2](01-a-tutorial-introduction.md#sec-tutorial-by-hand) drew between arithmetic and judgment: anything that makes a number is compute and lives in the script, and the model copies these strings as they are.

Run the script on the customer file and it prints one line:

File: `examples/ch01/revenue-bridge-2/output/run.txt` (lines 1–3).

```text
$ python3 examples/ch01/revenue-bridge-2/scripts/bridge.py --input data/interstationary/customers_fy24_fy25.csv --output examples/ch01/revenue-bridge-2/output/bridge.json
FY2024 $11,243K -> FY2025 $11,238K change ($5K), (0.04%); reconciles to the cent. Wrote examples/ch01/revenue-bridge-2/output/bridge.json
exit 0
```

The line is for the person at the keyboard, and the JSON, 195 lines long, is for the model and the checks.

Its display block, down to the change:

File: `examples/ch01/revenue-bridge-2/output/bridge.json` (lines 111–125).

```json
  "display": {
    "input": {
      "file": "customers_fy24_fy25.csv",
      "rows": "48",
      "sha12": "742a2059e0fd"
    },
    "py": "$11,243K",
    "cy": "$11,238K",
    "timing": "$53K",
    "loss": "($1,288K)",
    "decline": "($443K)",
    "upsell": "$1,211K",
    "new": "$463K",
    "change": "($5K)",
    "change_pct": "(0.04%)",
```

The input block gives the file’s name, its row count and the first twelve characters of its hash. Section [1.5](01-a-tutorial-introduction.md#sec-tutorial-contract) has the note copy these into its data notes. Below what is printed here come the counts per movement, the movers (the three largest customers in each) and `rounding`.

Each display string is rounded on its own, so you cannot add them: `$1,211K` of Upsell and `($1,288K)` of Loss net to nothing the script printed, and a note that nets them has invented a figure. Where the rounded rows do not add to the rounded total, as here, `rounding` says so. The parentheses are part of the string too, because that is how an accountant reads a negative. The script alone decides where they go.

**Exercise 1-2.** In a copy of the CSV, set one customer’s `timing_amount` above its FY2025 revenue and run the script on the copy. Report the exit code and the message. The companion files save the same error, for another customer, as `examples/ch05/outputs/bridge-timing-error.txt`.

## An output contract

<a id="sec-tutorial-contract"></a>

A note with “a headline, a table, some bullets” can be checked only by reading it. A note with a fixed shape can be checked by a program, and the third stage gives the note that shape. Steps 1 to 4 are as before. Step 5 now points at a contract, and a step 6 asks the model to check its own note against the display block before it finishes.

The section it adds:

File: `examples/ch01/revenue-bridge-3/SKILL.md` (lines 36–57).

```markdown
## Output contract

The note has exactly these four sections, in this order:

    ## Headline
    One sentence: current-year revenue, prior-year revenue, and the change
    with its percentage.

    ## Bridge
    A table with columns Step and Amount, and these rows in this order:
    <PY label>, Timing, Loss, Decline, Upsell, New, <CY label>.

    ## Drivers
    Two to four bullets. Each names one customer from `display.movers` and
    joins its amount to the name with a verb ("Ember Analytics added
    $136K"), or gives one movement total with its customer count.

    ## Data notes
    One line in this form, with the backticks, where <file>, <rows> and
    <sha12> are the strings in display.input:
    <file>, <rows> rows, sha256 `<sha12>`
    If display.rounding is not empty, copy it whole on the next line.
```

File: `examples/ch01/revenue-bridge-3/SKILL.md` (lines 59–65).

```markdown
- Copy every figure exactly as it appears in `display`, including parentheses.
- Display figures are rounded. Never add them up or derive new figures from them.
- Use the labels from `labels` (for example FY2024) for the first and last rows.
- You choose which customers and movements to name and in what order. Do not
  name a cause the data does not show.
- See `references/definitions.md` for what each movement means and how the
  display rounds.
```

The contract asks for four sections in a fixed order, each once. The amounts in the Bridge are the display strings, and the first Data notes line copies the input block of the display block. That line is the note’s provenance: it says which file, and which version of that file, the figures came from. A reviewer who has the file can recompute the hash and confirm it. Section [1.8](01-a-tutorial-introduction.md#sec-tutorial-checks) turns the same idea into a check on every figure in the note. The bullets after the sections are the writer’s rules, and the last of them points at a reference, a file under `references/` that the model reads on demand.

Here the reference contains the movement definitions. They open with the identity and the rule that Timing comes out first, then give this table:

File: `examples/ch01/revenue-bridge-3/references/definitions.md` (lines 14–20).

```markdown
| Movement | Rule (per customer, CY after timing) | Amount |
| --- | --- | --- |
| New | No PY revenue; CY above zero | + CY |
| Loss | PY above zero; CY zero | - PY, the full prior-year amount |
| Upsell | PY above zero; CY above PY | + the increase |
| Decline | CY above zero and below PY | - the decrease |
| Flat | CY equal to PY, both above zero | no movement |
```

The table is the rule the script implements, in words a reader of the note can check, and the one place in the skill where the definitions are written.

A contract is worth writing only if a note can meet it. The note below, written by hand from the display block of Section [1.4](01-a-tutorial-introduction.md#sec-tutorial-script), nearly does. Two of its Drivers bullets join a customer to its amount with “at” where the skill asks for a verb:

File: `examples/ch01/variance-bridge/tests/fixtures/good-revenue-bridge.md` (lines 1–3).

```markdown
## Headline

FY2025 revenue was $11,238K against $11,243K in FY2024, a change of ($5K), or (0.04%).
```

File: `examples/ch01/variance-bridge/tests/fixtures/good-revenue-bridge.md` (lines 5–15).

```markdown
## Bridge

| Step | Amount |
| --- | --- |
| FY2024 | $11,243K |
| Timing | $53K |
| Loss | ($1,288K) |
| Decline | ($443K) |
| Upsell | $1,211K |
| New | $463K |
| FY2025 | $11,238K |
```

File: `examples/ch01/variance-bridge/tests/fixtures/good-revenue-bridge.md` (lines 17–26).

```markdown
## Drivers

- Losses of ($1,288K) across 4 customers, led by Fenwick Legal at ($686K).
- Upsell of $1,211K from 23 customers offset most of the loss; Harbor Freight Partners added $148K.
- 6 new customers added $463K, the largest Thistle Gardens at $116K.

## Data notes

customers_fy24_fy25.csv, 48 rows, sha256 `742a2059e0fd`
Each amount is rounded on its own, so the Bridge rows do not add exactly to FY2025.
```

It has one sentence, seven rows, three bullets and two lines of data notes. Every figure in it is a display string or the hash, so writing it took no arithmetic. The checks of Section [1.8](01-a-tutorial-introduction.md#sec-tutorial-checks) are tested on this note.

**Exercise 1-3.** From the display block in `examples/ch01/revenue-bridge-2/output/bridge.json`, write a note by hand that meets the stage-3 contract, with different drivers from the fixture. Put it in a run folder with the data file and the JSON, as Section [1.8](01-a-tutorial-introduction.md#sec-tutorial-checks) lays one out, and run the contract check on it.

**Exercise 1-4.** Add the bullet “Gross margin held at 41%.” to the good note and run the provenance check of Section [1.8](01-a-tutorial-introduction.md#sec-tutorial-checks) on it. Explain the detail line.

## House rules: the voice

<a id="sec-tutorial-voice"></a>

How the note reads is a rule of the house, and the fourth stage writes the rules down. The skill file gains two sections after the contract, Voice and Source trace, and otherwise changes only its name. The first:

File: `examples/ch01/revenue-bridge-4/SKILL.md` (lines 67–72).

```markdown
## Voice

- Lead with the answer. The first sentence states the result and its number.
- Sentences under 25 words. Plain verbs: grew, fell, offset, lost, added.
- Every claim about size carries its figure. No "significant", "strong",
  "robust" or "notable" without a number beside it.
```

File: `examples/ch01/revenue-bridge-4/SKILL.md` (lines 73–76).

```markdown
- Negative amounts in parentheses, exactly as the script prints them.
  Parentheses mean negative and nothing else: no asides in parentheses, and
  never a positive figure, a count or an account number in them. Use commas
  for an aside.
```

File: `examples/ch01/revenue-bridge-4/SKILL.md` (lines 77–78).

```markdown
- Name customers and movements; do not speculate about causes the data does
  not show. If a reader will ask why, say what data would answer it.
```

File: `examples/ch01/revenue-bridge-4/SKILL.md` (lines 79–83).

```markdown
- State a figure the script printed plainly: no hedge ("it appears", "may
  suggest"). Keep the known, the estimated, the inferred and the unknown
  apart: a forecast is an estimate, a cause the data does not show is
  inferred or unknown, and the note says which. No filler ("it is worth
  noting").
```

The Voice section writes down, once, what a good reviewer marks up on a first draft. One rule gives its reason: parentheses only for negatives, because a positive figure or a count inside them reads as a loss to an accountant, so an aside goes between commas. Each rule is checkable by a reader, and some of them by a program.

The Source trace section is the other half of the house’s rules: where a figure may come from. Every figure in a deliverable is copied from a script’s output, and the input file, its row count and its hash go in the data notes. If the figures and the source disagree, the skill stops.

The next skill, a budget-vs-actual commentary, needs these same two sections. Copy them in and the house has two copies of its rules, and when one changes the other does not. The fifth stage gives them one home.

**Exercise 1-5.** Rewrite the Drivers bullets of the host’s note in Figure [1.2](01-a-tutorial-introduction.md#fig-render-bridge-note) so that each bullet is one sentence, under 25 words, that leads with its figure and names one customer or one movement. Confirm that the contract and provenance checks still pass on the rewritten note.

## A pack: router and shared layer

<a id="sec-tutorial-pack"></a>

A pack is one skill folder containing the skills for one business job. By the specification it is a single skill with a `SKILL.md` at its root, free to contain any other files. Inside, it follows this book’s convention, which Appendix [A](appendix-a-reference-manual.md#app-reference) states in full.

The folder has four parts. The root `SKILL.md` is the router: the skill a host triggers, whose job is to say which files to read next. `skills/` contains the leaf skills, one folder per deliverable, and here the revenue bridge is the only leaf. `_shared/` is the shared layer: skills the model reads only when the router sends it there. Here it has two, both copies of house skills, and `_shared/house.lock` lists them with their hashes. `tests/` contains the checks and the test cases and is never shipped. Every path in every file is relative to the pack root, the folder the router is in.

The router for this stage, starting with its frontmatter:

File: `examples/ch01/variance-bridge/SKILL.md` (lines 1–10).

```markdown
---
name: variance-bridge
description: Builds revenue bridges for finance reviews. Use when asked for a revenue bridge or PY-to-CY walk, why revenue changed year over year, or which customers drove the change. Not for monthly reporting packs, account reconciliations or forward forecasts.
license: MIT
compatibility: Requires Python 3.9 or later (standard library only) and permission to run scripts. If scripts cannot run, the pack stops and says so; it never computes figures itself.
metadata:
  pack-version: "2.0.0"
  pack-standard: "skills-pack/1.0"
  house: "interstationary/2.0.0"
---
```

Three fields are new. `license` gives the terms the pack is released under, here MIT. `compatibility` says what the pack needs from a host (Python and permission to run scripts) and what it does without them: it stops and says so. `metadata` records the pack’s version, the convention’s version and `house`, which pins the house skills the pack copies to one release, here `interstationary/2.0.0`. Chapter [8](08-the-shared-layer.md#ch-shared) says what that buys. The description covers every leaf, which here is one, and says what the pack is not for.

Then the body, down to its routing table:

File: `examples/ch01/variance-bridge/SKILL.md` (lines 12–19).

```markdown
# Variance and Bridge pack

This pack holds one skill. Pick the row that matches the request, read
every file listed for it, then follow the skill. Read the files before
answering; do not answer from memory.

All paths in this pack, in every file, are relative to this file's folder
(the pack root).
```

File: `examples/ch01/variance-bridge/SKILL.md` (lines 21–24).

```markdown
| Request | Read first | Then read |
| --- | --- | --- |
| Revenue bridge, PY-to-CY walk, customer movement, why revenue changed year over year | `skills/revenue-bridge/SKILL.md` | `_shared/source-trace/SKILL.md`, `_shared/executive-voice/SKILL.md` |
| Anything else (monthly review, close, cash, scenarios) | Not in this pack | Say so and stop |
```

The first paragraph is the rule that makes a router work, and the table’s last row takes every other request. Below the table the file ends with three rules for every skill in the pack: figures come from scripts, a failed script stops the skill, and a missing input is asked for.

The routing table is the only place that joins a leaf to the shared layer. Every file the model needs for a request is one hop from the router, and a program can say which files a run should have read.

The two house skills contain the sections that left the leaf, with the bullets of Section [1.6](01-a-tutorial-introduction.md#sec-tutorial-voice) unchanged, and Appendix [B](appendix-b-the-house-skills.md#app-shared) prints both. The leaf is the fourth stage’s file without them, its paths written from the pack root: step 2 runs `skills/revenue-bridge/scripts/bridge.py`, and the placeholder is `<pack root>`.

The validator reads the pack as one thing:

File: `examples/ch01/outputs/validate-pack.txt` (lines 1–2).

```text
$ python3 tools/validate_pack.py --auto examples/ch01/variance-bridge
examples/ch01/variance-bridge: ok (bundle, 6/20 files, 17430 bytes below the root)
```

The `skills/` folder tells it the shape is bundle. It checks that every leaf has one routing row, every skill in `_shared/` is named in some row, every path exists and the lock agrees with the house release the router pins. It counts the files below the root, the lock file included, the router and `tests/` left out. The count is there because one host documents a limit of twenty companion files, and the validator warns past it (Section [7.6](07-packs.md#sec-packs-budget)).

**Exercise 1-6.** In a copy of the fifth stage, remove `_shared/source-trace/SKILL.md` from the router’s Then read column, run the validator and read its error. Say what a run would never read if the validator allowed it, and which test-kit file changes with a routing row.

## Checks

<a id="sec-tutorial-checks"></a>

The pack takes no figure in the note on the model’s word. Under `tests/` are checks that read what a host wrote, and a test case that says what to run and what to check. The case for the revenue bridge:

File: `examples/ch01/variance-bridge/tests/cases/revenue-bridge-fy25.json` (lines 1–13).

```json
{
  "id": "revenue-bridge-fy25",
  "skill": "revenue-bridge",
  "prompt": "Build the FY2025 revenue bridge for InterStationary from data/customers_fy24_fy25.csv and write the commentary note.",
  "inputs": {
    "data/customers_fy24_fy25.csv": "data/interstationary/customers_fy24_fy25.csv"
  },
  "artifacts": {
    "input": "data/customers_fy24_fy25.csv",
    "result": "output/bridge.json",
    "deliverable": "output/bridge-note.md"
  },
  "golden": "golden/revenue-bridge.json",
```

File: `examples/ch01/variance-bridge/tests/cases/revenue-bridge-fy25.json` (lines 14–27).

```json
  "reads": [
    "SKILL.md",
    "skills/revenue-bridge/SKILL.md",
    "_shared/source-trace/SKILL.md",
    "_shared/executive-voice/SKILL.md"
  ],
  "checks": [
    "script_identity",
    "independent_identity",
    "golden",
    "contract",
    "provenance"
  ]
}
```

The prompt is what a user would type: it names the input and the deliverable in business words, without mentioning the skill, the pack or the script, so that triggering and routing are under test too. The other keys list the inputs, the files the checks read, the golden file (the script’s own output on this input), the skill files the routing table requires, with the router first, and the checks in the order they run.

The five checks read the run folder from the outside. The script identity check recomputes the bridge identity from the result, and the independent identity check recomputes every movement from the raw CSV without using the script. The golden check compares the result with the golden file. The contract check compares the note with the shape of Section [1.5](01-a-tutorial-introduction.md#sec-tutorial-contract), and the provenance check finds every figure in the note and asks whether the script printed it.

The second case, `out-of-scope.json`, asks the pack to review the December accruals, which are another pack’s job. Its one check, `no_deliverable`, fails only if `output/bridge.json` or `output/bridge-note.md` turns up. Other files a host writes on its own are listed, and the check passes. The case tests the outcome the routing table’s last row is for: however the host answers the request, the pack writes nothing.

The checks are in `tests/checks.py`: a generic core, the same in every pack, and a table that says what each check means for this leaf. Chapter [9](09-testing.md#ch-testing) goes through both. The provenance check, from the core:

File: `examples/ch01/variance-bridge/tests/checks.py` (lines 355–365).

```python
def provenance(run: Path, case: dict) -> tuple[bool, str]:
    """Every figure in the deliverable is a display string, a figure inside one, or an input's hash."""
    result = _load_result(run, case)
    shown = _strings(result["display"])
    allowed = {_normalize(s) for s in shown} | {f for s in shown for f in figures_in(s)}
    allowed |= {h for i in _inputs_of(result) for h in (i["sha256"], i["sha256"][:12])}
    figs = figures_in(_skill(case).get("text_of", _read_text)(_artifact(run, case, "deliverable")))
    stray = sorted({f for f in figs if f not in allowed})
    if stray:
        return False, f"figures not printed by the script: {stray}"
    return True, f"all {len(figs)} figures trace to the script's display block"
```

It builds the set of every display string, every figure inside one and the input’s hash, and fails, listing the note’s figures that are not in the set. Whether a figure sits beside the customer or movement it belongs to is another question, and Chapter [6](06-output-contracts.md#ch-contracts) adds the check that asks it.

Run the checks on a folder laid out as a host would leave it, with the data file under `data/` and the good note of Section [1.5](01-a-tutorial-introduction.md#sec-tutorial-contract) beside the JSON under `output/`:

File: `examples/ch01/outputs/checks-good.txt` (lines 1–14).

```text
$ python3 examples/ch01/variance-bridge/tests/checks.py /tmp/run examples/ch01/variance-bridge/tests/cases/revenue-bridge-fy25.json
{
  "script_identity": {
    "passed": true,
    "detail": "PY + movements = 11238378.00, CY = 11238378.00"
  },
  "independent_identity": {
    "passed": true,
    "detail": "source PY 11243300.00, CY 11238378.00; every movement recomputes"
  },
  "golden": {
    "passed": true,
    "detail": "matches golden"
  },
```

File: `examples/ch01/outputs/checks-good.txt` (lines 15–24).

```text
  "contract": {
    "passed": true,
    "detail": "4 sections in order; sentences, tables, bullets and data notes follow the contract"
  },
  "provenance": {
    "passed": true,
    "detail": "all 22 figures trace to the script's display block"
  }
}
exit 0
```

All five pass, each with a line saying why. Provenance matched 22 figures, every one a display string or the hash.

Now plant a problem. Add one bullet to the Drivers of the same note, a figure of the kind a tired preparer reaches for:

```text
- Pipeline for next year stands at $9.9M.
```

Run the checks again. Four still pass: the note keeps its shape and the JSON is untouched. The fifth fails with the detail `figures not printed by the script: [’$9.9M’]`, and the exit code is 1. The script never printed `$9.9M`, so the figure has no source.

**Exercise 1-7.** Rebuild a run folder from any host run of Section [1.9](01-a-tutorial-introduction.md#sec-tutorial-run): copy the data file to `data/` beside a copy of its `output/`. Run the checks and confirm they pass. Then change one amount in the Bridge table of `bridge-note.md` and run them again; say which checks fail and why. Then restore the note and change one total in `bridge.json` instead; say which checks fail now, and which of them stops failing if you change the current-year total by the same amount.

## A host runs it

<a id="sec-tutorial-run"></a>

The runner in the companion files installs the pack on a host, without `tests/`, in a throwaway folder outside the repository, copies the case’s inputs in, gives the host the case’s prompt, and runs the checks on what it wrote. It is called a portability run because the runner is written to run the same cases on more than one host. Chapter [12](12-the-host-interface.md#ch-hosts) records what this edition ran. The host starts in a clean configuration, which keeps the machine’s own skills and settings out of the run, with trace tokens on: a string the runner appends to each installed skill file, which shows in the transcript when the file reached the model (Section [9.1](09-testing.md#sec-testing-reading) defines both).

<a id="tab-tutorial-run-checks"></a>

What the checks found in the first run on the first primary model, each detail line copied from its result file: every row passed.

| Check | Detail |
| --- | --- |
| *revenue-bridge-fy25* |  |
| `script_identity` | `PY + movements = 11238378.00, CY = 11238378.00` |
| `independent_identity` | `source PY 11243300.00, CY 11238378.00; every movement recomputes` |
| `golden` | `matches golden` |
| `contract` | `4 sections in order; sentences, tables, bullets and data notes follow the contract` |
| `provenance` | `all 24 figures trace to the script’s display block` |
| `sentinels` | `4/4 required files read` |
| `pack_unchanged` | `14 installed files unchanged` |
| *out-of-scope* |  |
| `no_deliverable` | `none of this pack’s outputs were written` |
| `sentinels` | `0/0 required files read; not read, not required: [’SKILL.md’, ’_shared/executive-voice/SKILL.md’, ’_shared/source-trace/SKILL.md’, ’skills/revenue-bridge/SKILL.md’]` |
| `pack_unchanged` | `14 installed files unchanged` |

The host’s note in Figure [1.2](01-a-tutorial-introduction.md#fig-render-bridge-note) has the same Headline, Bridge and Data notes as the fixture of Section [1.5](01-a-tutorial-introduction.md#sec-tutorial-contract), because the contract leaves the model little choice there. Only the Drivers differ. They name four movements and seven customers in the model’s own order and words.

The note still breaks the contract’s Drivers rule of at most one customer per bullet: three of its four bullets name two. The contract check counts bullets and does not read what each names, so no check in the stage enforces the rule, and it falls to the reviewer. The stage’s runs wrote six notes, three on each primary model. Four put two customers in some bullet, and the two that did not both came from the second primary model.

The runner adds the last two rows of Table [1.1](01-a-tutorial-introduction.md#tab-tutorial-run-checks). The trace tokens of the four skill files the case’s `reads` list requires all reached the transcript, and the fourteen installed files were unchanged after the run. There are fourteen because the router and the six files below it are copied into two skill folders (Section [12.2](12-the-host-interface.md#sec-hosts-discovery)).

In the out-of-scope case the host wrote none of the pack’s outputs, and the trace tokens show that it read none of the pack’s four skill files. It answered the accruals question on its own.

The stage ran both cases three times on each primary model, and all twelve runs passed with the same detail lines, apart from the provenance count. The runs are under `runs/`, in the two folders whose names begin `20261004-2356-ch01-`. Chapter [12](12-the-host-interface.md#ch-hosts) records the host, the models and the date. The run folder is the evidence a reviewer signs against.

**Figure — text equivalent.**

Process to skill: 1. Pick the process → problem screen; 2. Shadow it → work map; 3. Sort every step → sort sheet; 4. Write the skill → skill folder (tutorial stages 1–2); 5. Write the output contract → contract (tutorial stages 3–4); 6. Prove the skill → test plan. Skills to pack: 7. Group the skills → pack scope; 8. Route and share → router and shared layer; 9. Prove the pack → run results; 10. Roll out and measure → rollout plan. Tutorial stage 5 covers the grouping, routing and pack proof for variance-bridge.

<a id="fig-ten-steps"></a>

The ten steps, their worksheets, and where this chapter’s stages fall.

## What follows

<a id="sec-tutorial-what-follows"></a>

Figure [1.3](01-a-tutorial-introduction.md#fig-ten-steps) lists the ten steps the five stages walked, with each step’s worksheet, and shows which steps each stage covered.

Steps 1 to 3 happened in your head in Section [1.2](01-a-tutorial-introduction.md#sec-tutorial-by-hand), and Part I does them on paper, a worksheet each. Step 10, rolling the pack out, is Chapter [10](10-rolling-out-across-an-organization.md#ch-rollout). The pack’s next skill is budget-vs-actual, the monthly commentary on the P&L, and Part I builds it.
