1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! Parse, validate, and work with Agent Skills.
//!
//! This crate provides types and functions for working with Agent Skills
//! as defined by the [Agent Skills specification](https://agentskills.io).
//!
//! # Overview
//!
//! Agent Skills are directories containing a `SKILL.md` file with YAML frontmatter
//! and markdown instructions. This crate handles:
//!
//! - Parsing `SKILL.md` files (frontmatter + markdown body)
//! - Validating skills against the specification
//! - Loading skills from directories
//! - Accessing skill metadata, instructions, and referenced files
//!
//! # Quick Start
//!
//! ## Parsing a SKILL.md file
//!
//! ```
//! use agent_skills::Skill;
//!
//! let content = r#"---
//! name: my-skill
//! description: Does something useful.
//! ---
//! # Instructions
//!
//! Follow these steps...
//! "#;
//!
//! let skill = Skill::parse(content).unwrap();
//! assert_eq!(skill.name().as_str(), "my-skill");
//! assert!(skill.body().contains("# Instructions"));
//! ```
//!
//! ## Loading a skill from a directory
//!
//! ```no_run
//! use agent_skills::SkillDirectory;
//! use std::path::Path;
//!
//! let dir = SkillDirectory::load(Path::new("./my-skill")).unwrap();
//! println!("Loaded skill: {}", dir.skill().name());
//!
//! // Access optional directories
//! if dir.has_scripts() {
//! for script in dir.scripts().unwrap() {
//! println!("Script: {}", script.display());
//! }
//! }
//! ```
//!
//! ## Creating skills programmatically
//!
//! ```
//! use agent_skills::{Skill, Frontmatter, SkillName, SkillDescription, Metadata};
//!
//! let name = SkillName::new("my-skill").unwrap();
//! let desc = SkillDescription::new("Does something useful.").unwrap();
//!
//! let frontmatter = Frontmatter::builder(name, desc)
//! .license("MIT")
//! .metadata(Metadata::from_pairs([("author", "example")]))
//! .build();
//!
//! let skill = Skill::new(frontmatter, "# Instructions\n\nDo this.");
//! ```
//!
//! # Types
//!
//! - [`Skill`] - A complete skill with frontmatter and body
//! - [`Frontmatter`] - The YAML frontmatter header
//! - [`SkillName`] - A validated skill name
//! - [`SkillDescription`] - A validated skill description
//! - [`Compatibility`] - Environment compatibility requirements
//! - [`Metadata`] - Arbitrary key-value metadata
//! - [`AllowedTools`] - Pre-approved tool list (experimental)
//! - [`SkillDirectory`] - A loaded skill directory with file access
//!
//! # Errors
//!
//! - [`ParseError`] - Errors when parsing SKILL.md content
//! - [`LoadError`] - Errors when loading skill directories
//! - [`SkillNameError`] - Invalid skill name
//! - [`SkillDescriptionError`] - Invalid skill description
//! - [`CompatibilityError`] - Invalid compatibility string
// Re-export main types
pub use AllowedTools;
pub use ;
pub use ;
pub use ;
pub use ;
pub use SkillDirectory;
pub use Metadata;
pub use ;
pub use Skill;