pub struct SkillManager { /* private fields */ }Expand description
Manages skills compatible with OpenClaw
Implementations§
Source§impl SkillManager
impl SkillManager
pub fn new(skills_dir: PathBuf) -> Self
Sourcepub fn with_dirs(dirs: Vec<PathBuf>) -> Self
pub fn with_dirs(dirs: Vec<PathBuf>) -> Self
Create with multiple skill directories (for precedence)
Sourcepub fn set_registry(&mut self, url: &str, token: Option<String>)
pub fn set_registry(&mut self, url: &str, token: Option<String>)
Configure the ClawHub registry URL and optional auth token.
Sourcepub fn primary_skills_dir(&self) -> Option<&Path>
pub fn primary_skills_dir(&self) -> Option<&Path>
Get the primary skills directory (last in the list — user’s writable dir). Skills are loaded from first to last, with later dirs overriding earlier ones. Installation goes to the last dir (user-writable, highest priority).
Sourcepub fn load_skills(&mut self) -> Result<()>
pub fn load_skills(&mut self) -> Result<()>
Load skills from all configured directories Later directories have higher precedence (override earlier ones by name)
Sourcepub fn check_gates(&self, skill: &Skill) -> GateCheckResult
pub fn check_gates(&self, skill: &Skill) -> GateCheckResult
Check if a skill passes its gating requirements
Sourcepub fn get_skills(&self) -> &[Skill]
pub fn get_skills(&self) -> &[Skill]
Get all loaded skills
Sourcepub fn get_eligible_skills(&self) -> Vec<&Skill>
pub fn get_eligible_skills(&self) -> Vec<&Skill>
Get only enabled skills that pass gating
Sourcepub fn set_skill_enabled(&mut self, name: &str, enabled: bool) -> Result<()>
pub fn set_skill_enabled(&mut self, name: &str, enabled: bool) -> Result<()>
Enable or disable a skill
Sourcepub fn generate_prompt_context(&self) -> String
pub fn generate_prompt_context(&self) -> String
Generate prompt context for all eligible skills
Sourcepub fn get_skill_instructions(&self, name: &str) -> Option<String>
pub fn get_skill_instructions(&self, name: &str) -> Option<String>
Get full instructions for a skill (for when agent reads SKILL.md)
Sourcepub fn create_skill(
&mut self,
name: &str,
description: &str,
instructions: &str,
metadata_json: Option<&str>,
) -> Result<PathBuf>
pub fn create_skill( &mut self, name: &str, description: &str, instructions: &str, metadata_json: Option<&str>, ) -> Result<PathBuf>
Create a new skill on disk from name, description, and instructions.
Writes <primary_skills_dir>/<name>/SKILL.md with YAML frontmatter
and the supplied markdown body, then reloads the skill list so the
new skill is immediately available.
Sourcepub fn link_secret(&mut self, skill_name: &str, secret_name: &str) -> Result<()>
pub fn link_secret(&mut self, skill_name: &str, secret_name: &str) -> Result<()>
Link a vault credential to a skill so the skill can access it
via the SkillOnly policy.
Sourcepub fn unlink_secret(
&mut self,
skill_name: &str,
secret_name: &str,
) -> Result<()>
pub fn unlink_secret( &mut self, skill_name: &str, secret_name: &str, ) -> Result<()>
Unlink a vault credential from a skill.
Sourcepub fn get_linked_secrets(&self, skill_name: &str) -> Vec<String>
pub fn get_linked_secrets(&self, skill_name: &str) -> Vec<String>
Return the linked secrets for a skill (empty vec if not found).
Sourcepub fn remove_skill(&mut self, name: &str) -> Result<()>
pub fn remove_skill(&mut self, name: &str) -> Result<()>
Remove a skill by name. If it was installed from a registry, its directory is deleted from disk.
Sourcepub fn skill_info(&self, name: &str) -> Option<String>
pub fn skill_info(&self, name: &str) -> Option<String>
Return a human-readable summary of a skill.
Sourcepub fn search_registry(&self, query: &str) -> Result<Vec<RegistryEntry>>
pub fn search_registry(&self, query: &str) -> Result<Vec<RegistryEntry>>
Search the ClawHub registry for skills matching a query.
If the registry is unreachable, falls back to matching against locally-loaded skills so the user still gets useful results.
Sourcepub fn install_from_registry(
&mut self,
name: &str,
version: Option<&str>,
) -> Result<Skill>
pub fn install_from_registry( &mut self, name: &str, version: Option<&str>, ) -> Result<Skill>
Install a skill from the ClawHub registry into the primary
skills directory. Returns the installed Skill.
Sourcepub fn publish_to_registry(&self, skill_name: &str) -> Result<String>
pub fn publish_to_registry(&self, skill_name: &str) -> Result<String>
Publish a local skill to the ClawHub registry.
Sourcepub fn registry_url(&self) -> &str
pub fn registry_url(&self) -> &str
Return the registry URL for display or browser opening.
Sourcepub fn registry_token(&self) -> Option<&str>
pub fn registry_token(&self) -> Option<&str>
Return the registry auth token (if set).
Sourcepub fn auth_login(&self, username: &str, password: &str) -> Result<AuthResponse>
pub fn auth_login(&self, username: &str, password: &str) -> Result<AuthResponse>
Authenticate with ClawHub using a username and password. Returns the API token on success, which should be saved to config.
Sourcepub fn auth_token(&self, token: &str) -> Result<AuthResponse>
pub fn auth_token(&self, token: &str) -> Result<AuthResponse>
Authenticate with ClawHub using a pre-existing API token. Validates the token and returns the profile info.
Sourcepub fn auth_status(&self) -> Result<String>
pub fn auth_status(&self) -> Result<String>
Check authentication status (whether a token is configured and valid).
Sourcepub fn trending(
&self,
category: Option<&str>,
limit: Option<usize>,
) -> Result<Vec<TrendingEntry>>
pub fn trending( &self, category: Option<&str>, limit: Option<usize>, ) -> Result<Vec<TrendingEntry>>
Fetch trending / popular skills from the ClawHub registry.
Sourcepub fn categories(&self) -> Result<Vec<Category>>
pub fn categories(&self) -> Result<Vec<Category>>
Fetch available categories from the ClawHub registry.
Sourcepub fn profile(&self) -> Result<ClawHubProfile>
pub fn profile(&self) -> Result<ClawHubProfile>
Fetch the authenticated user’s profile from ClawHub.
Sourcepub fn starred(&self) -> Result<Vec<StarredEntry>>
pub fn starred(&self) -> Result<Vec<StarredEntry>>
Fetch the authenticated user’s starred skills from ClawHub.
Sourcepub fn registry_info(&self, skill_name: &str) -> Result<RegistrySkillDetail>
pub fn registry_info(&self, skill_name: &str) -> Result<RegistrySkillDetail>
Get detailed info about a registry skill (not a locally installed one).