step01 · File-Based Skills

Teach an agent a capability from a folder of files — a SKILL.md manifest, resources, and scripts — loaded on demand via progressive disclosure.

Part 58 of 91 Microsoft Agent Framework Go — Every Lesson

What this lesson demonstrates

A skill is a directory on disk, not hand-written Go tool functions. Drop a SKILL.md manifest, some reference documents, and runnable scripts into skills/<name>/, point a skills ContextProvider at that tree, and the agent gains the capability. Skills load lazily by progressive disclosure: the model first sees only each skill’s name + description, then loads the full manifest when a task matches, then reads referenced resources and runs scripts — pulling in only what it needs, when it needs it. This lesson’s skill is unit-converter, with a conversion table the model reads and a convert.py it runs once per conversion.

The wiring

A file source scans the tree; the provider turns discovered skills into the agent’s tools:

func buildSkillsProvider(skillsRoot *os.Root) agent.ContextProvider {
    return skills.NewContextProvider(skills.ContextProviderOptions{
        Sources: []skills.Source{
            fsskills.NewSourceOptions(
                fsskills.SourceOptions{ScriptRunner: runSubprocessScript},
                skillsRoot.FS(),
            ),
        },
    })
}

The provider is then attached to the agent via agent.Config{ContextProviders: []agent.ContextProvider{skillsProvider}}. That single wire gives the agent three tools — load_skill, read_skill_resource, run_skill_script — plus the advertise-only instructions.

What to notice

How it maps to the Microsoft Agent Framework

Skills are a first-class integration point in the Agent Framework Go SDK, wired through the same ContextProviders slot other context providers use — so they compose cleanly with the rest of an agent’s configuration. Progressive disclosure keeps the model’s context lean: the advertise → load → read → run sequence means only the manifest headers are always present, and heavy resources or scripts enter the conversation only when a task actually calls for them.

Run it

cd tutorial/02-agents/skills/step01_file_based_skills && go run . (needs az login, FOUNDRY_PROJECT_ENDPOINT, and python on PATH). The offline tests cover wiring, skill discovery, and the script runner; the python end-to-end test skips when python is absent, and the live model call is gated behind AF_LIVE=1.


Next: 02 · Code-Defined Skills

Sources & References

The Go SDK this lesson exercises
File-based Agent Skills and progressive disclosure