skill

package
v0.1.45 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 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(targetDir string) int

EnsureDefaultsInstalled materializes the embedded default pack into the given directory (either global ~/.config/brocode/skills or a specific test directory) 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 EnsureGlobalDefaultsInstalled added in v0.1.36

func EnsureGlobalDefaultsInstalled() int

EnsureGlobalDefaultsInstalled materializes the embedded default pack into ~/.config/brocode/skills/<name>/SKILL.md (the user's global config root) so all repositories on this machine have access to up-to-date default skills without polluting each individual repository with a .brocode/skills/ folder.

func GlobalSkillsDir added in v0.1.36

func GlobalSkillsDir() string

GlobalSkillsDir returns the default user-level skills directory (~/.config/brocode/skills).

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 (.brocode/skills) and global (~/.config/brocode/skills) locations. Project-specific skills take precedence over global skills with the same name.

func NewLoaderWithDirs added in v0.1.36

func NewLoaderWithDirs(workspaceDir, globalDir string) *Loader

NewLoaderWithDirs initializes skill discovery across explicit project and global 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