Documentation
¶
Overview ¶
This sample demonstrates the Skills middleware, which makes a local library of "skills" — specialised instructions stored as SKILL.md files — available to the model on demand.
When the middleware is installed, it injects a system prompt listing every available skill (name + description) and registers a use_skill tool. The model inspects the list, decides which skill fits the user's request, and calls use_skill("<name>") to load that skill's full SKILL.md body into the conversation as further instructions.
Four tiny, visually distinct skills ship with this sample so the effect is easy to verify by eyeballing the response:
- skills/haiku/SKILL.md — reply as a strict 5-7-5 haiku.
- skills/pirate/SKILL.md — reply in full pirate voice ("Arr, matey!").
- skills/shakespeare/SKILL.md — reply in early modern English.
- skills/eli5/SKILL.md — reply as if explaining to a five-year-old.
SKILL.md files use an optional YAML frontmatter block for name and description; only the description surfaces in the listing, so models can keep the heavier persona instructions off the hot path until actually loaded.
To run:
go run .
In another terminal, trigger the pirate skill (default prompt):
curl -X POST http://localhost:8080/askFlow \
-H "Content-Type: application/json" \
-d '{}'
Trigger the haiku skill:
curl -X POST http://localhost:8080/askFlow \
-H "Content-Type: application/json" \
-d '{"data": "Write a haiku about debugging code."}'
Trigger the eli5 skill:
curl -X POST http://localhost:8080/askFlow \
-H "Content-Type: application/json" \
-d '{"data": "Explain recursion to me like I am five."}'
Trigger the shakespeare skill:
curl -X POST http://localhost:8080/askFlow \
-H "Content-Type: application/json" \
-d '{"data": "Describe a rainy Tuesday morning, but in the voice of Shakespeare."}'