skills

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnthricSkillsRepo 官方 skills 仓库
	AnthricSkillsRepo = "anthropics/skills"
	// PlaywrightSkillsRepo Microsoft Playwright CLI skills 仓库
	PlaywrightSkillsRepo = "microsoft/playwright-cli"
	// DefaultSkillsBranch 默认分支
	DefaultSkillsBranch = "main"
	// SkillsInstallMarker 安装标记文件
	SkillsInstallMarker = ".official_skills_installed"
)
View Source
const DefaultClawHubRegistry = "https://clawhub.ai"

Variables

This section is empty.

Functions

func GetInstallHelpMessage

func GetInstallHelpMessage() string

GetInstallHelpMessage 获取安装帮助信息(网络失败时显示)

func GlobalSkillsDir

func GlobalSkillsDir() string

GlobalSkillsDir 返回全局 skills 目录 (~/.agents/skills/) 这是业界标准路径,可被多个 AI 工具共享

Types

type ClawHubSource

type ClawHubSource struct {
	Registry string
	Slug     string
	Owner    string
	Version  string
	Tag      string
}

func ParseClawHubSource

func ParseClawHubSource(raw string) (ClawHubSource, error)

type Entry

type Entry struct {
	Name        string
	DisplayName string
	Description string
	Path        string
	Body        string
	Source      string // "workspace" or "global"
}

Entry is a single skill document discovered from workspace/skills.

func Discover

func Discover(skillsDir string) ([]Entry, error)

Discover loads markdown skill files from skillsDir. Supported layouts:

  • skills/<name>.md
  • skills/<name>/SKILL.md

func DiscoverAll

func DiscoverAll(workspaceDir string, includeGlobal bool) ([]Entry, error)

DiscoverAll loads skills from both workspace and global directories. Workspace skills take precedence over global skills (same name = workspace wins).

func FilterByMessage

func FilterByMessage(entries []Entry, message string) []Entry

FilterByMessage returns selected skills based on references in message. Supported selectors:

  • @skill:<name>
  • $<name>

Special selectors:

  • @skill:all / $all
  • @skill:none / $none

If no selector is present, all skills are returned.

type GitHubSource

type GitHubSource struct {
	Owner  string
	Repo   string
	Branch string
	Path   string
	Type   string // "file", "dir", "repo"
}

GitHubSource 表示解析后的 GitHub 源信息

type InstallResult

type InstallResult struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Location string `json:"location"`
	Version  string `json:"version,omitempty"`
	Source   string `json:"source,omitempty"`
	Registry string `json:"registry,omitempty"`
}

type Installer

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

Installer 负责安装官方 skills

func NewInstaller

func NewInstaller(workspace string) *Installer

NewInstaller 创建 skills 安装器

func (*Installer) InstallFromClawHub

func (i *Installer) InstallFromClawHub(source ClawHubSource) (*InstallResult, error)

func (*Installer) InstallFromGitHub

func (i *Installer) InstallFromGitHub(source GitHubSource) (int, error)

InstallFromGitHub 从 GitHub 智能安装技能

func (*Installer) InstallIfNeeded

func (i *Installer) InstallIfNeeded() error

InstallIfNeeded 如果需要则安装官方 skills(用于自动检测)

func (*Installer) InstallOfficialSkills

func (i *Installer) InstallOfficialSkills() error

InstallOfficialSkills 从 GitHub 或镜像下载并安装所有官方 skills 支持自动 fallback 到可用镜像

func (*Installer) InstallRepoSkills

func (i *Installer) InstallRepoSkills(repo OfficialRepo) (int, error)

InstallRepoSkills 安装单个仓库的技能(公开方法) 返回安装的文件数量和可能的错误

func (*Installer) InstallSingleFile

func (i *Installer) InstallSingleFile(source GitHubSource) error

InstallSingleFile 公开方法:从 GitHub 安装单个技能文件

func (*Installer) InstallSubPath

func (i *Installer) InstallSubPath(source GitHubSource) error

InstallSubPath 公开方法:从 GitHub 安装子路径下的所有技能

func (*Installer) IsFirstRun

func (i *Installer) IsFirstRun() bool

IsFirstRun 检查是否是首次运行(skills 目录为空或没有官方 skills)

func (*Installer) ListInstalledSkills

func (i *Installer) ListInstalledSkills() ([]string, error)

ListInstalledSkills 列出已安装的官方 skills

type NetworkError

type NetworkError struct {
	Message string
	Cause   error
}

NetworkError 网络错误类型

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

type OfficialRepo

type OfficialRepo struct {
	Name    string
	Repo    string
	SubPath string // 可选:指定子路径,如 "skills/steipete/weather"
}

OfficialRepo 定义官方技能仓库

type RecommendedSource

type RecommendedSource struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Source      string `json:"source,omitempty"`
	BrowseURL   string `json:"browseUrl,omitempty"`
	Example     string `json:"example,omitempty"`
}

func RecommendedSources

func RecommendedSources() []RecommendedSource

type StateManager

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

StateManager 管理技能的启用/禁用状态

func NewStateManager

func NewStateManager(storePath string) *StateManager

NewStateManager 创建状态管理器

func (*StateManager) FilterEnabled

func (sm *StateManager) FilterEnabled(entries []Entry) []Entry

FilterEnabled 过滤出启用的技能

func (*StateManager) GetAllStates

func (sm *StateManager) GetAllStates() map[string]bool

GetAllStates 获取所有技能状态

func (*StateManager) IsEnabled

func (sm *StateManager) IsEnabled(skillName string) bool

IsEnabled 检查技能是否启用(默认启用)

func (*StateManager) SetEnabled

func (sm *StateManager) SetEnabled(skillName string, enabled bool) error

SetEnabled 设置技能启用状态

Jump to

Keyboard shortcuts

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