skills package - github.com/rnixai/rnix/skills - Go Packages

skills

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectSynergies

func DetectSynergies(skills []*SkillInfo) []string

DetectSynergies detects synergy matches among loaded skills. Returns a deduplicated, sorted list of emergent instructions.

func IsKnownToolName added in v0.9.4

func IsKnownToolName(v string) bool

IsKnownToolName reports whether v is a recognized semantic tool name. Exported for the kernel's spawn/specialize declared-value normalization (Story 54.5): it must distinguish a known meta tool (Complete / Agent — no device backing, so tools-only) from an unknown value (skipped), without duplicating this curated tool-name mirror in the kernel package.

Types

type LenientSkipError added in v0.9.1

type LenientSkipError struct {
	Path   string // absolute path to the offending SKILL.md directory
	Reason string // e.g. "missing description", "yaml parse error: ..."
}

LenientSkipError signals that a SKILL.md was non-fatally skipped during loading per agentskills.io lenient validation rules — e.g. missing description, missing name, or fully unparseable YAML. Callers can use errors.As to detect this and route the failure to a diagnostics channel rather than treating it as a hard load error. Story 47.2 AC7.

func (*LenientSkipError) Error added in v0.9.1

func (e *LenientSkipError) Error() string

type LenientWarning added in v0.9.1

type LenientWarning struct {
	Path   string // absolute path to the offending SKILL.md directory
	Field  string // "name" / "description" / ...
	Reason string // short categorical reason
	Detail string // human-readable details, including any truncated representation
}

LenientWarning describes a non-fatal SKILL.md issue that still permits the skill to be loaded (warn-but-load semantics — name mismatch with parent dir, name length > 64 chars). Story 47.2 AC6.

type SkillDiscovery

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

SkillDiscovery scans available skills and provides metadata for matching.

func NewSkillDiscovery

func NewSkillDiscovery(loader *SkillLoader, searchDirs []string) *SkillDiscovery

NewSkillDiscovery creates a new SkillDiscovery that scans searchDirs for skills. Directories are searched in order; the first occurrence of a skill name wins (shadow resolution).

func (*SkillDiscovery) DiscoverAll

func (d *SkillDiscovery) DiscoverAll() ([]SkillInfo, error)

DiscoverAll scans all search directories for valid skills and returns their metadata. Project-level skills shadow global skills with the same name (first directory wins). Invalid skills (missing or malformed SKILL.md) are silently skipped. Returns an empty list (not an error) if no directories exist or all are empty.

type SkillInfo

type SkillInfo struct {
	Manifest SkillManifest
	Body     string
	Dir      string // absolute path to the skill directory on disk
}

SkillInfo combines a skill's manifest with its body content.

type SkillLoader

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

SkillLoader loads skill definitions from multiple search directories.

func NewSkillLoader

func NewSkillLoader(searchDirs []string) *SkillLoader

NewSkillLoader creates a new SkillLoader that searches directories in order. The first directory containing the skill wins (shadow resolution).

func (*SkillLoader) LoadFull

func (l *SkillLoader) LoadFull(skillName string) (*SkillInfo, error)

LoadFull reads the complete SKILL.md file (frontmatter + body). Backward-compat shim: discards lenient warnings.

func (*SkillLoader) LoadFullWithDiag added in v0.9.1

func (l *SkillLoader) LoadFullWithDiag(skillName string) (*SkillInfo, []LenientWarning, error)

LoadFullWithDiag returns full SkillInfo plus any warn-but-load lenient warnings. Story 47.2 AC6 / AC7.

func (*SkillLoader) LoadMetadata

func (l *SkillLoader) LoadMetadata(skillName string) (*SkillInfo, error)

LoadMetadata reads only the YAML frontmatter of a SKILL.md file. Backward-compat shim: discards lenient warnings (Epic 2 callers stay 2-value). Lenient-skip errors still surface as plain errors so existing callers continue to treat them as load failures.

func (*SkillLoader) LoadMetadataWithDiag added in v0.9.1

func (l *SkillLoader) LoadMetadataWithDiag(skillName string) (*SkillInfo, []LenientWarning, error)

LoadMetadataWithDiag returns SkillInfo plus any warn-but-load lenient warnings. Lenient-skip cases (missing name/description, yaml errors) return a non-nil *LenientSkipError via the error return; callers should errors.As to detect. Story 47.2 AC6 / AC7 (dev-notes §4 method A).

type SkillManager added in v0.8.0

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

SkillManager handles runtime skill create/patch/delete operations. Operations are scoped to the project-level .rnix/skills/ directory.

func NewSkillManager added in v0.8.0

func NewSkillManager(projectSkillDir string) *SkillManager

NewSkillManager creates a new SkillManager.

func (*SkillManager) Create added in v0.8.0

func (m *SkillManager) Create(name, description, allowedTools, body string, callerDevices []string) error

Create writes a new SKILL.md file after triple validation.

func (*SkillManager) CreateSkill added in v0.8.0

func (m *SkillManager) CreateSkill(name, description, allowedTools, body string) error

CreateSkill implements the SkillWriter interface for writeback integration. It creates a skill without permission boundary checks (system-level operation).

func (*SkillManager) Delete added in v0.8.0

func (m *SkillManager) Delete(name string) error

Delete removes a skill directory. Only project-level skills can be deleted.

func (*SkillManager) Patch added in v0.8.0

func (m *SkillManager) Patch(name, newBody string, callerDevices []string) error

Patch updates the body of an existing SKILL.md, preserving frontmatter.

type SkillManifest

type SkillManifest struct {
	Name            string            `yaml:"name"`
	Description     string            `yaml:"description"`
	AllowedToolsRaw string            `yaml:"allowed-tools"`
	Metadata        map[string]string `yaml:"metadata"`
	Synergies       []SynergyDecl     `yaml:"synergy,omitempty"`
	SearchHint      string            `yaml:"search_hint,omitempty"` // keyword hint for discover_skill scoring
}

SkillManifest represents the parsed YAML frontmatter of a SKILL.md file.

func (*SkillManifest) AllowedTools

func (m *SkillManifest) AllowedTools() []string

AllowedTools returns the declared semantic tool names (e.g. Read, Bash, IntentDecompose). Legacy device-path declarations (/dev/fs, /dev/shell …) are still accepted during the Story 54.1 compatibility period; the kernel's spawn/specialize normalization maps either form to the process's AllowedTools (tool-level enforcement) + AllowedDevices (device-root routing) per Story 54.5. The raw value is a space-separated string per Agent Skills standard.

type SynergyDecl

type SynergyDecl struct {
	With        string `yaml:"with"`        // target Skill name
	Instruction string `yaml:"instruction"` // emergent instruction appended to system prompt
}

SynergyDecl declares a synergy with another Skill.

Jump to

Keyboard shortcuts

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