How Agents Turn a Completed Task into a Reusable Skill

    Agents often remember that a job was done before but still replan from scratch. This article explains why config and chat memory are not enough, what a persistable skill should contain, how to propose and version skills after success, and how layered memory plus regression checks make verified workflows callable instead of anecdotal.

    After a one-off job such as cleaning a spreadsheet and writing it to a database, a similar request a week later often causes an agent to restate every step from zero. It may confirm that the topic was discussed before, yet it does not retrieve the successful path and run it. The usual failure is not that the model never saw the history; it is that the system never compiled experience into a callable capability.

    Where configuration-as-behavior stops

    A common pattern is to put preferences, constraints, and operating notes into long-term memory or a persona prompt. Richer instructions yield more stable behavior; missing notes fall back to generic reasoning and a fresh plan every time. The pattern is clear, versionable, and reviewable, but it has a hidden cost: maintainers must keep translating experience into documents.

    That approach has at least three gaps.

    First, recall is not invocation. Retrieving the fact that an import happened is not the same as selecting an executable procedure. Without tool bindings, parameter slots, and success criteria, memory is narration.

    Second, experience stays in natural language. Conversation steps carry environmental assumptions: source encoding, field mapping, whether the target table exists, whether failures roll back. If those assumptions are not structured, the model will guess again—and may “creatively” change the flow.

    Third, the user does the compilation. Asking people to hand-write successful cases as memory entries or new skills returns the abstraction work the agent should automate. For repetitive ops, data ingest, and report generation, that friction decides whether the tool stays in use.

    Configuration is still required. It draws the boundary: which data sources are allowed, which writes are forbidden, what output format is mandatory. Configuration answers what the agent may and may not do; skills answer how this class of work succeeded last time. They should not replace each other.

    What counts as a persistable skill

    A skill is not a chat summary. It is a process object with a contract. A task is usually worth saving only if it meets all of the following:

    • The goal can be restated: inputs, outputs, and success criteria in a sentence or two.
    • The steps can be reproduced: ordered actions that depend on tools or explicit checkpoints.
    • The result was verified: not the model claiming done, but query results, row counts, checksums, or user confirmation.
    • Differences can be parameterized: paths, table names, and date ranges change; the skeleton does not.

    A useful skill description typically includes: name, matching intent, input parameters, preconditions, step list, failure branches, idempotency notes, final verification, version, and source-task id. An illustrative structure:

    1. skill: tabular_import
    2. intent: clean tabular data and write it to a relational store
    3. params: [source_uri, target_table, column_map]
    4. preconditions:
    5. - confirm the target table exists; if not, stop and ask whether to create it
    6. - sample encoding and nulls
    7. steps:
    8. - parse and normalize fields
    9. - convert types using the mapping
    10. - batch write inside a transaction
    11. verify:
    12. - compare source row count with loaded row count
    13. - detect duplicate primary keys
    14. version: 3

    Field names are an engineering convention, not a product API. The point is a basis for “do it the same way next time,” not stuffing the whole transcript back into context.

    Propose save, do not wait for a command

    The experience gap is whether the system, after a completed trajectory, offers to save. Triggers should be rule-based, not a popup on every turn:

    • Multiple tools were used and final verification passed.
    • The user clearly accepted the result, or a correction then passed.
    • Intent is similar to past work, but no skill exists, or existing steps disagree.
    • Changes involving writes, permissions, or deletes are not auto-frozen; they need a second confirmation.

    The proposal should show the diff: which steps will be saved, which parts become parameters, which dangerous actions are excluded. After confirmation, write to the skill store and record which task and version it evolved from. A week later, if the user says “import this table the same way as last time,” the router should pick a skill from intent and parameter completeness instead of free-form planning.

    Proactivity also means defensive checks during execution: table existence before load, estimated rows before write, reconciliation after. Checks that proved necessary after a failure should merge into a new skill version, not remain trapped in one chat.

    Layer memory

    Calling everything “memory” muddles scheduling. In practice, at least four layers help:

    1. Session context: current goal, temp paths, unconfirmed choices. Short-lived; archive when the task ends.
    2. Preferences and policy: language, timezone, naming, whether auto-create tables is allowed. Slow-changing, human-maintained, constraints on every skill.
    3. Episode records: a given file failed on a given day because of date format. For explanation and audit; not executed by default.
    4. Skills: parameterized, testable, versioned procedures. Only this layer should be preferred when similar intent appears.

    If an episode is retrieved, the system may hint that last time failed on format, but it should not treat a failure chat as a runbook. Dispatch order: policy constraints → matching skill → checkpoints inside the skill → open planning only if the skill is missing or parameters are incomplete. That is how “remembering” becomes “calling.”

    Evolution, conflict, and safety

    Skills go stale. Schema changes, metric definitions, and tighter permissions can make old flows write wrongly. Each run should log a parameter summary, step version, tool return codes, and verification. Consecutive failures or user rejection should mark the version for revision, not silent retry.

    Revisions are explicit diffs. Adding “check that the target table exists” belongs in the changelog, with why: a missing table caused a write error, or it is a minimum pre-write safety check. Auto-merge only purely additive, side-effect-free checks; steps that delete, overwrite, or raise privilege need human approval.

    Conflict handling belongs in policy. If two skills match “import a table,” prefer the one most recently verified, with fuller parameter coverage, and lower risk, and show why the other was not chosen. Do not let the model mix steps from two undeclared versions.

    Writes should be designed for idempotency by default: dedupe on business keys, batch writes in a transaction, roll back on failure and keep error samples. The skill text should state that DROP is disallowed and that updates without WHERE are disallowed. Those are general data-engineering practices, not a platform-specific feature.

    How to accept the mechanism

    Regress on the same class of task; do not score tone:

    • After first success, does the system show steps and parameters to save before confirmation?
    • On a second request with only a new file and target table, does it hit the original skill at the same step version?
    • If the target is missing, does it stop at preconditions instead of writing?
    • After the user rejects a step, is a new version created while the old one remains replayable?
    • After policy becomes “no auto-create table,” do constraints override the skill rather than the skill bypassing policy?

    Metrics can stay simple: how often repeat work is re-narrated by humans, skill hit rate, first-pass rate after a hit, unauthorized write count. They measure an engineering loop, not marketing copy.

    A practical rollout

    You do not start with complex learning. Four steps: persist a successful trajectory as a structured draft; have a person confirm parameters and dangerous steps; replay with a fixed fixture (same small sample, same checks); only then let the router auto-match. Preference files still own principles; the skill library owns verified practice.

    Intelligence is not admitting that a chat happened. It is turning a verified flow into something executable, inspectable, and rollback-safe next time, and stopping to ask a person when boundaries change. Configuration owns permission and value judgments; skills own repeated labor. Designed separately, the agent stops starting from zero and starts being accountable for experience.