Skip to main content

SkillManager

Struct SkillManager 

Source
pub struct SkillManager { /* private fields */ }
Expand description

Manages skills compatible with OpenClaw

Implementations§

Source§

impl SkillManager

Source

pub fn new(skills_dir: PathBuf) -> Self

Source

pub fn with_dirs(dirs: Vec<PathBuf>) -> Self

Create with multiple skill directories (for precedence)

Source

pub fn set_registry(&mut self, url: &str, token: Option<String>)

Configure the ClawHub registry URL and optional auth token.

Source

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).

Source

pub fn load_skills(&mut self) -> Result<()>

Load skills from all configured directories Later directories have higher precedence (override earlier ones by name)

Source

pub fn check_gates(&self, skill: &Skill) -> GateCheckResult

Check if a skill passes its gating requirements

Source

pub fn get_skills(&self) -> &[Skill]

Get all loaded skills

Source

pub fn get_eligible_skills(&self) -> Vec<&Skill>

Get only enabled skills that pass gating

Source

pub fn get_skill(&self, name: &str) -> Option<&Skill>

Get a specific skill by name

Source

pub fn set_skill_enabled(&mut self, name: &str, enabled: bool) -> Result<()>

Enable or disable a skill

Source

pub fn generate_prompt_context(&self) -> String

Generate prompt context for all eligible skills

Source

pub fn get_skill_instructions(&self, name: &str) -> Option<String>

Get full instructions for a skill (for when agent reads SKILL.md)

Source

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.

Link a vault credential to a skill so the skill can access it via the SkillOnly policy.

Unlink a vault credential from a skill.

Source

pub fn get_linked_secrets(&self, skill_name: &str) -> Vec<String>

Return the linked secrets for a skill (empty vec if not found).

Source

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.

Source

pub fn skill_info(&self, name: &str) -> Option<String>

Return a human-readable summary of a skill.

Source

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.

Source

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.

Source

pub fn publish_to_registry(&self, skill_name: &str) -> Result<String>

Publish a local skill to the ClawHub registry.

Source

pub fn registry_url(&self) -> &str

Return the registry URL for display or browser opening.

Source

pub fn registry_token(&self) -> Option<&str>

Return the registry auth token (if set).

Source

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.

Source

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.

Source

pub fn auth_status(&self) -> Result<String>

Check authentication status (whether a token is configured and valid).

Source

pub fn trending( &self, category: Option<&str>, limit: Option<usize>, ) -> Result<Vec<TrendingEntry>>

Fetch trending / popular skills from the ClawHub registry.

Source

pub fn categories(&self) -> Result<Vec<Category>>

Fetch available categories from the ClawHub registry.

Source

pub fn profile(&self) -> Result<ClawHubProfile>

Fetch the authenticated user’s profile from ClawHub.

Source

pub fn starred(&self) -> Result<Vec<StarredEntry>>

Fetch the authenticated user’s starred skills from ClawHub.

Source

pub fn star(&self, skill_name: &str) -> Result<String>

Star a skill on ClawHub.

Source

pub fn unstar(&self, skill_name: &str) -> Result<String>

Unstar a skill on ClawHub.

Source

pub fn registry_info(&self, skill_name: &str) -> Result<RegistrySkillDetail>

Get detailed info about a registry skill (not a locally installed one).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more