skills

package
v0.16.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package skills owns the catalogue of skills shipped with sprout. The library/ subdirectory is embedded into the binary at compile time; the discovery functions in this file are the single source of truth that every higher-level consumer routes through:

  • pkg/configuration uses Builtins() to seed Config.Skills
  • pkg/agent uses ReadContent() to load a skill's body for the LLM
  • cmd/skill uses Builtins() to render `sprout skill list`

The previous arrangement kept the embed in pkg/agent and the registry in pkg/configuration with no cross-reference, so adding a skill on disk silently did nothing until a hand-written entry was also added to defaultSkills(). New skills now drop in by creating a directory under library/ with a valid SKILL.md frontmatter — nothing else.

Index

Constants

View Source
const LegacyLogicalPath = "pkg/agent/skills"

LegacyLogicalPath is the pre-refactor location of embedded skills. Retained so the configuration prune step (which deletes config.Skills entries whose Path matches a builtin prefix but whose ID is no longer in the default set) recognises legacy paths persisted in older user configs and migrates them cleanly.

View Source
const LogicalPath = "pkg/skills/library"

LogicalPath is the repo-relative path of the embedded library, used as the Path metadata on Builtin entries. Other layers (configuration prune logic, user-facing displays) check for this prefix to identify builtins. Exported so those callers don't hardcode a string that could go stale if the package moves.

View Source
const SkillFileName = "SKILL.md"

SkillFileName is the file inside each skill directory whose YAML frontmatter supplies the skill's metadata. Exported so callers that resolve user/project skills from disk can reuse the same convention.

Variables

This section is empty.

Functions

func Builtins

func Builtins() map[string]Builtin

Builtins walks the embedded library and returns one entry per skill directory whose SKILL.md frontmatter parses successfully. Directories without a SKILL.md, with malformed frontmatter, or with a missing name/description are skipped silently — the discovery test in this package asserts every shipped skill is valid, so silent skips in production runtime can only happen for skills added without going through the test gate.

func IDs

func IDs() []string

IDs returns the sorted list of built-in skill IDs. Convenience for callers that just want the names (e.g. cmd/skill's list output).

func ReadContent

func ReadContent(id string) (string, error)

ReadContent returns the full SKILL.md body for a built-in skill, including frontmatter. Callers responsible for activation (pkg/agent) pass this directly into the system prompt; the frontmatter is part of the message the LLM sees, matching the prior pkg/agent behaviour.

Types

type Builtin

type Builtin struct {
	ID          string
	Name        string
	Description string
	Path        string // logical path under the repo, e.g. pkg/skills/library/<id>
	Content     string
}

Builtin is the parsed metadata + body for a single embedded skill. Content is the entire SKILL.md including frontmatter; consumers that only want the body should strip the frontmatter themselves with a shared parser to avoid divergent interpretations of the format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL