Documentation
¶
Overview ¶
Package pack provides interfaces for markdown skill packs.
A SkillPack bundles multiple markdown skills (SKILL.md files) into a single Go module using go:embed. Skill packs can be imported and used with any omniskill-compatible agent.
Creating a Skill Pack ¶
To create a skill pack, embed a skills/ directory and implement SkillPack:
package myskills
import "embed"
//go:embed skills/*
var skillsFS embed.FS
type Pack struct{}
func (Pack) Name() string { return "my-skills" }
func (Pack) Version() string { return "1.0.0" }
func (Pack) FS() embed.FS { return skillsFS }
func Default() *Pack { return &Pack{} }
Directory Structure ¶
The embedded filesystem should follow this structure:
skills/
├── skill-one/
│ └── SKILL.md
├── skill-two/
│ └── SKILL.md
└── skill-three/
└── SKILL.md
Each SKILL.md follows the OpenClaw format with YAML frontmatter.
Using a Skill Pack ¶
Import the pack and load skills using the loader package:
import (
"github.com/example/myskills"
"github.com/plexusone/omniskill/loader"
)
pack := myskills.Default()
fs := pack.FS()
// List available skills
entries, _ := fs.ReadDir("skills")
for _, e := range entries {
if e.IsDir() {
content, _ := fs.ReadFile("skills/" + e.Name() + "/SKILL.md")
skill, _ := loader.ParseMarkdownSkill(string(content), e.Name())
// Use skill...
}
}
Version Traceability ¶
For packs derived from external sources (like ClawHub), the Version() method should return the source commit hash for traceability. This enables verifying that a pack matches its source.
Integration with ClawHub ¶
Skill packs can be published to ClawHub for distribution. See the clawhub package for ClawHub integration.
Package pack provides interfaces for markdown skill packs.
A SkillPack bundles multiple markdown skills (SKILL.md files) into a single Go module using go:embed. Skill packs can be imported and used with any omniskill-compatible agent.
Example implementation:
//go:embed skills/*
var skillsFS embed.FS
type Pack struct{}
func (Pack) Name() string { return "my-skills" }
func (Pack) Version() string { return "d4eb236..." }
func (Pack) FS() embed.FS { return skillsFS }
func Default() *Pack { return &Pack{} }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGitCommitHashShort ¶ added in v0.11.0
func GetGitCommitHashShort() string
GetGitCommitHashShort returns the short git commit hash.
func VerifyVersion ¶ added in v0.11.0
VerifyVersion checks if the pack version matches the source commit.
This is used to ensure derived packs are properly versioned and traceable back to their source.
Types ¶
type PackManifest ¶ added in v0.11.0
type PackManifest struct {
// Name is the pack identifier.
Name string `json:"name"`
// Version is the pack version.
Version string `json:"version"`
// Description is a human-readable description.
Description string `json:"description,omitempty"`
// Skills lists the skill names in this pack.
Skills []string `json:"skills"`
// Author is the pack author.
Author string `json:"author,omitempty"`
// License is the pack license.
License string `json:"license,omitempty"`
// Repository is the source repository URL.
Repository string `json:"repository,omitempty"`
// Homepage is the pack homepage URL.
Homepage string `json:"homepage,omitempty"`
// Keywords are searchable keywords.
Keywords []string `json:"keywords,omitempty"`
// CreatedAt is when the pack was created.
CreatedAt time.Time `json:"created_at"`
}
PackManifest contains metadata for a published pack.
func ExtractBundle ¶ added in v0.11.0
func ExtractBundle(bundlePath, targetDir string) (*PackManifest, error)
ExtractBundle extracts a pack bundle to a directory.
type PublishBundle ¶ added in v0.11.0
type PublishBundle struct {
// Manifest contains pack metadata.
Manifest *PackManifest
// BundlePath is the path to the tarball.
BundlePath string
// Checksum is the SHA256 of the bundle.
Checksum string
// Size is the bundle size in bytes.
Size int64
// Validation is the validation result.
Validation *ValidationResult
}
PublishBundle represents a prepared pack ready for publishing.
func PrepareForPublish ¶ added in v0.11.0
func PrepareForPublish(cfg PublishConfig) (*PublishBundle, error)
PrepareForPublish validates and bundles a pack for publishing.
This creates a tarball containing all skills and a manifest file, ready for upload to ClawHub or another registry.
type PublishConfig ¶ added in v0.11.0
type PublishConfig struct {
// SkillsDir is the directory containing skills to publish.
SkillsDir string
// PackName is the name of the skill pack.
PackName string
// Version is the pack version (defaults to git commit).
Version string
// OutputDir is where to write the publish bundle.
OutputDir string
// Strict treats validation warnings as errors.
Strict bool
}
PublishConfig configures pack publishing preparation.
type ScaffoldConfig ¶ added in v0.11.0
type ScaffoldConfig struct {
// SkillsDir is the directory containing skills to pack.
SkillsDir string
// PackageName is the Go package name for the generated pack.
PackageName string
// PackName is the name of the skill pack.
PackName string
// OutputDir is where to write generated files.
OutputDir string
// IncludeVersion embeds the git commit hash as version.
IncludeVersion bool
}
ScaffoldConfig configures pack generation.
type ScaffoldResult ¶ added in v0.11.0
type ScaffoldResult struct {
// OutputPath is the path to the generated pack.go file.
OutputPath string
// Skills lists the skills included in the pack.
Skills []string
// Version is the embedded version (git commit hash).
Version string
// GeneratedAt is when the pack was generated.
GeneratedAt time.Time
}
ScaffoldResult contains the result of pack scaffolding.
func Scaffold ¶ added in v0.11.0
func Scaffold(cfg ScaffoldConfig) (*ScaffoldResult, error)
Scaffold generates a Go skill pack from a skills directory.
The generated pack uses go:embed to bundle all SKILL.md files and implements the SkillPack interface.
type SkillPack ¶
type SkillPack interface {
// Name returns the pack identifier (e.g., "omniagent-skills").
Name() string
// Version returns the pack version or source commit hash.
// For packs derived from external sources (like OpenClaw),
// this should be the source commit hash for traceability.
Version() string
// FS returns the embedded filesystem containing skills.
// Skills are expected at skills/<name>/SKILL.md following
// the OpenClaw SKILL.md format with YAML frontmatter.
FS() embed.FS
}
SkillPack provides embedded markdown skills.
Skill packs bundle multiple SKILL.md files following the OpenClaw format into a single Go module. This enables:
- Zero external dependencies at runtime
- Versioned skill bundles via Go modules
- Easy distribution and updates
The FS() method should return an embedded filesystem with skills located at skills/<name>/SKILL.md.
type ValidateConfig ¶ added in v0.11.0
type ValidateConfig struct {
// SkillsDir is the directory containing skills to validate.
SkillsDir string
// Strict treats warnings as errors.
Strict bool
// RequireInstall requires install instructions.
RequireInstall bool
// RequireBins requires binary declarations.
RequireBins bool
}
ValidateConfig configures pack validation.
type ValidationError ¶ added in v0.11.0
type ValidationError struct {
// Skill is the name of the skill with the error.
Skill string
// Field is the problematic field (e.g., "name", "metadata.openclaw.requires").
Field string
// Message describes the validation failure.
Message string
// Severity is "error" or "warning".
Severity string
}
ValidationError represents a validation failure.
func (ValidationError) Error ¶ added in v0.11.0
func (e ValidationError) Error() string
type ValidationResult ¶ added in v0.11.0
type ValidationResult struct {
// Valid is true if all validations passed (no errors, warnings OK).
Valid bool
// Errors are validation failures that must be fixed.
Errors []ValidationError
// Warnings are issues that should be addressed but don't block.
Warnings []ValidationError
// Skills lists successfully validated skills.
Skills []string
}
ValidationResult contains the result of pack validation.
func ValidatePack ¶ added in v0.11.0
func ValidatePack(cfg ValidateConfig) (*ValidationResult, error)
ValidatePack validates all skills in a directory.
func ValidateSkillPack ¶ added in v0.11.0
func ValidateSkillPack(pack SkillPack) (*ValidationResult, error)
ValidateSkillPack validates an embedded skill pack.
func (*ValidationResult) HasErrors ¶ added in v0.11.0
func (r *ValidationResult) HasErrors() bool
HasErrors returns true if there are any validation errors.
func (*ValidationResult) HasWarnings ¶ added in v0.11.0
func (r *ValidationResult) HasWarnings() bool
HasWarnings returns true if there are any validation warnings.