Documentation
¶
Overview ¶
Package skill loads and validates Prism Agent Skills from SKILL.md files.
Index ¶
- Variables
- func ExecutionLimitations(fsys fs.FS, name string) []string
- func LoadMany(fsys fs.FS, names []string) (map[string]*Skill, error)
- func Render(sk *Skill) ([]byte, error)
- func ValidateAuthoringStructure(fsys fs.FS, name string) error
- func ValidateDocument(data []byte, sourcePath string) error
- func ValidateEvals(fsys fs.FS, name string) (int, error)
- func ValidatePortableStructure(fsys fs.FS, name string) error
- func ValidateStructure(fsys fs.FS, name string) error
- type EvalCase
- type EvalExpected
- type EvalSuite
- type ReadResourceOptions
- type ReadResourceResult
- type ResourceEntry
- type Skill
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedTextResource = errors.New("resource is not valid UTF-8 text")
Functions ¶
func ExecutionLimitations ¶ added in v0.1.22
ExecutionLimitations reports runtime limitations separately from format validity.
func LoadMany ¶
LoadMany loads all named skills from fsys and returns a map keyed by skill name. All errors are collected so callers see every missing skill at once.
func Render ¶ added in v0.1.22
Render returns a normalized portable SKILL.md document. It is used when a managed skill is renamed so package frontmatter and manifest identity agree.
func ValidateAuthoringStructure ¶ added in v0.1.22
ValidateAuthoringStructure enforces strict bundled-skill authoring checks.
func ValidateDocument ¶ added in v0.1.22
ValidateDocument checks portable Agent Skills frontmatter without requiring the document to be mounted below a named skills root.
func ValidatePortableStructure ¶ added in v0.1.22
ValidatePortableStructure validates the portable skill package format. Only SKILL.md is required; references/, scripts/, and evals/ are optional.
Types ¶
type EvalCase ¶ added in v0.1.14
type EvalCase struct {
Name string `yaml:"name"`
Prompt string `yaml:"prompt"`
Expected EvalExpected `yaml:"expected"`
}
type EvalExpected ¶ added in v0.1.14
type ReadResourceOptions ¶ added in v0.1.22
type ReadResourceResult ¶ added in v0.1.22
type ReadResourceResult struct {
Path string `json:"path"`
MediaType string `json:"media_type"`
Size int64 `json:"size"`
Offset int64 `json:"offset"`
Truncated bool `json:"truncated"`
Content string `json:"content"`
}
func ReadResource ¶ added in v0.1.22
func ReadResource(fsys fs.FS, skillName, resourcePath string, opts ReadResourceOptions) (ReadResourceResult, error)
ReadResource reads a bounded UTF-8 text slice of a skill resource.
type ResourceEntry ¶ added in v0.1.22
type ResourceEntry struct {
Path string `json:"path"`
MediaType string `json:"media_type"`
Size int64 `json:"size"`
Binary bool `json:"binary"`
}
func ListResources ¶ added in v0.1.22
func ListResources(fsys fs.FS, skillName string) ([]ResourceEntry, error)
ListResources lists files under a skill directory, excluding SKILL.md.
type Skill ¶
type Skill struct {
// Required frontmatter fields per agentskills.io spec.
Name string `yaml:"name"`
Description string `yaml:"description"`
// Optional frontmatter fields Prism honours when present.
Compatibility string `yaml:"compatibility"`
Metadata map[string]string `yaml:"metadata"`
// Body is the Markdown body of SKILL.md after the frontmatter block.
Body string `yaml:"-"`
// Dir is the skill name (subdirectory name). For local installs callers may
// combine this with a base path to locate reference/script files.
// For remote FS the value is the skill name only (no absolute path).
Dir string `yaml:"-"`
}
Skill holds the parsed SKILL.md frontmatter and body for one Agent Skill.
func DiscoverAll ¶
DiscoverAll loads every skill subdirectory under fsys (the skills root FS). Structure and frontmatter validation errors are aggregated.
func LoadDir ¶
LoadDir resolves a skill by name from the given skills FS. It expects <name>/SKILL.md to exist within fsys.
func ParseDocument ¶ added in v0.1.22
ParseDocument parses a standalone portable SKILL.md document.
func (*Skill) CollectScriptPath ¶
CollectScriptPath returns the expected path to scripts/collect.sh within the given skills FS root. It does not guarantee the file exists.
func (*Skill) FullText ¶
FullText returns the skill content formatted for prompt injection. It includes a Markdown heading, the description, optional compatibility note, and the full skill body.
func (*Skill) MetadataSummary ¶
MetadataSummary returns a one-line summary for the skills index section ("progressive disclosure metadata phase").
func (*Skill) ReferenceContent ¶
ReferenceContent reads references/REFERENCE.md for the skill if present. fsys must be the skills root FS (the same one passed to LoadDir/LoadMany). Returns an empty string without error when the file does not exist.