document

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SkillDocumentFileName = "SKILL.md"
	MaxSkillDocumentBytes = 2 << 20
)

Variables

This section is empty.

Functions

func MarshalSkillDocument

func MarshalSkillDocument(
	document SkillDocument,
) ([]byte, error)

MarshalSkillDocument produces a canonical SKILL.md representation.

Known semantic fields replace corresponding RawFrontmatter fields. Unknown frontmatter fields are retained. If DisplayName differs from Name and the body has no H1, a display heading is added.

func ValidateSkillDocument

func ValidateSkillDocument(document SkillDocument) error

Types

type ParseSkillDocumentOptions

type ParseSkillDocumentOptions struct {
	// ExpectedName is an optional source-derived name, such as the containing
	// filesystem directory name. A mismatch triggers a error.
	ExpectedName string `json:"expectedName,omitempty"`
}

ParseSkillDocumentOptions controls provider-independent SKILL.md parsing.

type RenderSkillBodyResult

type RenderSkillBodyResult struct {
	Text string `json:"text"`

	AppliedArguments    map[string]string `json:"appliedArguments,omitempty"`
	UnknownPlaceholders []string          `json:"unknownPlaceholders,omitempty"`
	Warnings            []string          `json:"warnings,omitempty"`
}

RenderSkillBodyResult is the low-level result of rendering declared arguments into a skill body.

func RenderSkillBody

func RenderSkillBody(body string, arguments []SkillArgument, values map[string]string) RenderSkillBodyResult

RenderSkillBody renders declared string arguments into body.

Supported placeholders:

  • $name
  • {{name}}
  • {{ name }}

Only declared arguments are substituted. Unknown placeholders are preserved and warned. No runtime variables are expanded. No command syntax is interpreted or sanitized.

type RenderSkillDocumentOut

type RenderSkillDocumentOut struct {
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	DisplayName string      `json:"displayName,omitempty"`
	Insert      SkillInsert `json:"insert"`

	Tags []string `json:"tags,omitempty"`

	Text string `json:"text"`

	Arguments        []SkillArgument   `json:"arguments,omitempty"`
	AppliedArguments map[string]string `json:"appliedArguments,omitempty"`

	RawFrontmatter map[string]any `json:"rawFrontmatter,omitempty"`
	Warnings       []string       `json:"warnings,omitempty"`
}

func RenderSkillDocument

func RenderSkillDocument(
	document SkillDocument,
	arguments map[string]string,
) (RenderSkillDocumentOut, error)

RenderSkillDocument renders an already materialized Skill document.

It uses the same argument substitution semantics as Runtime.RenderSkill but does not register a provider skill, activate a session, read resources, or execute scripts.

type SkillArgument

type SkillArgument struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Default     string `json:"default,omitempty"`
}

SkillArgument is a named string argument supported by the FlexiGPT skill extension.

Values are intentionally string-only. Consumers may build richer UI validation on top, but the runtime only renders strings into the skill body.

type SkillDocument

type SkillDocument struct {
	Name         string          `json:"name"`
	DisplayName  string          `json:"displayName,omitempty"`
	Description  string          `json:"description"`
	Insert       SkillInsert     `json:"insert"`
	Arguments    []SkillArgument `json:"arguments,omitempty"`
	Tags         []string        `json:"tags,omitempty"`
	MarkdownBody string          `json:"markdownBody"`

	RawFrontmatter map[string]any `json:"rawFrontmatter,omitempty"`
}

SkillDocument is a materialized, provider-independent SKILL.md document.

RawFrontmatter preserves fields that the runtime does not interpret.

func ParseSkillDocument

func ParseSkillDocument(
	content []byte,
	options ParseSkillDocumentOptions,
) (SkillDocument, []string, error)

ParseSkillDocument parses a materialized SKILL.md document.

Parsing is intentionally tolerant for optional fields: malformed optional values are ignored or normalized and returned as warnings. Name, description, readable YAML frontmatter, UTF-8, and document size remain required because the runtime needs them for safe discovery and processing.

type SkillInsert

type SkillInsert string

SkillInsert describes where a rendered SKILL.md body should be inserted by the consumer.

The default is SkillInsertInstructions. This keeps normal Agent Skills behavior: a skill body is instruction/context material unless it explicitly opts into user insertion.

const (
	// SkillInsertInstructions means the rendered body is instruction/context material.
	SkillInsertInstructions SkillInsert = "instructions"
	// SkillInsertUserMessage means the rendered body should be placed in the user-message body.
	SkillInsertUserMessage SkillInsert = "user-message"
)

func NormalizeSkillInsert

func NormalizeSkillInsert(v SkillInsert) (SkillInsert, bool)

Jump to

Keyboard shortcuts

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