Help us shape the future of Go! Take the 2026 Go Developer Survey

skill

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatForPrompt

func FormatForPrompt(skills []Skill) string

FormatForPrompt renders the catalog injected into the system prompt. Only skills with an on-disk Location are included — bundled skills appear here only after the user has invoked one (which materializes it). The slash-command picker UI lists everything regardless, so users still discover bundled skills from the very first turn.

func MaterializeBundled added in v0.6.2

func MaterializeBundled(s *Skill) (string, error)

MaterializeBundled writes a bundled skill's SKILL.md to ~/.wingman/skills/<name>/SKILL.md if it isn't already there, and updates the in-memory Skill so subsequent prompt builds in the same session see it as a "real" on-disk skill (with a `<location>` in the catalog).

Returns the absolute skill directory. From the next session the file is discovered as a personal skill, so the user can customize it freely without losing it on a wingman update.

Types

type Skill

type Skill struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	WhenToUse   string `yaml:"when-to-use"`

	// Arguments lists named argument placeholders (e.g., ["query", "file"]).
	// These are substituted as ${arg_name} in skill content.
	Arguments []string `yaml:"arguments"`

	// Location is the relative path to the skill directory (for file-based skills).
	Location string `yaml:"-"`

	// Content is the full skill prompt content (after frontmatter).
	// Set for bundled skills; file-based skills load content on demand.
	Content string `yaml:"-"`

	// Raw is the original SKILL.md bytes. Set for bundled skills so we can
	// materialize them to disk byte-for-byte (preserving frontmatter).
	Raw string `yaml:"-"`

	// Bundled indicates this skill is built-in (not from a SKILL.md file).
	Bundled bool `yaml:"-"`
}

func Discover

func Discover(root string) ([]Skill, error)

Discover scans the project's skill roots (.claude, .wingman, etc.) for SKILL.md files. Locations are returned relative to root.

func DiscoverPersonal added in v0.6.2

func DiscoverPersonal() ([]Skill, error)

DiscoverPersonal scans the user's home directory for personal skills under the conventional roots in personalSkillRoots. These are user-wide skills available across all projects. Locations are returned as absolute paths since they live outside any project root.

func FindSkill added in v0.6.2

func FindSkill(name string, skills []Skill) *Skill

FindSkill finds a skill by name (case-insensitive).

func LoadBundled added in v0.6.2

func LoadBundled(fsys fs.FS, root string) ([]Skill, error)

LoadBundled loads skills from an embedded filesystem. Skills are expected at <root>/<name>/SKILL.md within the filesystem.

func Merge added in v0.6.2

func Merge(bundled, discovered []Skill) []Skill

Merge combines bundled and discovered skills. Discovered skills with the same name as a bundled skill override the bundled version (allows user customization).

func MustDiscover added in v0.6.2

func MustDiscover(root string) []Skill

MustDiscover is like Discover but returns nil on error.

func MustDiscoverPersonal added in v0.6.2

func MustDiscoverPersonal() []Skill

MustDiscoverPersonal is like DiscoverPersonal but returns nil on error.

func (*Skill) AbsoluteDir added in v0.6.2

func (s *Skill) AbsoluteDir(workDir string) string

AbsoluteDir returns the absolute filesystem directory of the skill. Bundled skills that haven't been materialized yet return "".

func (*Skill) ApplyArguments added in v0.6.2

func (s *Skill) ApplyArguments(content, args, skillDir string) string

ApplyArguments substitutes argument and skill-dir placeholders in the skill content. Supports both brace and no-brace forms for cross-client compatibility (Claude Code uses $-prefix, agentskills.io uses ${...}):

${ARGUMENTS}, $ARGUMENTS                  → full args string
${SKILL_DIR}, $SKILL_DIR                  → absolute skill directory
${CLAUDE_SKILL_DIR}, $CLAUDE_SKILL_DIR    → same (Claude Code alias)
${ARGUMENTS[N]}, $ARGUMENTS[N]            → 0-based positional arg
${1}, $1, ${2}, $2, …                     → 1-based positional arg
${name}, $name                            → named args (last gets remainder)

Out-of-range positional indices substitute the empty string. Bare `$KEY` is word-bounded — `$message` substitutes, `$messagefoo` stays literal.

If no placeholder matched and args is non-empty, "\n\nARGUMENTS: <args>" is appended so the user's input still reaches the model. This mirrors Claude Code's appendIfNoPlaceholder behaviour.

func (*Skill) GetContent added in v0.6.2

func (s *Skill) GetContent(workingDir string) (string, error)

GetContent returns the skill's prompt content. For bundled skills, returns the embedded content. For file-based skills, reads the SKILL.md file. An absolute Location (e.g. personal skills under the user's home dir) is used as-is; a relative Location is resolved against workingDir.

Jump to

Keyboard shortcuts

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