skills

package
v0.1.115 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package skills holds the AI agent skills and rules for working with iximiuz Labs that `labctl skills install` puts into a project (or the user's home directory) in the formats that different AI agents read.

The kit is organized in bundles. Every bundle is a top-level folder with skills/<name>/SKILL.md (plus optional supporting files) and rules/<name>.md files. Skills are copied as is, and rules are rendered in each agent's own format (see layouts.go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentNames

func AgentNames() []string

func DetectAgents

func DetectAgents(home string) []string

DetectAgents returns the agents that seem to be installed on the machine (best effort, based on their files in the home directory).

func ResolveAgents

func ResolveAgents(names []string) ([]string, error)

ResolveAgents validates the agent names and returns them in the canonical order (without duplicates).

Types

type Action

type Action string
const (
	ActionCreate Action = "created"
	ActionUpdate Action = "updated"
	ActionRemove Action = "removed"

	// ActionTrack means an identical copy of the file was already in place,
	// and labctl started tracking it.
	ActionTrack Action = "tracked"

	// ActionSkip means the file was left as is because it was modified
	// locally (or is not labctl's) and --force wasn't given.
	ActionSkip Action = "skipped"
)

type Agent

type Agent struct {
	Name  string
	Title string
	// contains filtered or unexported fields
}

Agent describes where (and in which format) an AI agent reads skills and rules. The layouts follow the agents' docs as of October 2026.

func Agents

func Agents() []Agent

Agents returns the supported agents.

type Bundle

type Bundle struct {
	Name string

	Description string

	// ProjectOnly bundles rely on the content repository layout (e.g., their
	// rules are scoped to challenges/**, tutorials/**, etc.), so they can be
	// installed into a project but not into the user's home directory.
	ProjectOnly bool

	// Requires lists the bundles whose skills this bundle's skills refer to.
	Requires []string
}

type Change

type Change struct {
	// Path is the file path relative to the target root.
	Path   string
	Action Action
	Note   string
	// contains filtered or unexported fields
}

type Item

type Item struct {
	Name   string
	Kind   ItemKind
	Bundle string
	// contains filtered or unexported fields
}

Item is a single skill or rule of the kit.

type ItemKind

type ItemKind string
const (
	KindSkill ItemKind = "skill"
	KindRule  ItemKind = "rule"
)

type ItemState

type ItemState string
const (
	StateNotInstalled ItemState = "-"
	StateInstalled    ItemState = "installed"
	StateOutdated     ItemState = "outdated"
	StateModified     ItemState = "modified"
	StateMissing      ItemState = "missing"

	// StateConflict means a file that labctl didn't install takes the item's
	// place.
	StateConflict ItemState = "conflict"
)

type Kit

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

func Default

func Default() *Kit

Default returns the kit embedded into the labctl binary.

func New

func New(fsys fs.FS, bundles []Bundle) (*Kit, error)

func (*Kit) Bundle

func (k *Kit) Bundle(name string) (Bundle, bool)

func (*Kit) BundleNames

func (k *Kit) BundleNames() []string

func (*Kit) Bundles

func (k *Kit) Bundles() []Bundle

func (*Kit) Item

func (k *Kit) Item(name string) (Item, bool)

Item finds a skill or rule by its name.

func (*Kit) Items

func (k *Kit) Items() []Item

Items returns all skills and rules of the kit (bundle by bundle, skills first).

func (*Kit) Outdated

func (k *Kit) Outdated(t Target) (bool, error)

Outdated reports whether syncing the installed agents and bundles would change anything in the target.

func (*Kit) ResolveBundles

func (k *Kit) ResolveBundles(names []string) ([]string, error)

ResolveBundles validates the bundle names and adds the bundles they require. The result follows the kit's bundle order.

func (*Kit) Show

func (k *Kit) Show(name, agent string) ([]byte, error)

Show returns the main file of an item as the given agent sees it: the SKILL.md of a skill or the rule rendered in the agent's format.

func (*Kit) Status

func (k *Kit) Status(t Target, agents []string) (map[string]ItemState, error)

Status reports the state of every kit item for the given agents (keyed by the item name).

func (*Kit) Sync

func (k *Kit) Sync(t Target, opts SyncOptions) ([]Change, error)

Sync brings the target in line with the given agents and bundles: it creates and updates their files and removes the files labctl installed earlier that are no longer needed. It returns the changes it made.

type Manifest

type Manifest struct {
	// Version is the labctl version that made the last change.
	Version string `json:"version"`

	// Agents and Bundles are what the user asked to install.
	Agents  []string `json:"agents"`
	Bundles []string `json:"bundles"`

	// Files maps the installed files (relative to the target root) to their
	// bundles and content hashes at install time. A "<file>#<bundle>" key is
	// the bundle's section in an index file (e.g., AGENTS.md#authoring).
	Files map[string]ManifestEntry `json:"files"`
}

func LoadManifest

func LoadManifest(t Target) (m *Manifest, exists bool, err error)

LoadManifest reads the target's manifest. A missing manifest yields an empty one and exists == false.

type ManifestEntry

type ManifestEntry struct {
	Bundle string `json:"bundle"`
	SHA256 string `json:"sha256"`
}

type Rule

type Rule struct {
	Name string

	// Paths are the globs (relative to the project root) of the files the rule
	// applies to. A rule without paths always applies.
	Paths []string

	// Description is the rule's first top-level heading.
	Description string

	// Body is the rule's markdown without the frontmatter.
	Body []byte
}

Rule is a kit rule - a markdown instruction file - in an agent-neutral form.

type Scope

type Scope string

Scope tells where the kit is installed: into a project or into the user's home directory.

const (
	ScopeProject Scope = "project"
	ScopeUser    Scope = "user"
)

type SyncOptions

type SyncOptions struct {
	// Agents and Bundles to have installed (resolved, see ResolveAgents and
	// Kit.ResolveBundles). Everything else that labctl installed earlier is
	// removed.
	Agents  []string
	Bundles []string

	// Version of labctl to record in the manifest.
	Version string

	// Force overwrites and removes locally modified files (and overwrites the
	// files that labctl didn't install) instead of skipping them.
	Force bool
}

type Target

type Target struct {
	Scope Scope

	// Root is the project directory (ScopeProject) or the home directory
	// (ScopeUser). The installed files' paths are relative to it.
	Root string

	// Manifest is the path of the manifest file, where labctl records what it
	// installed, so that it can later tell its own unmodified files from the
	// user's ones.
	Manifest string
}

Target is where the kit is installed.

Jump to

Keyboard shortcuts

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