Documentation
¶
Overview ¶
Package mkskill composes a Claude Code SKILL.md and an agent-agnostic AGENTS.md from a project's ai/ source sections, and exposes the two generate commands (generate-claude-skill / generate-agent-docs) so every ot4go CLI handles its docs and skill identically. The shared convention lives in __convenciones/AI-and-claude-skills.md.
A Spec is the single source of truth: a name, a trigger description, and the ordered markdown sections. Skill() renders the skill (YAML frontmatter + "# Name" heading + sections); AgentDocs() renders the same sections without frontmatter. The Run* / Dispatch helpers own the flag parsing, including -global.
A host wires it in at the top of main with CheckParams: it runs a generate command if the program was invoked as one, else falls through so the host handles its own command line:
if err, done := Skill.CheckParams(); done {
return
} else if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
// …not a mkskill command: the host handles os.Args itself…
(Dispatch is the lower-level primitive CheckParams is built on, when the host has already split out the command name.)
The host embeds its ai/ tree once and lists the section order:
//go:embed ai
var aiFS embed.FS
var Skill = mkskill.Spec{Name: "myproj", Description: "…", FS: aiFS,
Sections: []string{"ai/core/overview.md", "ai/core/cli.md"}}
The mkskill binary (cmd/mkskill) bootstraps a new project with `mkskill init` and installs mkskill's own skill — it does not generate other projects' skills.
Index ¶
- func Usage(detail bool) string
- type Spec
- func (s Spec) AgentDocs() (string, error)
- func (s Spec) CheckParams() (err error, done bool)
- func (s Spec) Dispatch(cmd string, args []string) (handled bool, err error)
- func (s Spec) RunGenerateAgentDocs(args []string) error
- func (s Spec) RunGenerateClaudeSkill(args []string) error
- func (s Spec) Skill() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Usage ¶ added in v0.1.2
Usage returns mkskill's command help for a host to embed in its own help, so it stays in sync as mkskill gains commands or flags. detail=false is the compact header (one aligned "name flags" line per command); detail=true adds a description line under each. Both have no leading indent or trailing newline — the host positions them.
Types ¶
type Spec ¶
type Spec struct {
Name string // skill name; also the default skill directory
Description string // the trigger text Claude uses to decide when to load the skill
FS fsys.FS // the embedded ai/ tree (an embed.FS satisfies fs.FS)
Sections []string // section file paths within FS, in order (e.g. "ai/core/overview.md")
}
Spec is everything mkskill needs to render a project's skill and agent docs. The host embeds its ai/ tree once (//go:embed ai → an fs.FS) and lists the section files in order; the same ordered sections feed both outputs, so they can't drift.
func (Spec) AgentDocs ¶
AgentDocs renders the agent-agnostic document: an "# Name" heading and the same sections, with no tool-specific frontmatter. Suitable for AGENTS.md, .cursor/rules, CONVENTIONS.md, or any LLM context input.
func (Spec) CheckParams ¶
CheckParams is the one-call host integration: it inspects os.Args and runs a generate command if the program was invoked as one. It returns done=true when a generate command ran successfully (the host should stop), err!=nil when a generate command was recognised but failed, and both zero when os.Args is not a generate command (so the host falls through to its own argument handling):
if err, done := Skill.CheckParams(); done {
return
} else if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
// …not a mkskill command: the host handles os.Args itself…
func (Spec) Dispatch ¶
Dispatch routes the two generate commands. It returns handled=false for any other command so a host CLI can fall through to its own commands:
if ok, err := spec.Dispatch(cmd, args); ok { return err }
func (Spec) RunGenerateAgentDocs ¶
RunGenerateAgentDocs parses [-dst f] [-force] and writes the AGENTS.md (default destination AGENTS.md).
func (Spec) RunGenerateClaudeSkill ¶
RunGenerateClaudeSkill parses [-dst f] [-global] [-force] and writes the SKILL.md. Default destination is the project-local .claude/skills/<name>/SKILL.md; -global writes ~/.claude/skills/<name>/SKILL.md (available from every project, no elevation — it is under the user's own home); -global and -dst are mutually exclusive.