Documentation
¶
Overview ¶
Package skill provides the Skill Library domain — reusable Claude Code skill definitions extracted from successful sessions.
Index ¶
- Variables
- type AddParams
- type SearchFilter
- type Skill
- type Store
- func (s *Store) Add(ctx context.Context, p AddParams) (*Skill, error)
- func (s *Store) IncrementSuccess(ctx context.Context, id string, workspaceID *string) (*Skill, error)
- func (s *Store) ListRelevant(ctx context.Context, workspaceID *string, query string, limit int) ([]*Skill, error)
- func (s *Store) Search(ctx context.Context, f SearchFilter) ([]*Skill, error)
- func (s *Store) UpdateFromOutcome(ctx context.Context, p UpdateFromOutcomeParams, workspaceID *string) (*Skill, error)
- type StoreIface
- type UpdateFromOutcomeParams
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("skill not found")
ErrNotFound is returned when a Skill row cannot be found for the given ID.
Functions ¶
This section is empty.
Types ¶
type AddParams ¶
type AddParams struct {
WorkspaceID *string
Name string
Description string
Triggers []string
Steps []string
FailureModes []string
VerificationChecklist []string
Examples []any
SourceAtomIDs []string
}
AddParams carries the inputs for creating a new Skill row.
type SearchFilter ¶
SearchFilter constrains a Search or ListRelevant query.
type Skill ¶
type Skill struct {
ID string `json:"id"`
WorkspaceID *string `json:"workspace_id,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Triggers []string `json:"triggers"`
Steps []string `json:"steps"`
FailureModes []string `json:"failure_modes"`
VerificationChecklist []string `json:"verification_checklist"`
Examples []any `json:"examples"`
SourceAtomIDs []string `json:"source_atom_ids"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Skill is a reusable skill definition extracted from a Claude Code session.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Postgres-backed implementation of StoreIface.
func New ¶
New returns a Store backed by the given pool, scoped to the optional workspaceID. nil workspaceID = legacy unscoped mode.
func (*Store) IncrementSuccess ¶
func (s *Store) IncrementSuccess(ctx context.Context, id string, workspaceID *string) (*Skill, error)
IncrementSuccess increments success_count and sets last_used_at = NOW().
func (*Store) ListRelevant ¶
func (s *Store) ListRelevant(ctx context.Context, workspaceID *string, query string, limit int) ([]*Skill, error)
ListRelevant returns skills ordered by success_count DESC, last_used_at DESC, optionally filtered by query (name/description ILIKE).
func (*Store) Search ¶
Search returns skills whose name or description match f.Query (ILIKE), ordered by success_count DESC.
func (*Store) UpdateFromOutcome ¶
func (s *Store) UpdateFromOutcome(ctx context.Context, p UpdateFromOutcomeParams, workspaceID *string) (*Skill, error)
UpdateFromOutcome increments the success or failure counter, appends an example entry, and refreshes last_used_at / updated_at.
type StoreIface ¶
type StoreIface interface {
// Add inserts a new skill and returns the persisted record.
Add(ctx context.Context, p AddParams) (*Skill, error)
// Search returns skills whose name or description match f.Query (ILIKE/LIKE),
// scoped to f.WorkspaceID when non-nil, ordered by success_count DESC.
Search(ctx context.Context, f SearchFilter) ([]*Skill, error)
// IncrementSuccess increments success_count and sets last_used_at = NOW().
// Returns ErrNotFound when no matching row exists.
IncrementSuccess(ctx context.Context, id string, workspaceID *string) (*Skill, error)
// UpdateFromOutcome increments the success or failure counter, appends an
// example entry {"outcome_id":"…","notes":"…","at":"…"} to examples, and
// sets last_used_at = NOW(). Returns ErrNotFound when no matching row exists.
UpdateFromOutcome(ctx context.Context, p UpdateFromOutcomeParams, workspaceID *string) (*Skill, error)
// ListRelevant returns skills ordered by success_count DESC, last_used_at DESC,
// optionally filtered by query (name/description LIKE), scoped to workspaceID.
ListRelevant(ctx context.Context, workspaceID *string, query string, limit int) ([]*Skill, error)
}
StoreIface is the backend-agnostic contract for the Skill Library bounded context. Both the Postgres-backed *Store and the SQLite-backed *SkillStore satisfy this interface.