cascade_agent/skills/types.rs
1//! Core types for the skill system.
2
3use serde::{Deserialize, Serialize};
4use std::path::PathBuf;
5
6/// JSON Schema describing the expected input format for a skill's executable.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct InputFormat {
9 pub content_type: String,
10 pub schema: serde_json::Value,
11}
12
13/// Metadata extracted from the YAML frontmatter of a SKILL.md file.
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct SkillMetadata {
16 /// Machine-readable skill name (used as tool name).
17 pub name: String,
18 /// Human-readable description for LLM decision-making.
19 pub description: String,
20 /// Optional version string.
21 #[serde(default, skip_serializing_if = "Option::is_none")]
22 pub version: Option<String>,
23 /// Tags for categorisation / discovery.
24 #[serde(default, skip_serializing_if = "Vec::is_empty")]
25 pub tags: Vec<String>,
26 /// Optional structured input format for the executable.
27 #[serde(default, skip_serializing_if = "Option::is_none")]
28 pub input_format: Option<InputFormat>,
29}
30
31/// A fully resolved skill, ready for execution or registration as a tool.
32#[derive(Debug, Clone)]
33pub struct Skill {
34 /// Parsed frontmatter metadata.
35 pub metadata: SkillMetadata,
36 /// The markdown body after the frontmatter (instructions for the LLM).
37 pub instructions: String,
38 /// Path to an executable script/binary inside the skill directory, if found.
39 pub executable_path: Option<PathBuf>,
40 /// The directory containing the skill's SKILL.md and any executables.
41 pub directory: PathBuf,
42}