Skip to main content

agent_base/skill/
mod.rs

1use std::sync::Arc;
2
3use crate::tool::Tool;
4
5pub mod detail_tool;
6pub mod prompter;
7
8pub(crate) use detail_tool::SkillDetailTool;
9pub use prompter::{FullDetailPrompter, LazySkillPrompter};
10
11/// Skill - a reusable capability unit
12///
13/// Each Skill declares:
14/// - Brief description (resident in system prompt)
15/// - Detailed description (loaded on demand)
16/// - Tool collection (auto-registered)
17pub trait Skill: Send + Sync {
18    fn name(&self) -> &'static str;
19    fn brief_description(&self) -> String;
20    fn detailed_description(&self) -> String;
21    fn tools(&self) -> Vec<Arc<dyn Tool>>;
22
23    fn version(&self) -> &'static str {
24        "0.1.0"
25    }
26
27    fn tags(&self) -> &[&'static str] {
28        &[]
29    }
30
31    fn author(&self) -> &'static str {
32        ""
33    }
34}
35
36/// Prompt injection strategy
37///
38/// Generates prompt text to inject into the system prompt based on registered skills.
39pub trait SkillPrompter: Send + Sync {
40    fn build_prompt(&self, skills: &[Arc<dyn Skill>]) -> String;
41}