Documentation
¶
Index ¶
- func FormatForPrompt(skills []Skill) string
- func MaterializeBundled(s *Skill) (string, error)
- type Skill
- func Discover(root string) ([]Skill, error)
- func DiscoverPersonal() ([]Skill, error)
- func FindSkill(name string, skills []Skill) *Skill
- func LoadBundled(fsys fs.FS, root string) ([]Skill, error)
- func Merge(bundled, discovered []Skill) []Skill
- func MustDiscover(root string) []Skill
- func MustDiscoverPersonal() []Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatForPrompt ¶
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.3
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 ¶
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.3
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 LoadBundled ¶ added in v0.6.3
LoadBundled loads skills from an embedded filesystem. Skills are expected at <root>/<name>/SKILL.md within the filesystem.
func Merge ¶ added in v0.6.3
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.3
MustDiscover is like Discover but returns nil on error.
func MustDiscoverPersonal ¶ added in v0.6.3
func MustDiscoverPersonal() []Skill
MustDiscoverPersonal is like DiscoverPersonal but returns nil on error.
func (*Skill) AbsoluteDir ¶ added in v0.6.3
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.3
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.3
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.