teff.skill¶
teff.skill
¶
Skills — reusable instruction + tool-scope bundles loaded from folders.
Skills follow the open Agent Skills layout: <name>/SKILL.md holds
YAML frontmatter plus markdown instructions. A skill contributes
instructions to any LLM call (LLM node, ReActAgent/harness)
and can narrow which tools that call may use via allowed-tools /
disallowed-tools.
Example::
skills/data-analysis/SKILL.md
---
name: data-analysis
description: Answer questions over tabular data
allowed-tools: [csv_query, plot]
---
You are a data analyst. When asked about numbers, always query the
CSV first with the csv_query tool, then answer from its output.
flow.react(model="llama3.1:8b", skills=["data-analysis"], skill_dir="skills")
Classes:
| Name | Description |
|---|---|
Skill |
A loadable skill bundle. |
Functions:
| Name | Description |
|---|---|
core_skills |
Return the built-in core ( |
get_core_skill |
Return a core skill by name, or |
load_skill |
Load a skill from a folder or a |
resolve_skills |
Resolve |
scope_tools |
Filter the tool pool to what a node / its skills may use. |
skills_instructions |
Render skill instructions as a single block for the system prompt. |
Skill
dataclass
¶
A loadable skill bundle.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Skill name (defaults to the folder name). |
description |
str
|
What it does and when to use it. |
when_to_use |
str
|
Optional extra routing hints. |
instructions |
str
|
Markdown body injected into the system prompt. |
allowed_tools |
list[str] | None
|
If set, only these tools are visible to the call. |
disallowed_tools |
list[str]
|
Tools removed from the visible set. |
path |
Path | None
|
Directory the skill was loaded from ( |
builtin |
bool
|
True for skills bundled with teff (core/ |
Source code in teff/skill.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
core_skills
¶
core_skills()
Return the built-in core (teff-) skills.
Source code in teff/skill.py
137 138 139 | |
get_core_skill
¶
get_core_skill(name)
Return a core skill by name, or None if it does not exist.
Source code in teff/skill.py
142 143 144 145 146 147 | |
load_skill
¶
load_skill(path)
Load a skill from a folder or a SKILL.md file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Either a directory containing |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
Skill
|
class: |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no |
Source code in teff/skill.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
resolve_skills
¶
resolve_skills(cfg)
Resolve cfg["skills"] into a list of loaded skills.
Each entry may be a :class:Skill, a path to a skill folder or
SKILL.md file, or a bare name resolved against cfg["skill_dir"]
(default "skills" relative to the current directory).
Source code in teff/skill.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
scope_tools
¶
scope_tools(pool, cfg, skills=None)
Filter the tool pool to what a node / its skills may use.
cfg["use_tools"] may be None or an empty list (nothing),
"all" (everything), or a list of names to allow. (True/False
are also honoured for backwards compatibility.) Skills narrow the set
further: allowed_tools intersects with whatever the node allows,
disallowed_tools removes tools outright.
Source code in teff/skill.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
skills_instructions
¶
skills_instructions(skills)
Render skill instructions as a single block for the system prompt.
Source code in teff/skill.py
235 236 237 238 239 240 241 242 243 244 245 246 247 | |