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
//! SKILL.md frontmatter — the shared shape the descriptions-always
//! producer snapshots into `descriptions/skills/<name>.md` (ARCH §3.3
//! *Description-always*) and the tools composer reads back to fill a
//! tool entry's `description` (§3.3 point 3). Keeping the format in one
//! module is what stops producer and consumer drifting: the producer
//! extracts a SKILL.md's frontmatter body with [`frontmatter_yaml`] and
//! writes it verbatim; the consumer parses that stored body with
//! [`parse`]. One home for the fact (`docs/PRINCIPLES.md`, single source
//! of truth).
use Deserialize;
/// The YAML frontmatter fence line used by SKILL.md files.
const FENCE: &str = "---";
/// Typed view of the `name` + `description` a SKILL.md frontmatter
/// declares (ARCH §3.3). Extra keys are tolerated — only these two are
/// load-bearing (the `description` becomes the tool entry's
/// `description`; the `name` is retained for provenance).
/// The YAML body of a SKILL.md's leading `---` … `---` frontmatter
/// block, fences excluded, returned as a borrowed slice. `None` when the
/// text does not open with a `---` fence line or the block is never
/// closed. This is what the producer writes verbatim into
/// `descriptions/skills/<name>.md`.
/// Parse a stored `descriptions/skills/<name>.md` — the frontmatter YAML
/// body the producer wrote — into its typed fields.