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

skill

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDefaultsInstalled added in v0.1.1

func EnsureDefaultsInstalled(workspaceDir string) int

EnsureDefaultsInstalled materializes the embedded default pack into workspaceDir/.brocode/skills/<name>/SKILL.md and keeps them in sync with the binary's pack across upgrades:

  • Missing skill → installed (counted).
  • Installed, untouched → upgraded in place when the embedded version is newer (counted as an install/upgrade).
  • Installed, user-edit → NEVER touched; marked user-owned so later versions don't keep retrying.
  • Legacy install (no version state yet) → the current file is compared to the embedded content: identical = treated as the default (upgradeable later), different = user-owned.

Best-effort: a failure to write never breaks a session (the catalog just shows fewer entries).

func ProposeGotchasPatch added in v0.1.1

func ProposeGotchasPatch(skillDir, skillName string, gotchas []string) int

ProposeGotchasPatch appends repair-distilled gotchas to <skillDir>/GOTCHAS.md — a reviewable patch proposal for the skill's SKILL.md, so the skill evolves from real repairs in this project. It NEVER touches SKILL.md itself: keeping its content byte-identical to the installed default means the version-aware installer still applies official skill updates (a modified SKILL.md is marked user-owned and frozen from upgrades). Returns the number of NEW gotchas written (0 when nothing new or the directory is unusable).

Types

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader manages lazy loading of skill files.

func NewLoader

func NewLoader(workspaceDir string) *Loader

NewLoader initializes skill discovery across project and home locations.

func (*Loader) All

func (l *Loader) All() []Skill

All returns every loaded skill (used to inject the full skill list into the system prompt so the model knows what it can load).

func (*Loader) Match

func (l *Loader) Match(query string) []Skill

Match performs fuzzy matching against skill name and description.

type Skill

type Skill struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Path        string `json:"path"`
	Content     string `json:"content"`
	// Version is the skill's own frontmatter version (defaults start at 1).
	// The installer uses it to upgrade untouched default skills safely.
	Version int `json:"version,omitempty"`
	// Builtin marks skills from the embedded default pack (before they are
	// materialized to disk). After EnsureDefaultsInstalled they are regular
	// files and Builtin is false.
	Builtin bool `json:"builtin,omitempty"`
}

Skill represents a loaded SKILL.md document.

func DefaultSkills added in v0.1.1

func DefaultSkills() []Skill

DefaultSkills returns the embedded default pack as Skill values. They are not wired into any Loader; call EnsureDefaultsInstalled to materialize them onto disk, after which the regular Loader picks them up.

Jump to

Keyboard shortcuts

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