Skills

How to compile a reusable browser skill

Turn a one-off agent run into a parameterized, reusable skill you can replay deterministically — and share across your team through the skill library and cross-tenant corpus.

A skill is the unit of reuse in Twin Browser: an ordered, parameterized program of browser actions distilled from a successful run. Compiling a skill is how you stop paying the planner for a workflow you have already solved. This guide covers how skills are created, parameterized, replayed, and shared.

What is a browser skill?

A skill is a compiled, deterministic representation of a task: the sequence of indexed-element actions that accomplished a goal, with the variable parts lifted out as parameters. Because it is deterministic, replaying a skill does not require the LLM — it executes the recorded plan against the live page and adapts to small drift.

How do I compile one?

Call compile_skill (via REST or the MCP tool) with a goal and a target URL. Twin runs the task, and on success stores the resulting skill in your library with an inferred parameter list. You can also let skills compile implicitly: any successful /api/v1/run is a candidate for compilation.

Compile a skillbash
curl -X POST https://twin-browser.com/api/v1/skills/compile \
  -H "Authorization: Bearer $TWIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://app.example.com/invoices",
    "goal": "Export invoices for a given month as PDF",
    "parameters": { "month": "string" }
  }'

How do I replay it deterministically?

Invoke the skill by id with concrete parameters using run_skill. The replay executes with zero LLM planning calls. If you would rather not name the skill explicitly, send the request to /api/v1/dispatch and let the semantic cache pick the right skill for you.

Replay a skillbash
curl -X POST https://twin-browser.com/api/v1/skills/run \
  -H "Authorization: Bearer $TWIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "skill_id": "sk_invoices_export", "parameters": { "month": "2026-05" } }'

What happens when the page changes?

Skills replay against indexed state, not brittle XPath, so small layout drift degrades gracefully — Twin adapts the cached skill rather than failing open to a full, expensive re-plan. When drift is large enough that adaptation is unsafe, Twin re-compiles, and the refreshed skill is what gets cached going forward.

How do skills get shared?

Skills live in your skill library and can be reused across your agents. Beyond your tenant, the cross-tenant skill corpus lets a skill compiled once be safely reused by others, so common flows benefit the whole network and your effective hit rate climbs over time.

Keep going

The mechanics behind this guide: the semantic dispatch cache, deterministic replay, and skill compilation. Plug Twin into MCP, LangChain, or the REST API, or see it applied to AI agents and RPA replacement. Weighing options? See how Twin compares.

Is replay production-ready or beta?
Production-ready. Deterministic replay is a shipped capability, not an experimental record-and-replay; it executes against indexed state and adapts to small drift rather than failing open.
Do I have to name the skill to reuse it?
No. You can call run_skill by id, or send the request to /api/v1/dispatch and let the semantic dispatch cache select the right skill from intent.
Is it safe to reuse skills across tenants?
Yes. The corpus is sanitized so a shared skill carries the action structure, not your data or credentials, which stay in your tenant behind default-deny RLS and the credential vault.

Run your first skill

Compile a task once, then replay it deterministically with zero LLM calls. Start free.