fabricatio_skill.capabilities.skill

Module containing the UseSkill capability for progressive skill resolution.

Classes

UseSkill

Mixin that provides progressive skill resolution for LLM calls.

Module Contents

class fabricatio_skill.capabilities.skill.UseSkill(/, **data: Any)

Bases: fabricatio_core.capabilities.usages.UseLLM, abc.ABC

Mixin that provides progressive skill resolution for LLM calls.

Skills are text-based instruction files (markdown) that provide context to LLM agents. Skill objects live in the global SkillRegistry; this class stores only their names as lightweight handles.

Pipeline levels:

Level 1 (Rust): scan / search / get — file discovery + keyword matching Level 2 (Python): select / distill — LLM-powered relevance + extraction Level 3 (Python): use_skill — full progressive pipeline (select → distill → ask)

skill_names: List[str] = None

Names of loaded skills available for this role/action (resolved via registry).

property skills: list

resolve current skill_names to live Skill objects.

Type:

Convenience

add_skills(skills: list, names: List[str] | None = None) Self

Register skills in the global registry and track their names here.

Parameters:
  • skills – Skill objects to register.

  • names – If given, only register skills whose name is in this list.

Returns:

Self for method chaining.

async select_skills(question: str, available: List[str] | None = None, **kwargs: Unpack[fabricatio_core.models.kwargs_types.LLMKwargs]) list

Use LLM to select skills relevant to a question.

Parameters:
  • question – The question/task to match skills against.

  • available – Skill name pool to select from. Defaults to self.skill_names.

  • **kwargs – LLM parameters.

Returns:

Skills deemed relevant by the LLM, in relevance order.

async distill_skills(question: str, skills: list, **kwargs: Unpack[fabricatio_core.models.kwargs_types.LLMKwargs]) str

Use LLM to extract the essential parts of skills relevant to a question.

Parameters:
  • question – The question/task to focus distillation on.

  • skills – Skills to distill.

  • **kwargs – LLM parameters.

Returns:

Condensed skill text relevant to the question.

async use_skill(question: str, *, names: List[str] | None = None, select: bool = True, distill: bool = True, in_content: bool = False, **kwargs: Unpack[fabricatio_core.models.kwargs_types.LLMKwargs]) str

Progressive skill resolution pipeline, then ask LLM.

Pipeline stages: 1. SELECT: pick relevant skills (forced by names, or LLM-powered) 2. DISTILL: extract essence (LLM-powered, or raw content) 3. RENDER: prepend distilled context to question, send to LLM

Parameters:
  • question – The question/task to solve.

  • names – Force-select these skill names (skips LLM selection). If None and select=True, uses LLM to pick from self.skill_names. If None and select=False, uses all self.skill_names.

  • select – Whether to use LLM for skill selection (default True).

  • distill – Whether to use LLM for distillation (default True).

  • in_content – Whether search_skills also matches within content body.

  • **kwargs – LLM parameters.

Returns:

LLM response with skill context injected.

async aask_with_context(question: str, context: str, **kwargs: Unpack[fabricatio_core.models.kwargs_types.LLMKwargs]) str

Ask LLM with arbitrary context prepended to the question.

Parameters:
  • question – The question/task.

  • context – Context text to prepend.

  • **kwargs – LLM parameters.

Returns:

LLM response.