Skills: Instructions on Demand¶
A skill is a named piece of markdown. When the model invokes the Skill tool with a skill's name, that markdown lands in the conversation as instructions to follow. The feature is that small, and the design question it answers is about token cost.
An agent that knows how to write changelogs, run quizzes, and produce trace digests needs detailed instructions for each. Putting them all in the system prompt means every request pays for all of them, on every turn, even though a given request uses at most one. Tool definitions also ride on every LLM request, so registering each bundle as a tool carries the same cost. The instructions need to exist somewhere the model can reach while staying out of the per-request payload.
flowchart LR
subgraph upfront ["Every request carries"]
T["Skill (meta-tool)\n- changelog: one line\n- mash-quiz: one line\n- trace-digest: one line"]
end
subgraph lazy ["Loaded only when invoked"]
C["changelog SKILL.md\n(full instructions)"]
Q["mash-quiz SKILL.md"]
D["trace-digest SKILL.md"]
end
T -- "Skill(name='changelog')" --> C
One meta-tool, N skills¶
Mash surfaces every registered skill through a single tool named Skill. The tool's description lists each skill's name and one-line description, and its input schema enumerates the valid names. The per-request cost of a skill is therefore one line of tool description; the full markdown is read only when the model asks for it.
The registration is automatic and gated by config:
# src/mash/core/agent.py: Agent.__init__ (trimmed)
if self.config.skills_enabled and self.skills.list_skills():
if "Skill" not in self.tools:
self.tools.register(SkillTool(self.skills))
skills_enabled defaults to True, so an agent that registers skills gets the meta-tool automatically. Set it to False to opt out. An agent with no skills never carries the meta-tool either way.
The skill itself¶
Skill is a frozen dataclass with two flavors distinguished by where the markdown lives:
# src/mash/skills/base.py
@dataclass(frozen=True)
class Skill:
type: str # "custom" (filesystem) or "dynamic" (inline)
name: str
description: str = ""
location: str | None = None # directory containing SKILL.md
content: str | None = None # inline markdown
A filesystem-backed skill is a directory with a SKILL.md whose frontmatter carries name and description; nothing else is parsed:
---
name: changelog
description: Generate a changelog entry from recent commits.
---
# Changelog
Scan the most recent commits, group them by area, and append
an entry to CHANGELOG.md following the existing format…
When the model invokes Skill(name="changelog"), the tool reads SKILL.md at invocation time and returns a JSON payload with the markdown plus its paths (base_path, skill_path), so instructions can reference files relative to the skill directory. Reading at invocation time also means editing a SKILL.md on disk takes effect on the next invocation.
A dynamic skill skips the filesystem: the markdown is supplied as content at registration. This is the flavor for instructions generated from another system, like an app that authors workflows elsewhere.
Registration¶
Every skill is registered in AgentSpec.build_skills() and lives with the codebase. A dynamic skill is registered there too, with its markdown fetched or generated when the spec builds its registry:
class PilotAgent(AgentSpec):
def build_skills(self) -> SkillRegistry:
registry = SkillRegistry()
registry.register(Skill(
type="dynamic",
name="workflow:experiment-readout:v1",
description="Execute Experiment Readout workflow v1.",
content=generated_markdown,
))
return registry
Mash surfaces skills; storing and versioning them is the owning application's job, which is why the example name carries a :v1.
Skills are not tools¶
A tool invocation makes something happen in the world and returns a result. A Skill invocation changes only what the model knows for the rest of the request; the returned markdown is input, not effect. That's why a skill carries only a name, a description, and markdown, while approval gating, parameter schemas, and result types stay with tools. It's also why one executor can serve every skill: executing a skill is just a read.
A workflow's agent step can name a skill to load before its work, as the workflows post covered. Skills add instructions to an agent. Remote tools add capabilities from servers outside the agent's process, and that's the next post.
Next: Remote Tools over MCP.