skills

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package skills holds the Agent Skills (agentskills.io) that teach an agent to run lfr: setting up the server, researching and conceiving a newsletter, launching it, writing and sending each issue, learning from the numbers, and handling mailboxes. Skills are embedded in the binary and rendered with its facts, so a printed skill always matches the lfr that printed it.

Index

Constants

View Source
const (
	AgentsDir = ".agents/skills"
	ClaudeDir = ".claude/skills"
)

Skill folders, relative to a project or home directory. Codex, Cursor, OpenCode, Gemini CLI and GitHub Copilot read .agents/skills; Claude Code reads .claude/skills.

Variables

View Source
var Newsletter = []string{"mailbox", "research", "concept", "launch", "issue", "learn"}

Newsletter are the skills a newsletter project needs: its own steps, and the mailbox skill for reading readers' replies. Server setup belongs to the operator's own skills (lfr skills install).

View Source
var Readers = map[string]string{
	AgentsDir: "Codex, Cursor, OpenCode, Gemini CLI and GitHub Copilot",
	ClaudeDir: "Claude Code",
}

Readers names the agents that read a folder.

Functions

func Topics

func Topics() []string

Topics lists every skill's topic in lifecycle order.

Types

type Change

type Change struct {
	Name   string `json:"name"`
	Path   string `json:"path"`
	Action string `json:"action"` // created, updated, unchanged, kept, replaced, removed
	Reason string `json:"reason,omitempty"`
}

Change is what Install did with one skill.

func Install

func Install(dir string, data Data, force bool, topics ...string) ([]Change, error)

Install writes every skill into dir as <name>/SKILL.md. Copies somebody edited, and SKILL.md files lfr did not write, are kept unless force is set; untouched copies of skills this binary no longer has are removed.

type Copy

type Copy struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Version string `json:"version,omitempty"`
	State   State  `json:"state"`
}

Copy is one lfr skill found on disk.

func Find

func Find(dir string, data Data) []Copy

Find lists the lfr skills an agent working in dir may load: the skill folders of dir and every directory above it, including the home directory.

func Scan

func Scan(dir string, data Data) ([]Copy, error)

Scan lists the lfr skills in one skills folder.

type Data

type Data struct {
	Version string
	// Newsletter project layout and minimums, filled by the project package.
	Project map[string]any
}

Data is what a skill template refers to, with [[ ]] delimiters.

type Folder

type Folder struct {
	Rel string
	Why string
}

Folder is a skills folder chosen for installing, with the reason.

func Choose

func Choose(base string, data Data, getenv func(string) string) []Folder

Choose picks where to install below base: folders that already hold lfr skills, else the running agent's folder (Claude Code sets CLAUDECODE), else existing agent folders, else .agents/skills.

type Skill

type Skill struct {
	Topic       string `json:"topic"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Text        string `json:"-"`
}

Skill is one rendered skill.

func All

func All(data Data) ([]Skill, error)

All renders every skill in lifecycle order.

func Get

func Get(topic string, data Data) (Skill, error)

Get renders the skill of a topic (or full name, "lfr-issue").

type State

type State string

State says how an installed copy relates to this binary.

const (
	Current  State = "current"  // identical to what this binary prints
	Outdated State = "outdated" // untouched, printed by another lfr version
	Modified State = "modified" // changed after it was written
	Foreign  State = "foreign"  // not written by lfr
)

Jump to

Keyboard shortcuts

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