Skill Build

Turn winning trajectories into named, reusable procedures.

The agent distils successful action sequences into reusable, named skills — often executable code — and stores them in a growing skill library it retrieves and composes on future tasks, instead of re-planning from scratch. This is procedural memory.

In practiceAn automation agent derives a reusable 'export-to-CSV' skill from three successful runs of that task, then calls it directly on subsequent similar requests without re-planning from scratch.

Level
04 · Production
Subdomain
Memory Architecture
Also known as
Procedural Memory, Skill Discovery, Reusable Skills
Trade-off
Continuous performance improvement is gained against the risk of overfitting or catastrophic forgetting of older skills.
Native in
AutoGen / AG2
The mechanism

How it works.

A solved task becomes a named piece of code, but only after a check has confirmed that it worked. The next task starts with a search of the library.

1 · Build, after a success

  1. Task solvedA program ran to the end
  2. VerifyA critic confirms the outcome
  3. Describe and embedThe description becomes the search key
  4. Skill libraryThe code, stored under its description

2 · Reuse, before the next task

  1. New taskBecomes the query
  2. Search the libraryThe five most similar descriptions
  3. ComposeThe new program calls stored skills
  4. Run and verifyA success may become a new skill
Skill
Executable code with a name, not a piece of advice in prose. It can be called, tested and read.
Verification
Only code that demonstrably achieved its task is stored. Unverified code would be reused with its bugs.
Composition
Complex skills call simpler ones, so the library grows in capability and not only in size.
Walk it through

A real run, step by step.

TaskAn automation agent with an empty skill library receives four requests in a row.
Illustrative call counts.
RequestLibraryWhat happensModel calls
Export the March orders as CSVEmptyPlans from scratch, fails once at pagination, succeeds. Stored as export_orders_csv(month).9
Export the April orders as CSV1 skillFinds the skill and calls it with month = April.2
Email the April orders to finance1 skillWrites email_report(), which calls export_orders_csv. Stored as a second skill.5
Export the April refunds as CSV2 skillsFinds export_orders_csv, because the descriptions are similar. It reads the wrong table.2
What this shows: the second request costs two calls instead of nine, and the third builds on the first. The fourth returns a similar skill, not a correct one. A check after reuse catches it; without one, the agent delivers orders labelled as refunds.
In code

The pattern in code.

Plain Pythonpython
def solve(task):
    skills, feedback = library.search(embed(task), k=5), None
    for attempt in range(4):
        program = model(write_program(task, skills, feedback))
        result, feedback = run(program)
        if critic(task, result):  # stored only after verification
            library.add(embed(describe(program)), program)
            return result
    return None  # give up and take another task
Fit

Use it, or not.

When to reach for it

  • Recurring complex solution paths need to be optimized.
  • The agent must continuously adapt in a dynamic environment.

When it backfires

  • Tasks are strictly one-off.
  • The environment requires static, highly predictable behavior.
Pitfalls

Two ways this pattern will hurt you.

Skills overfit to a single trajectory

A skill is extracted from one successful run. It encodes accidental details — exact phrasing, ordering, tool choice — and breaks on the next variant.

Countermeasure

Require N successful runs of similar shape before promoting a candidate to a skill. Generalize parameters by diffing the runs.

A flawed skill silently poisons every task that reuses it

Once promoted, a skill is called without re-checking. A subtle bug — or a tool surface that later changed under it — now corrupts every downstream task that retrieves it.

Countermeasure

Attach a regression test to each skill; re-validate on promotion and whenever a referenced tool surface changes, and retire skills that fail rather than calling them blindly.

Framework support

Where Skill Build is native.

AutoGen / AG2agent skills / teachabilityNative
Microsoft Agent Frameworkemerging supportAdaptable

Search

Search patterns, frameworks, and pages.