Stable tool names and the catalog
What keeps the provider's prompt cache warm as skills load, how to test it, and how the catalog behaves as it grows.
Tool names are wire names (Tool.name), never variable names, and the tools array is built in a fixed order:
load_skill, then ambient tools by name, then bound tools in load order. The only question is what changes when a
skill loads. The guarantees below are for the model's own loads (load_skill): a router, trigger or code load puts the
skill's instructions in the session tier of the system prompt and binds its tools outright, so it changes the cached
prefix from that request on, under every exposure mode.
Bound: append only
# expose "bound": only bound tools are sent, appended in load order, so earlier tools never move.
bound = skills.configure(expose="bound").session()
await bound.call("load_skill", name="docs")
await bound.call("load_skill", name="refunds")
print(bound.prompt().tool_names) # ['load_skill', 'search_docs', 'lookup_order', 'issue_refund']// expose "bound": only bound tools are sent, appended in load order, so earlier tools never move.
const bound = skills.configure({ expose: "bound" }).session();
await bound.call("load_skill", { name: "docs" });
await bound.call("load_skill", { name: "refunds" });
console.log(bound.prompt().toolNames); // ["load_skill", "search_docs", "lookup_order", "issue_refund"]Deferred: nothing changes on a model load
# expose "deferred" (the Anthropic default): every bindable tool is declared up front with defer_loading, and
# load_skill's result surfaces the loaded ones, so the tools array is byte-identical before and after a load.
deferred = skills.session()
before = deferred.prompt().render("anthropic")
await deferred.call("load_skill", name="refunds")
after = deferred.prompt().render("anthropic")
print(names(after["tools"])) # ['load_skill', 'issue_refund (deferred)', 'lookup_order (deferred)', 'search_docs (deferred)']// expose "deferred" (the Anthropic default): every bindable tool is declared up front with defer_loading, and
// load_skill's result surfaces the loaded ones, so the tools array is byte-identical before and after a load.
const deferred = skills.session();
const before = deferred.prompt().render<{ tools: Array<{ name: string; defer_loading?: true }> }>("anthropic");
await deferred.call("load_skill", { name: "refunds" });
const after = deferred.prompt().render<{ tools: Array<{ name: string; defer_loading?: true }> }>("anthropic");
console.log(names(after.tools)); // ["load_skill", "issue_refund (deferred)", "lookup_order (deferred)", "search_docs (deferred)"]Test it
Scripted runs count prefix breaks the way a provider would see them, so a unit test can fail the day someone puts a timestamp in the system prompt.
# Count prefix breaks over a scripted conversation, per provider, the way a unit test would.
run = await script(load("refunds"), call("lookup_order", order_id="A-1001"), say("Done.")).run(skills.session())
print(run.cache_invalidations_for("anthropic")) # 0 under deferred
print(skills.configure(expose="bound").session().prompt().shares_prefix_with(skills.session().prompt())) # True: the system prompt does not depend on expose// Count prefix breaks over a scripted conversation, per provider, the way a unit test would.
const run = await script(load("refunds"), call("lookup_order", { order_id: "A-1001" }), say("Done.")).run(
skills.session(),
);
console.log(run.cacheInvalidationsFor("anthropic")); // 0 under deferred
console.log(skills.configure({ expose: "bound" }).session().prompt().sharesPrefixWith(skills.session().prompt())); // true: the system prompt does not depend on exposeThe catalog
Sorted by name, so its bytes depend only on the registry. Over budget, entries shorten to their first sentence and
then to the name, lowest priority first. Above the catalog limit, a search_skills tool replaces the enum.
# The catalog lists loadable skills sorted by name, so its bytes depend only on the registry. Above catalog_limit
# it switches to search mode: a search_skills tool replaces the enum.
catalog = next(s for s in skills.session().prompt().sections if s.id == "catalog")
print((catalog.text or "").split("\n")[1]) # <skill name="accounts">Sign-in problems, ...</skill>
searching = skills.configure(catalog_limit=4).session()
print(searching.prompt().tool_names) # ['load_skill', 'search_skills']
found = await searching.call("search_skills", query="refund damaged order")
print(found.content.split("\n")[0])// The catalog lists loadable skills sorted by name, so its bytes depend only on the registry. Above catalog_limit
// it switches to search mode: a search_skills tool replaces the enum.
const catalog = skills
.session()
.prompt()
.sections.find((s) => s.id === "catalog");
console.log(catalog?.text.split("\n")[1]); // <skill name="accounts">Sign-in problems, ...</skill>
const searching = skills.configure({ catalogLimit: 4 }).session();
console.log(searching.prompt().toolNames); // ["load_skill", "search_skills"]
const found = await searching.call("search_skills", { query: "refund damaged order" });
console.log(found.content.split("\n")[0]);