Help us shape the future of Go! Take the 2026 Go Developer Survey

skills

command
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

This sample demonstrates the Skills middleware, which offers the model a local library of specialised instructions stored as SKILL.md files.

The middleware injects a system prompt listing each skill's name and description, and registers a use_skill tool. The model picks the skill that fits and calls use_skill to load its full body into the conversation, so the heavier instructions stay off the hot path until they are wanted.

Five visually distinct skills ship here, so the effect is easy to eyeball: haiku, pirate, shakespeare, eli5, and limerick. The limerick skill also shows the third step: its SKILL.md keeps only the instruction and points at references/form.md, which the model fetches with read_skill_file when it needs the metre. That tool is registered because AllowResourceAccess is set.

Run it:

go run .

Or with the Dev UI, to watch the use_skill call in a trace of every run at http://localhost:4000/traces:

curl -sL cli.genkit.dev | bash    # install the Genkit CLI, once
genkit start -- go run .

Or over HTTP. The question decides which skill loads:

curl -N -X POST 'http://localhost:8080/askFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"question": "Write a haiku about debugging code."}}'

curl -N -X POST 'http://localhost:8080/askFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"question": "Explain recursion to me like I am five."}}'

curl -N -X POST 'http://localhost:8080/askFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"question": "Write a limerick about a flaky test."}}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL