skills

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package skills – builtin_adapter.go provides a SkillLoader that creates lightweight built-in skills. Each built-in exposes one or more tools callable by the LLM agent.

Built-in skills do not require external scripts or the sandbox. They run Go code directly inside the process.

Package skills – clawdhub_loader.go implements a SkillLoader that reads OpenClaw/ClawdHub SKILL.md format and converts them into DevClaw skills.

ClawdHub skills use SKILL.md with YAML frontmatter:

---
name: my-skill
description: "What this skill does"
metadata: { "openclaw": { "emoji": "...", "requires": { "bins": [...] } } }
---
# Skill Title
Instructions for the agent...

The loader parses frontmatter, validates requirements, resolves {baseDir} references, and wraps the skill as a ScriptSkill for DevClaw execution.

Package skills – clawhub_client.go implements a client for the ClawHub registry API (clawhub.ai). Supports searching, resolving, and downloading skills from the community hub.

ClawHub API base: https://clawhub.ai/api/v1 Endpoints:

GET /search?q=<query>&limit=<n>
GET /skills/<slug>           - skill metadata
GET /skills/<slug>/file?path=SKILL.md
GET /download?slug=<slug>&version=<version>

Package skills – coding_claude_code.go integrates with the Claude Code CLI to provide full-stack coding capabilities: code editing, review, commit, PR, deployment, testing, refactoring, and any development task.

Instead of implementing many granular tools (git_status, code_read, etc.), this skill delegates everything to Claude Code, which has its own rich set of tools (Bash, Read, Edit, Grep, Glob, Write, etc.).

The skill follows the same pattern as OpenClaw's cli-runner:

  • Uses --output-format json (single JSON result, no streaming)
  • Uses --dangerously-skip-permissions (most reliable permission bypass)
  • Passes prompt as positional arg (fallback to stdin for long prompts)
  • Waits for completion and parses the JSON output

Requirements:

  • Claude Code CLI installed: npm install -g @anthropic-ai/claude-code
  • Authenticated: claude setup-token or ANTHROPIC_API_KEY
  • The user must enable "claude-code" in skills.builtin config.

Package skills – coding_project.go implements the "project-manager" built-in skill. Provides tools for registering, activating, scanning, and inspecting development projects. This is the foundation for all coding skills.

Package skills – defaults.go provides embedded default skill templates that can be installed via the setup wizard, CLI commands, chat commands, or agent tools. Each skill is a SKILL.md file (ClawdHub/OpenClaw format).

Package skills – defaults_catalog.go holds the embedded default skill templates.

Only core development/coding skills belong here. These are the "Starter Pack" — pre-selected during setup and always available offline.

Integration, productivity, infra, and other skills live in the devclaw-skills repository and are fetched/installed separately.

Skills teach the LLM how to use existing native tools (bash, ssh, scp, read_file, write_file, etc.) — they do NOT register new tools.

Package skills – installer.go implements skill installation from multiple sources: ClawHub registry, GitHub repositories, URLs, and local paths.

Supported sources:

registry.go implementa o registro central de skills, responsável por descobrir, carregar, buscar e gerenciar o ciclo de vida das skills.

Package skills – script_skill.go wraps ClawdHub-format skills (Python, Node.js, Shell scripts) as DevClaw Skill implementations.

A ScriptSkill:

  • Exposes the SKILL.md body as the system prompt
  • Discovers scripts in the skill's scripts/ directory
  • Delegates execution to the sandbox.Runner
  • Replaces {baseDir} with the skill's directory path
  • Extracts trigger phrases from the SKILL.md body

Package skills define o sistema de extensibilidade do DevClaw. Skills são módulos que adicionam capacidades ao assistente, como integração com calendário, email, GitHub, etc. Podem ser built-in ou instaladas pela comunidade.

Index

Constants

View Source
const (
	// DefaultClawHubURL is the default ClawHub registry API base.
	DefaultClawHubURL = "https://clawhub.ai/api/v1"
)

Variables

This section is empty.

Functions

func DefaultSkillNames

func DefaultSkillNames() []string

DefaultSkillNames returns just the names of all available default skills.

func InstallAllDefaults

func InstallAllDefaults(skillsDir string) (installed, skipped, failed int)

InstallAllDefaults installs all available default skills.

func InstallDefaultSkill

func InstallDefaultSkill(skillsDir, name string) (bool, error)

InstallDefaultSkill installs a single default skill to the given skills directory. Returns true if installed, false if already existed.

func InstallDefaultSkills

func InstallDefaultSkills(skillsDir string, names []string) (installed, skipped, failed int)

InstallDefaultSkills installs multiple default skills and returns counts.

func InstallStarterPack

func InstallStarterPack(skillsDir string) (installed, skipped, failed int)

InstallStarterPack installs only starter pack skills.

func StarterPackNames

func StarterPackNames() []string

StarterPackNames returns the names of skills marked as starter pack.

Types

type BuiltinLoader

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

BuiltinLoader creates and returns built-in skills based on the enabled list.

func NewBuiltinLoader

func NewBuiltinLoader(enabled []string, logger *slog.Logger) *BuiltinLoader

NewBuiltinLoader creates a loader for built-in skills.

func (*BuiltinLoader) Load

func (l *BuiltinLoader) Load(_ context.Context) ([]Skill, error)

Load returns built-in skills matching the enabled list.

func (*BuiltinLoader) SetAPIConfig

func (l *BuiltinLoader) SetAPIConfig(apiKey, baseURL, model string)

SetAPIConfig injects the LLM API configuration for skills that need it (e.g. claude-code). The API key is injected as ANTHROPIC_API_KEY and base URL as ANTHROPIC_BASE_URL so that Claude Code CLI uses the same provider (e.g. Z.AI) as DevClaw. model is the default LLM model name (e.g. "glm-5") used to set ANTHROPIC_DEFAULT_*_MODEL.

func (*BuiltinLoader) SetProjectProvider

func (l *BuiltinLoader) SetProjectProvider(p ProjectProvider)

SetProjectProvider injects the project provider for coding skills. Must be called before Load if "claude-code" or "project-manager" are enabled.

func (*BuiltinLoader) Source

func (l *BuiltinLoader) Source() string

Source returns the loader source identifier.

type ClawHubClient

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

ClawHubClient communicates with the ClawHub skill registry.

func NewClawHubClient

func NewClawHubClient(baseURL string) *ClawHubClient

NewClawHubClient creates a new ClawHub API client.

func (*ClawHubClient) Download

func (c *ClawHubClient) Download(slug, version string) ([]byte, error)

Download fetches the full skill archive (zip).

func (*ClawHubClient) FetchFile

func (c *ClawHubClient) FetchFile(slug, path string) ([]byte, error)

FetchFile downloads a single file from a skill (e.g. SKILL.md).

func (*ClawHubClient) GetSkillMeta added in v1.12.0

func (c *ClawHubClient) GetSkillMeta(slug string) (*ClawHubSkillMeta, error)

GetSkillMeta fetches detailed metadata for a skill by slug (e.g. "steipete/trello").

func (*ClawHubClient) Resolve

func (c *ClawHubClient) Resolve(slug string) (*ClawHubSkill, error)

Resolve fetches full details for a skill by slug (e.g. "steipete/trello"). Deprecated: Use GetSkillMeta instead.

func (*ClawHubClient) Search

func (c *ClawHubClient) Search(query string, limit int) (*ClawHubSearchResponse, error)

Search queries ClawHub for skills matching the given query.

type ClawHubModerationInfo added in v1.12.0

type ClawHubModerationInfo struct {
	IsMalwareBlocked bool `json:"isMalwareBlocked"`
	IsSuspicious     bool `json:"isSuspicious"`
}

ClawHubModerationInfo holds moderation status.

type ClawHubSearchResponse added in v1.12.0

type ClawHubSearchResponse struct {
	Results []ClawHubSearchResult `json:"results"`
}

ClawHubSearchResponse holds the response from a search query. The API returns { "results": [...] }.

type ClawHubSearchResult

type ClawHubSearchResult struct {
	Score       float64 `json:"score"`
	Slug        string  `json:"slug"`
	DisplayName string  `json:"displayName"`
	Summary     string  `json:"summary"`
	Version     string  `json:"version"`
}

ClawHubSearchResult represents a single search result from ClawHub.

type ClawHubSearchResultLegacy added in v1.12.0

type ClawHubSearchResultLegacy struct {
	Skills []ClawHubSkill `json:"skills"`
	Total  int            `json:"total"`
}

ClawHubSearchResultLegacy holds a list of skills from a search query (legacy). Deprecated: Use ClawHubSearchResponse instead.

type ClawHubSkill

type ClawHubSkill struct {
	Slug        string   `json:"slug"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Author      string   `json:"author"`
	Version     string   `json:"version"`
	Downloads   int      `json:"downloads"`
	Stars       int      `json:"stars"`
	Tags        []string `json:"tags"`
	Category    string   `json:"category"`
	Homepage    string   `json:"homepage"`
	CreatedAt   string   `json:"createdAt"`
	UpdatedAt   string   `json:"updatedAt"`
}

ClawHubSkill represents a skill entry (legacy, kept for compatibility). Deprecated: Use ClawHubSearchResult or ClawHubSkillMeta instead.

type ClawHubSkillMeta added in v1.12.0

type ClawHubSkillMeta struct {
	Slug          string                 `json:"slug"`
	DisplayName   string                 `json:"displayName"`
	Summary       string                 `json:"summary"`
	LatestVersion *ClawHubVersionInfo    `json:"latestVersion"`
	Moderation    *ClawHubModerationInfo `json:"moderation"`
	Author        string                 `json:"author"`
	Tags          []string               `json:"tags"`
	Category      string                 `json:"category"`
	Downloads     int                    `json:"downloads"`
	Stars         int                    `json:"stars"`
	Homepage      string                 `json:"homepage"`
	CreatedAt     string                 `json:"createdAt"`
	UpdatedAt     string                 `json:"updatedAt"`
}

ClawHubSkillMeta holds detailed metadata for a skill.

type ClawHubVersionInfo added in v1.12.0

type ClawHubVersionInfo struct {
	Version string `json:"version"`
}

ClawHubVersionInfo holds version information.

type ClawdHubLoader

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

ClawdHubLoader loads skills from directories using the SKILL.md format.

func NewClawdHubLoader

func NewClawdHubLoader(dirs []string, logger *slog.Logger) *ClawdHubLoader

NewClawdHubLoader creates a loader that scans the given directories.

func (*ClawdHubLoader) Load

func (l *ClawdHubLoader) Load(ctx context.Context) ([]Skill, error)

Load scans all configured directories and returns found skills.

func (*ClawdHubLoader) Source

func (l *ClawdHubLoader) Source() string

Source returns the loader source identifier.

type ClawdHubSkillDef

type ClawdHubSkillDef struct {
	Name        string                 `yaml:"name"`
	Description string                 `yaml:"description"`
	Homepage    string                 `yaml:"homepage"`
	Metadata    map[string]interface{} `yaml:"metadata"`

	// Parsed from metadata.openclaw
	OpenClaw *OpenClawMeta

	// ConfigRequirements are the configuration/credentials needed.
	// Parsed from metadata.config or metadata.openclaw.config
	ConfigRequirements []ConfigRequirement

	// Body is the markdown content after frontmatter (instructions).
	Body string

	// Dir is the absolute path to the skill directory.
	Dir string
}

ClawdHubSkillDef holds the parsed SKILL.md frontmatter.

type ConfigRequirement added in v1.12.0

type ConfigRequirement struct {
	// Key é a chave usada para armazenar no vault (ex: "SLACK_BOT_TOKEN").
	Key string `yaml:"key"`

	// Name é o nome amigável para mostrar ao usuário (ex: "Slack Bot Token").
	Name string `yaml:"name"`

	// Description explica o que é e como obter essa configuração.
	Description string `yaml:"description"`

	// Pattern é um padrão opcional para validação (ex: "xoxb-*" para tokens Slack).
	Pattern string `yaml:"pattern,omitempty"`

	// Example mostra um exemplo de valor válido (ex: "xoxb-1234567890-1234567890-AbCdEf").
	Example string `yaml:"example,omitempty"`

	// Secret indica se o valor deve ser tratado como segredo (ocultar em logs).
	Secret bool `yaml:"secret"`

	// Required indica se é obrigatório. Se false, a skill pode funcionar sem ele.
	Required bool `yaml:"required"`

	// EnvVar é a variável de ambiente alternativa (ex: "SLACK_BOT_TOKEN").
	EnvVar string `yaml:"env_var,omitempty"`
}

ConfigRequirement descreve uma configuração/credencial obrigatória para uma skill. Skills podem declarar requisitos que serão verificados automaticamente antes da execução.

type DefaultSkill

type DefaultSkill struct {
	Name        string // Unique identifier (directory name).
	Label       string // Human-readable label for interactive selection.
	Description string // Short description.
	Category    string // Category: "development", "data", "productivity", "infra".
	StarterPack bool   // If true, pre-selected during setup wizard.
	Content     string // Full SKILL.md file content.
}

DefaultSkill holds a default skill template.

func DefaultSkills

func DefaultSkills() []DefaultSkill

DefaultSkills returns the list of default skill templates available for installation.

func GetDefaultSkill

func GetDefaultSkill(name string) *DefaultSkill

GetDefaultSkill returns a default skill by name, or nil if not found.

type Index

type Index struct {
	ByCategory map[string][]string
	ByTag      map[string][]string
	ByAuthor   map[string][]string
}

Index mantém índices para busca eficiente de skills por categoria, tag e autor.

type InstallResult

type InstallResult struct {
	Name    string // skill name (directory name)
	Source  string // where it came from
	Path    string // full path to the installed skill
	IsNew   bool   // true if newly installed, false if updated
	Version string // version if known
}

InstallResult holds the result of a skill installation.

type InstallSpec

type InstallSpec struct {
	ID      string   `json:"id"`
	Kind    string   `json:"kind"` // brew, apt, node, go, uv, download
	Formula string   `json:"formula"`
	Package string   `json:"package"`
	Bins    []string `json:"bins"`
	Label   string   `json:"label"`
	OS      []string `json:"os"`
}

InstallSpec describes how to install a dependency.

type Installer

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

Installer handles skill installation from various sources.

func NewInstaller

func NewInstaller(skillsDir string, logger *slog.Logger) *Installer

NewInstaller creates a new skill installer.

func (*Installer) Install

func (inst *Installer) Install(ctx context.Context, source string) (*InstallResult, error)

Install installs a skill from the given source string. It auto-detects the source type based on the input format.

type Metadata

type Metadata struct {
	// Name é o identificador único da skill (ex: "calendar", "github").
	Name string `yaml:"name"`

	// Version é a versão semântica da skill (ex: "1.0.0").
	Version string `yaml:"version"`

	// Author é o autor ou organização que criou a skill.
	Author string `yaml:"author"`

	// Description é uma breve descrição do que a skill faz.
	Description string `yaml:"description"`

	// Category é a categoria da skill (ex: "productivity", "development").
	Category string `yaml:"category"`

	// Tags são palavras-chave para busca e indexação.
	Tags []string `yaml:"tags"`
}

Metadata contém os metadados de uma skill.

type OpenClawMeta

type OpenClawMeta struct {
	Emoji    string              `json:"emoji"`
	Always   bool                `json:"always"`
	OS       []string            `json:"os"`
	Requires OpenClawRequire     `json:"requires"`
	Install  []InstallSpec       `json:"install"`
	Config   []ConfigRequirement `json:"config"` // Required configuration
}

OpenClawMeta holds the openclaw-specific metadata.

type OpenClawRequire

type OpenClawRequire struct {
	Bins    []string `json:"bins"`
	AnyBins []string `json:"anyBins"`
	Env     []string `json:"env"`
	Config  []string `json:"config"`
}

OpenClawRequire defines runtime requirements.

type ProjectInfo

type ProjectInfo struct {
	ID            string `yaml:"id"`
	Name          string `yaml:"name"`
	RootPath      string `yaml:"root_path"`
	Language      string `yaml:"language"`
	Framework     string `yaml:"framework"`
	GitRemote     string `yaml:"git_remote,omitempty"`
	BuildCmd      string `yaml:"build_cmd,omitempty"`
	TestCmd       string `yaml:"test_cmd,omitempty"`
	LintCmd       string `yaml:"lint_cmd,omitempty"`
	StartCmd      string `yaml:"start_cmd,omitempty"`
	DeployCmd     string `yaml:"deploy_cmd,omitempty"`
	DockerCompose string `yaml:"docker_compose,omitempty"`
}

ProjectInfo holds project metadata shared between copilot and skills packages.

type ProjectProvider

type ProjectProvider interface {
	// Register adds or updates a project.
	Register(p *ProjectInfo) error
	// Remove removes a project by ID.
	Remove(id string) error
	// Get returns a project by ID.
	Get(id string) *ProjectInfo
	// List returns all registered projects.
	List() []*ProjectInfo
	// Activate sets the active project for a session.
	Activate(sessionKey, projectID string) error
	// ActiveProject returns the active project for a session.
	ActiveProject(sessionKey string) *ProjectInfo
	// ScanDirectory scans for projects in a directory.
	ScanDirectory(root string) ([]*ProjectInfo, error)
}

ProjectProvider is the interface that the ProjectManager (in copilot pkg) must implement for coding skills to access project context. This avoids an import cycle between skills ↔ copilot.

type Registry

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

Registry é o registro central que gerencia todas as skills disponíveis.

func NewRegistry

func NewRegistry(logger *slog.Logger) *Registry

NewRegistry cria um novo registro de skills.

func (*Registry) AddLoader

func (r *Registry) AddLoader(loader SkillLoader)

AddLoader adiciona um carregador de skills ao registry.

func (*Registry) ByCategory

func (r *Registry) ByCategory(category string) []Metadata

ByCategory retorna todas as skills de uma categoria específica.

func (*Registry) Disable

func (r *Registry) Disable(name string) error

Disable marks a skill as disabled without removing it.

func (*Registry) Enable

func (r *Registry) Enable(name string) error

Enable re-enables a previously disabled skill.

func (*Registry) Get

func (r *Registry) Get(name string) (Skill, bool)

Get retorna uma skill pelo nome.

func (*Registry) IsEnabled

func (r *Registry) IsEnabled(name string) bool

IsEnabled returns whether a skill is currently enabled.

func (*Registry) List

func (r *Registry) List() []Metadata

List retorna os metadados de todas as skills registradas.

func (*Registry) LoadAll

func (r *Registry) LoadAll(ctx context.Context) error

LoadAll carrega skills de todos os loaders registrados.

func (*Registry) Register

func (r *Registry) Register(skill Skill) error

Register registra uma skill diretamente no registry.

func (*Registry) Reload

func (r *Registry) Reload(ctx context.Context) (int, error)

Reload reloads all skills from all loaders, refreshing the catalog. New skills are added, existing ones are updated. Returns count of skills loaded.

func (*Registry) Remove

func (r *Registry) Remove(name string) bool

Remove removes a skill from the registry by name.

func (*Registry) Search

func (r *Registry) Search(query string) []Metadata

Search busca skills por query textual, comparando com nome, descrição e tags.

func (*Registry) ShutdownAll

func (r *Registry) ShutdownAll()

ShutdownAll encerra todas as skills de forma graciosa.

type ScriptSkill

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

ScriptSkill wraps a ClawdHub skill definition as a DevClaw Skill.

func NewScriptSkill

func NewScriptSkill(def *ClawdHubSkillDef) *ScriptSkill

NewScriptSkill creates a DevClaw skill from a ClawdHub definition.

func (*ScriptSkill) CheckSetup added in v1.12.0

func (s *ScriptSkill) CheckSetup(vault VaultReader) SetupStatus

CheckSetup verifies if all required configuration is present.

func (*ScriptSkill) Execute

func (s *ScriptSkill) Execute(ctx context.Context, input string) (string, error)

Execute runs the skill's primary operation. For script skills, this means finding the most appropriate script and running it through the sandbox.

func (*ScriptSkill) Init

func (s *ScriptSkill) Init(_ context.Context, config map[string]any) error

Init initializes the skill. Sets the sandbox runner.

func (*ScriptSkill) Metadata

func (s *ScriptSkill) Metadata() Metadata

Metadata returns the skill metadata.

func (*ScriptSkill) RequiredConfig added in v1.12.0

func (s *ScriptSkill) RequiredConfig() []ConfigRequirement

RequiredConfig returns the configuration requirements for this skill.

func (*ScriptSkill) RunScriptByName

func (s *ScriptSkill) RunScriptByName(ctx context.Context, name, args, stdin string) (string, error)

RunScriptByName runs a specific script by name (used by tool handlers).

func (*ScriptSkill) Scripts

func (s *ScriptSkill) Scripts() []SkillScript

Scripts returns the list of discovered scripts.

func (*ScriptSkill) Shutdown

func (s *ScriptSkill) Shutdown() error

Shutdown releases resources.

func (*ScriptSkill) SystemPrompt

func (s *ScriptSkill) SystemPrompt() string

SystemPrompt returns the SKILL.md body with {baseDir} resolved. For prompt-only skills (no scripts), adds a notice about available tools.

func (*ScriptSkill) Tools

func (s *ScriptSkill) Tools() []Tool

Tools returns the tools exposed by this skill. Each discovered script becomes a tool.

func (*ScriptSkill) Triggers

func (s *ScriptSkill) Triggers() []string

Triggers returns phrases that should activate this skill.

type SetupStatus added in v1.12.0

type SetupStatus struct {
	// IsComplete indica se todas as configurações obrigatórias estão presentes.
	IsComplete bool

	// MissingRequirements são as configurações que faltam.
	MissingRequirements []ConfigRequirement

	// OptionalMissing são configurações opcionais que não foram definidas.
	OptionalMissing []ConfigRequirement

	// Message é uma mensagem amigável sobre o estado do setup.
	Message string
}

SetupStatus indica o estado de configuração de uma skill.

type Skill

type Skill interface {
	// Metadata retorna os metadados da skill (nome, versão, autor, etc).
	Metadata() Metadata

	// Tools retorna as funções/ferramentas que a skill expõe ao agente LLM.
	Tools() []Tool

	// SystemPrompt retorna instruções adicionais a serem injetadas no prompt do sistema
	// quando a skill está ativa. Pode retornar string vazia se não necessário.
	SystemPrompt() string

	// Triggers retorna padrões de linguagem natural que ativam esta skill.
	// Usado para ativação automática baseada no conteúdo da mensagem.
	Triggers() []string

	// Init inicializa a skill com a configuração fornecida.
	// Chamado uma vez durante o startup.
	Init(ctx context.Context, config map[string]any) error

	// Execute executa a skill com o input fornecido e retorna o resultado.
	Execute(ctx context.Context, input string) (string, error)

	// Shutdown libera recursos da skill de forma graciosa.
	Shutdown() error
}

Skill define a interface que toda skill deve implementar. Uma skill encapsula uma capacidade específica do assistente.

func NewClaudeCodeSkill

func NewClaudeCodeSkill(provider ProjectProvider, apiKey, baseURL, defaultModelName string) Skill

NewClaudeCodeSkill creates the claude-code skill. provider may be nil if project management is not configured. apiKey, baseURL, and defaultModelName are the LLM provider credentials from DevClaw's config; when non-empty, they are injected as env vars so Claude Code CLI authenticates through the same provider (Z.AI, Anthropic, etc.).

func NewProjectManagerSkill

func NewProjectManagerSkill(provider ProjectProvider) Skill

NewProjectManagerSkill creates the project-manager skill. provider will be set via Init or direct injection from the assistant.

type SkillLoader

type SkillLoader interface {
	// Load carrega e retorna skills a partir da fonte configurada.
	Load(ctx context.Context) ([]Skill, error)

	// Source retorna o identificador da fonte (ex: "builtin", "filesystem", "registry").
	Source() string
}

SkillLoader define a interface para carregar skills de diferentes fontes (embedded, filesystem, registry remoto, etc).

type SkillScript

type SkillScript struct {
	Name    string
	Path    string
	Runtime sandbox.Runtime
}

SkillScript represents an executable script in the skill directory.

type SkillSetupChecker added in v1.12.0

type SkillSetupChecker interface {
	// RequiredConfig retorna as configurações obrigatórias e opcionais.
	RequiredConfig() []ConfigRequirement

	// CheckSetup verifica se a skill está corretamente configurada.
	// Recebe um VaultReader para verificar credenciais armazenadas.
	CheckSetup(vault VaultReader) SetupStatus
}

SkillSetupChecker é implementado por skills que precisam de configuração. O sistema verifica automaticamente antes de executar a skill.

type Tool

type Tool struct {
	// Name é o identificador da ferramenta (ex: "list_events").
	Name string `json:"name"`

	// Description descreve o que a ferramenta faz (usado no prompt do LLM).
	Description string `json:"description"`

	// Parameters define os parâmetros aceitos pela ferramenta.
	Parameters []ToolParameter `json:"parameters"`

	// Handler é a função que executa a ferramenta.
	Handler ToolHandler `json:"-"`
}

Tool representa uma função/ferramenta exposta por uma skill ao agente LLM.

type ToolHandler

type ToolHandler func(ctx context.Context, args map[string]any) (any, error)

ToolHandler é a assinatura da função que processa a chamada de uma ferramenta.

type ToolParameter

type ToolParameter struct {
	// Name é o nome do parâmetro.
	Name string `json:"name"`

	// Type é o tipo do parâmetro (string, integer, boolean, etc).
	Type string `json:"type"`

	// Description descreve o parâmetro.
	Description string `json:"description"`

	// Required indica se o parâmetro é obrigatório.
	Required bool `json:"required"`

	// Default é o valor padrão, se houver.
	Default any `json:"default,omitempty"`
}

ToolParameter define um parâmetro de uma ferramenta.

type VaultReader added in v1.12.0

type VaultReader interface {
	// Get retorna o valor armazenado para a chave, ou erro se não existir.
	Get(key string) (string, error)
	// Has retorna true se a chave existe no vault.
	Has(key string) bool
}

VaultReader é uma interface minimalista para ler valores do vault. Skills usam isso para verificar se credenciais existem.

Jump to

Keyboard shortcuts

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