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 – catalog.go provides an embedded skill catalog parsed from catalog.yaml. This makes the full catalog available offline without needing to fetch from ClawHub at runtime.
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 – commands.go implements slash command routing for skills. When a user sends a message starting with /command, it is routed to the matching skill's Execute() method instead of the general LLM pipeline.
Usage:
/weather São Paulo → routes to skill "weather" with args "São Paulo" /deploy staging → routes to skill "deploy" with args "staging"
Reserved command names (cannot be overridden by skills):
/help, /remember, /forget, /skills, /status, /reset, /model, /stop
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 on ClawHub (https://clawhub.ai/) 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:
- ClawHub slug: "steipete/trello" or "clawhub:steipete/trello"
- ClawHub URL: "https://clawhub.ai/steipete/trello"
- GitHub URL: "https://github.com/user/repo" or "github:user/repo"
- HTTP URL: "https://example.com/skill.zip" or raw SKILL.md URL
- Local path: "./my-skill" or "/home/user/skills/my-skill"
registry.go implementa o registro central de skills, responsável por descobrir, carregar, buscar e gerenciar o ciclo de vida das skills.
Package skills – scanner.go implements a security scanner for skill files. It detects dangerous patterns in skill code that could indicate malicious intent: - Critical patterns (block): eval/exec injection, crypto mining - Warning patterns (warn): file read + network send, obfuscation
The scanner caches results by file mtime+size to avoid re-scanning unchanged files.
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
- func CatalogSkillNames() []string
- func DefaultSkillNames() []string
- func FormatFindings(findings []ScanFinding) string
- func InstallAllDefaults(skillsDir string) (installed, skipped, failed int)
- func InstallDefaultSkill(skillsDir, name string) (bool, error)
- func InstallDefaultSkills(skillsDir string, names []string) (installed, skipped, failed int)
- func InstallStarterPack(skillsDir string) (installed, skipped, failed int)
- func IsReservedCommand(name string) bool
- func ParseSlashCommand(input string) (command, args string)
- func StarterPackNames() []string
- type BuiltinLoader
- type CatalogEntry
- type ClawHubClient
- func (c *ClawHubClient) Download(slug, version string) ([]byte, error)
- func (c *ClawHubClient) FetchFile(slug, path string) ([]byte, error)
- func (c *ClawHubClient) GetSkillMeta(slug string) (*ClawHubSkillMeta, error)
- func (c *ClawHubClient) Resolve(slug string) (*ClawHubSkill, error)
- func (c *ClawHubClient) Search(query string, limit int) (*ClawHubSearchResponse, error)
- type ClawHubModerationInfo
- type ClawHubSearchResponse
- type ClawHubSearchResult
- type ClawHubSearchResultLegacy
- type ClawHubSkill
- type ClawHubSkillMeta
- type ClawHubVersionInfo
- type ClawdHubLoader
- type ClawdHubSkillDef
- type CommandRouter
- type ConfigRequirement
- type DefaultSkill
- type Index
- type InstallResult
- type InstallSpec
- type Installer
- type Metadata
- type OpenClawMeta
- type OpenClawRequire
- type ProjectInfo
- type ProjectProvider
- type Registry
- func (r *Registry) AddLoader(loader SkillLoader)
- func (r *Registry) ByCategory(category string) []Metadata
- func (r *Registry) Disable(name string) error
- func (r *Registry) Enable(name string) error
- func (r *Registry) Get(name string) (Skill, bool)
- func (r *Registry) IsEnabled(name string) bool
- func (r *Registry) List() []Metadata
- func (r *Registry) LoadAll(ctx context.Context) error
- func (r *Registry) Register(skill Skill) error
- func (r *Registry) Reload(ctx context.Context) (int, error)
- func (r *Registry) Remove(name string) bool
- func (r *Registry) Search(query string) []Metadata
- func (r *Registry) ShutdownAll()
- func (r *Registry) SnapshotVersion() int64
- func (r *Registry) StopWatch()
- func (r *Registry) WatchDirs(dirs []string)
- type ScanFinding
- type ScanResult
- type ScanSeverity
- type ScriptSkill
- func (s *ScriptSkill) CheckSetup(vault VaultReader) SetupStatus
- func (s *ScriptSkill) Execute(ctx context.Context, input string) (string, error)
- func (s *ScriptSkill) Init(_ context.Context, config map[string]any) error
- func (s *ScriptSkill) Location() string
- func (s *ScriptSkill) Metadata() Metadata
- func (s *ScriptSkill) RequiredConfig() []ConfigRequirement
- func (s *ScriptSkill) RunScriptByName(ctx context.Context, name, args, stdin string) (string, error)
- func (s *ScriptSkill) Scripts() []SkillScript
- func (s *ScriptSkill) Shutdown() error
- func (s *ScriptSkill) SystemPrompt() string
- func (s *ScriptSkill) Tools() []Tool
- func (s *ScriptSkill) Triggers() []string
- type SecurityScanner
- type SetupStatus
- type Skill
- type SkillLoader
- type SkillRequirements
- type SkillScript
- type SkillSetupChecker
- type SkillsLimitsConfig
- type SlashCommandFlags
- type SourceTier
- type Tool
- type ToolHandler
- type ToolParameter
- type VaultReader
Constants ¶
const (
// DefaultClawHubURL is the default ClawHub registry API base.
DefaultClawHubURL = "https://clawhub.ai/api/v1"
)
Variables ¶
This section is empty.
Functions ¶
func CatalogSkillNames ¶ added in v1.13.0
func CatalogSkillNames() []string
CatalogSkillNames returns the names of all skills in the embedded catalog.
func DefaultSkillNames ¶
func DefaultSkillNames() []string
DefaultSkillNames returns just the names of all available default skills.
func FormatFindings ¶ added in v1.13.0
func FormatFindings(findings []ScanFinding) string
FormatFindings returns a human-readable summary of scan findings.
func InstallAllDefaults ¶
InstallAllDefaults installs all available default skills.
func InstallDefaultSkill ¶
InstallDefaultSkill installs a single default skill to the given skills directory. Returns true if installed, false if already existed.
func InstallDefaultSkills ¶
InstallDefaultSkills installs multiple default skills and returns counts.
func InstallStarterPack ¶
InstallStarterPack installs only starter pack skills.
func IsReservedCommand ¶ added in v1.13.0
IsReservedCommand returns true if the command name is reserved.
func ParseSlashCommand ¶ added in v1.13.0
ParseSlashCommand checks if the input starts with /command and returns the command name and arguments. Returns empty strings if not a command.
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) SetModel ¶ added in v1.15.0
func (l *BuiltinLoader) SetModel(model string)
SetModel sets the default LLM model name for skills that need it (e.g. claude-code).
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 CatalogEntry ¶ added in v1.13.0
type CatalogEntry struct {
Name string `yaml:"-"`
Label string `yaml:"label"`
LabelPT string `yaml:"label_pt"`
Path string `yaml:"path"`
Version string `yaml:"version"`
Category string `yaml:"category"`
Tags []string `yaml:"tags"`
Description string `yaml:"description"`
DescriptionPT string `yaml:"description_pt"`
ClawHubURL string `yaml:"clawhub_url"`
}
CatalogEntry represents a single skill in the embedded catalog.
func CatalogSkills ¶ added in v1.13.0
func CatalogSkills() []CatalogEntry
CatalogSkills returns all skills from the embedded catalog, sorted alphabetically.
func GetCatalogSkill ¶ added in v1.13.0
func GetCatalogSkill(name string) *CatalogEntry
GetCatalogSkill returns a catalog entry by name, or nil if not found.
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. Skills loaded by this instance are assigned TierManaged by default.
func NewClawdHubLoaderWithTier ¶ added in v1.13.0
func NewClawdHubLoaderWithTier(dirs []string, tier SourceTier, logger *slog.Logger) *ClawdHubLoader
NewClawdHubLoaderWithTier creates a loader with an explicit source tier.
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 including the tier.
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 CommandRouter ¶ added in v1.13.0
type CommandRouter struct {
// contains filtered or unexported fields
}
CommandRouter routes slash commands to matching skills.
func NewCommandRouter ¶ added in v1.13.0
func NewCommandRouter(registry *Registry) *CommandRouter
NewCommandRouter creates a new slash command router.
func (*CommandRouter) Execute ¶ added in v1.13.0
Execute routes a slash command to the matching skill and executes it. Returns the result or an error.
func (*CommandRouter) ListCommands ¶ added in v1.13.0
func (cr *CommandRouter) ListCommands() []string
ListCommands returns a list of available slash commands from registered skills.
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 ¶
NewInstaller creates a new skill installer.
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"`
// Requires declares runtime eligibility requirements. Skills that don't
// meet these requirements are excluded from the prompt to avoid confusing
// the LLM with unavailable capabilities.
Requires SkillRequirements `yaml:"requires" json:"requires,omitempty"`
// SourceTier indicates the load priority tier of this skill.
// Higher tiers override lower tiers with the same name.
SourceTier SourceTier `yaml:"-" json:"-"`
}
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 ¶
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 ¶
ByCategory retorna todas as skills de uma categoria específica.
func (*Registry) Reload ¶
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) Search ¶
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.
func (*Registry) SnapshotVersion ¶ added in v1.13.0
SnapshotVersion returns the current snapshot version. Consumers can compare this against a cached value to know when skills have changed.
type ScanFinding ¶ added in v1.13.0
type ScanFinding struct {
File string `json:"file"`
Line int `json:"line"`
Severity ScanSeverity `json:"severity"`
Rule string `json:"rule"`
Match string `json:"match"`
}
ScanFinding represents a single security finding in a skill file.
type ScanResult ¶ added in v1.13.0
type ScanResult struct {
Findings []ScanFinding `json:"findings"`
Scanned int `json:"scanned"`
Duration time.Duration `json:"duration"`
}
ScanResult is the outcome of scanning a skill directory.
func (ScanResult) HasCritical ¶ added in v1.13.0
func (r ScanResult) HasCritical() bool
HasCritical returns true if any finding is critical.
type ScanSeverity ¶ added in v1.13.0
type ScanSeverity string
ScanSeverity indicates how severe a finding is.
const ( ScanCritical ScanSeverity = "critical" ScanWarning ScanSeverity = "warning" )
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 ¶
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) Location ¶ added in v1.13.0
func (s *ScriptSkill) Location() string
Location returns the absolute path to the SKILL.md file, or "" if it does not exist on disk (e.g. the skill directory was moved/deleted after load).
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) 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 SecurityScanner ¶ added in v1.13.0
type SecurityScanner struct {
// contains filtered or unexported fields
}
SecurityScanner scans skill files for dangerous patterns.
func NewSecurityScanner ¶ added in v1.13.0
func NewSecurityScanner() *SecurityScanner
NewSecurityScanner creates a new security scanner.
func (*SecurityScanner) ScanDirectory ¶ added in v1.13.0
func (s *SecurityScanner) ScanDirectory(dir string) ScanResult
ScanDirectory scans all scannable files in the given directory.
func (*SecurityScanner) ScanFile ¶ added in v1.13.0
func (s *SecurityScanner) ScanFile(path string) []ScanFinding
ScanFile scans a single file for dangerous patterns.
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)
// Location retorna o caminho absoluto do SKILL.md para skills baseadas em arquivo.
// Retorna "" para skills built-in (que não possuem arquivo SKILL.md).
// Usado pelo modelo de referência: a LLM lê o SKILL.md sob demanda via read_file.
Location() string
// 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, defaultModelName string) Skill
NewClaudeCodeSkill creates the claude-code skill. provider may be nil if project management is not configured. defaultModelName is the model name passed to Claude Code CLI via --model.
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 SkillRequirements ¶ added in v1.13.0
type SkillRequirements struct {
// Bins lists binaries that must ALL exist in PATH.
Bins []string `yaml:"bins" json:"bins,omitempty"`
// AnyBins lists binaries where at least one must exist in PATH.
AnyBins []string `yaml:"any_bins" json:"anyBins,omitempty"`
// Env lists environment variables that must all be set (non-empty).
Env []string `yaml:"env" json:"env,omitempty"`
// OS lists compatible operating systems (runtime.GOOS values).
// Empty means all OSes are supported.
OS []string `yaml:"os" json:"os,omitempty"`
}
SkillRequirements declares runtime eligibility for a skill.
func (SkillRequirements) IsEligible ¶ added in v1.13.0
func (r SkillRequirements) IsEligible() bool
IsEligible checks whether the current runtime satisfies all requirements. Returns true when no requirements are declared or all checks pass.
type SkillScript ¶
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 SkillsLimitsConfig ¶ added in v1.13.0
type SkillsLimitsConfig struct {
// MaxCandidatesPerRoot is the maximum skills scanned per workspace root (default: 300).
MaxCandidatesPerRoot int `yaml:"max_candidates_per_root"`
// MaxSkillsInPrompt is the maximum skills included in the system prompt (default: 150).
MaxSkillsInPrompt int `yaml:"max_skills_in_prompt"`
// MaxSkillsPromptChars is the total character budget for skills in the prompt (default: 30000).
MaxSkillsPromptChars int `yaml:"max_skills_prompt_chars"`
// MaxSkillFileBytes is the maximum size of a single skill file (default: 256000).
MaxSkillFileBytes int `yaml:"max_skill_file_bytes"`
}
SkillsLimitsConfig configures resource limits for skill loading.
func DefaultSkillsLimits ¶ added in v1.13.0
func DefaultSkillsLimits() SkillsLimitsConfig
DefaultSkillsLimits returns sensible defaults for skill loading limits.
func (SkillsLimitsConfig) Effective ¶ added in v1.13.0
func (c SkillsLimitsConfig) Effective() SkillsLimitsConfig
Effective returns a copy with default values filled in for zero fields.
type SlashCommandFlags ¶ added in v1.13.0
type SlashCommandFlags struct {
// UserInvocable means the command can only be triggered by the user
// typing /command, not by the LLM calling it autonomously.
UserInvocable bool `yaml:"user_invocable"`
// DisableModelInvocation prevents the LLM from calling this skill's
// Execute() method directly. Only explicit /command invocation works.
DisableModelInvocation bool `yaml:"disable_model_invocation"`
}
SlashCommandFlags controls how a skill slash command behaves.
type SourceTier ¶ added in v1.13.0
type SourceTier int
SourceTier indicates where a skill was loaded from. Higher tiers override lower tiers when skills have the same name. Aligned with OpenClaw's 6-tier model.
const ( // TierBundled is for skills bundled with DevClaw (lowest priority). TierBundled SourceTier = 0 // TierManaged is for skills installed via the managed skill system (hub/registry). TierManaged SourceTier = 1 // TierPersonal is for user-global skills (optional, configured via personal_dir). TierPersonal SourceTier = 2 // TierProject is for project-scoped skills (optional, configured via project_dir). TierProject SourceTier = 3 // TierWorkspace is for skills defined in the active workspace directory. TierWorkspace SourceTier = 4 // TierExtra is for dynamically injected skills at runtime (highest priority). TierExtra SourceTier = 5 )
func (SourceTier) String ¶ added in v1.13.0
func (t SourceTier) String() string
String returns a human-readable tier name.
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 ¶
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.