skill#
- class baf.reasoning.skill.Skill(content, name=None, description=None)[source]#
Bases:
objectA named, markdown-based playbook the reasoning loop can inject as system context.
A Skill is a small, composable system prompt: a
name, an optionaldescription, and the markdowncontentto splice into the LLM’s system message at run time. Skills can be loaded from a string, from a single.mdfile, or from a folder of.mdfiles.Frontmatter (an optional
---block at the top of the file) is parsed as plainkey: valuelines. Recognised keys:name,description.- Parameters:
content (str) – the markdown text of the skill, optionally prefixed by a
--- ... ---frontmatter block.name (str) – the skill name. If not provided, falls back to
frontmatter['name'], then to the first H1 in the body.description (str) – a short description. If not provided, falls back to
frontmatter['description'].
- classmethod from_file(path)[source]#
Load a Skill from a markdown file.
If neither frontmatter nor a leading H1 supplies a
name, the file’s stem (filename without extension) is used.
- baf.reasoning.skill._extract_h1_title(body)[source]#
Return the text of the first H1 (’# Title’) in
body, or None.
- baf.reasoning.skill._parse_frontmatter(content)[source]#
Parse a leading
--- ... ---frontmatter block.Frontmatter is parsed as plain
key: valuelines (one per line). No YAML dependency is used. If the block is malformed (e.g., only an opening delimiter, or no recognisable key/value pairs), a warning is logged and the full content is returned untouched as the body.