pub struct SkillRegistry { /* private fields */ }Expand description
Skill registry for managing available skills
Provides skill registration, loading from directories, and lookup by name. Optionally validates skills before registration.
Implementations§
Source§impl SkillRegistry
impl SkillRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Create a registry with built-in skills
Sourcepub fn fork(&self) -> Self
pub fn fork(&self) -> Self
Fork this registry into an independent copy.
The fork shares no state with the original — skills added to the fork do not affect the source registry. The validator is preserved so that session and delegated-agent registries keep the same safety policy.
Sourcepub fn set_validator(&self, validator: Arc<dyn SkillValidator>)
pub fn set_validator(&self, validator: Arc<dyn SkillValidator>)
Set the skill validator (safety gate)
Sourcepub fn register(&self, skill: Arc<Skill>) -> Result<(), SkillValidationError>
pub fn register(&self, skill: Arc<Skill>) -> Result<(), SkillValidationError>
Register a skill with validation
If a validator is set, the skill must pass validation before registration. Returns an error if validation fails.
Sourcepub fn register_unchecked(&self, skill: Arc<Skill>)
pub fn register_unchecked(&self, skill: Arc<Skill>)
Register a skill without validation (for built-in skills)
Sourcepub fn load_from_dir(&self, dir: impl AsRef<Path>) -> Result<usize>
pub fn load_from_dir(&self, dir: impl AsRef<Path>) -> Result<usize>
Load skills from a directory
Recursively scans the directory for skill files and attempts to parse them.
Supported layouts:
path/to/skill.mdpath/to/skill/SKILL.md
Candidate files are processed in deterministic sorted order. Files that fail to parse are skipped with debug logging; validation failures are logged as warnings.
Sourcepub fn load_from_file(&self, path: impl AsRef<Path>) -> Result<Arc<Skill>>
pub fn load_from_file(&self, path: impl AsRef<Path>) -> Result<Arc<Skill>>
Load a single skill from a file
Sourcepub fn personas(&self) -> Vec<Arc<Skill>>
pub fn personas(&self) -> Vec<Arc<Skill>>
Get all persona-kind skills
Personas are session-level system prompts bound at session creation.
They are NOT injected into the global system prompt via to_system_prompt().
Sourcepub fn search(&self, query: &str, limit: usize) -> Vec<Arc<Skill>>
pub fn search(&self, query: &str, limit: usize) -> Vec<Arc<Skill>>
Search discoverable instruction/tool skills by name, tag, description, or content.
Sourcepub fn to_system_prompt(&self) -> String
pub fn to_system_prompt(&self) -> String
Generate system prompt content from all instruction skills
Concatenates the content of all instruction-type skills for injection into the system prompt. Persona-kind skills are excluded — they are bound per-session, not globally. Generate the system prompt fragment for this registry.
Only emits a skill directory (name + description) — NOT the full skill content.
Full content is injected on-demand via match_skills when a user request matches.
Sourcepub fn match_skills(&self, user_input: &str) -> String
pub fn match_skills(&self, user_input: &str) -> String
Return the full content of skills relevant to the given user input.
Matches by checking if any skill name or tag appears in the input (case-insensitive). Returns an empty string if no skills match — caller should not inject anything.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SkillRegistry
impl RefUnwindSafe for SkillRegistry
impl Send for SkillRegistry
impl Sync for SkillRegistry
impl Unpin for SkillRegistry
impl UnsafeUnpin for SkillRegistry
impl UnwindSafe for SkillRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more