Expand description
Reference library for Agent Skills.
skref is a Rust port of the Python skills-ref reference library. It
provides three operations over skill directories that each contain a
SKILL.md file:
validate— check a skill directory for correctness.read_properties— parse a skill’s frontmatter intoSkillProperties.to_prompt— render the<available_skills>XML block for agent prompts.
use std::path::Path;
use skref::{validate, read_properties, to_prompt};
let problems = validate(Path::new("my-skill"), false);
if problems.is_empty() {
let props = read_properties(Path::new("my-skill"), false).unwrap();
println!("Skill: {} - {}", props.name, props.description);
}
let prompt = to_prompt(&[Path::new("skill-a"), Path::new("skill-b")]).unwrap();
println!("{prompt}");Re-exports§
pub use constants::ALLOWED_FIELDS;pub use constants::CLAUDE_FIELDS;pub use errors::Result;pub use errors::SkillError;pub use models::SkillProperties;pub use parser::find_skill_md;pub use parser::parse_frontmatter;pub use parser::read_properties;pub use prompt::to_prompt;pub use validator::validate;pub use validator::validate_metadata;
Modules§
- constants
- Frontmatter field-name constants, in a neutral module that both
parserandvalidatorcan import without depending on each other. - errors
- Skill-related error types.
- models
- Data models for Agent Skills.
- parser
- YAML frontmatter parsing for
SKILL.mdfiles. - prompt
- Generate the
<available_skills>XML prompt block for agent system prompts. - validator
- Skill validation logic.
- yaml
- Minimal YAML frontmatter value model.