Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cmd/internal/skills/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ import (
// skillsCmd is the command for generating skills.
type skillsCmd struct {
*cobra.Command
name string
description string
toolset string
outputDir string
licenseHeader string
name string
description string
toolset string
outputDir string
licenseHeader string
additionalNotes string
}

// NewCommand creates a new Command.
Expand All @@ -57,6 +58,7 @@ func NewCommand(opts *internal.ToolboxOptions) *cobra.Command {
cmd.Flags().StringVar(&cmd.toolset, "toolset", "", "Name of the toolset to convert into a skill. If not provided, all tools will be included.")
cmd.Flags().StringVar(&cmd.outputDir, "output-dir", "skills", "Directory to output generated skills")
cmd.Flags().StringVar(&cmd.licenseHeader, "license-header", "", "Optional license header to prepend to generated node scripts.")
cmd.Flags().StringVar(&cmd.additionalNotes, "additional-notes", "", "Additional notes to add under the Usage section of the generated SKILL.md")

_ = cmd.MarkFlagRequired("name")
_ = cmd.MarkFlagRequired("description")
Expand Down Expand Up @@ -185,7 +187,7 @@ func run(cmd *skillsCmd, opts *internal.ToolboxOptions) error {
}

// Generate SKILL.md
skillContent, err := generateSkillMarkdown(cmd.name, cmd.description, allTools, parser.EnvVars)
skillContent, err := generateSkillMarkdown(cmd.name, cmd.description, cmd.additionalNotes, allTools, parser.EnvVars)
if err != nil {
errMsg := fmt.Errorf("error generating SKILL.md content: %w", err)
opts.Logger.ErrorContext(ctx, errMsg.Error())
Expand Down
7 changes: 6 additions & 1 deletion cmd/internal/skills/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ All scripts can be executed using Node.js. Replace ` + "`" + `<param_name>` + "`

**PowerShell:**
` + "`" + `node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'` + "`" + `
{{if .AdditionalNotes}}
{{.AdditionalNotes}}
{{end}}

## Scripts
Comment thread
twishabansal marked this conversation as resolved.

Expand All @@ -61,13 +64,14 @@ type toolTemplateData struct {
type skillTemplateData struct {
SkillName string
SkillDescription string
AdditionalNotes string
Tools []toolTemplateData
}

// generateSkillMarkdown generates the content of the SKILL.md file.
// It includes usage instructions and a reference section for each tool in the skill,
// detailing its description and parameters.
func generateSkillMarkdown(skillName, skillDescription string, toolsMap map[string]tools.Tool, envVars map[string]string) (string, error) {
func generateSkillMarkdown(skillName, skillDescription, additionalNotes string, toolsMap map[string]tools.Tool, envVars map[string]string) (string, error) {
var toolsData []toolTemplateData

// Order tools based on name
Expand Down Expand Up @@ -96,6 +100,7 @@ func generateSkillMarkdown(skillName, skillDescription string, toolsMap map[stri
data := skillTemplateData{
SkillName: skillName,
SkillDescription: skillDescription,
AdditionalNotes: additionalNotes,
Tools: toolsData,
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/internal/skills/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestGenerateSkillMarkdown(t *testing.T) {
},
}

got, err := generateSkillMarkdown("MySkill", "My Description", toolsMap, nil)
got, err := generateSkillMarkdown("MySkill", "My Description", "Some extra notes", toolsMap, nil)
if err != nil {
t.Fatalf("generateSkillMarkdown() error = %v", err)
}
Expand All @@ -197,6 +197,7 @@ func TestGenerateSkillMarkdown(t *testing.T) {
"`node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'`",
"**PowerShell:**",
"`node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'`",
"Some extra notes",
"## Scripts",
"### tool1",
"First tool",
Expand Down
4 changes: 3 additions & 1 deletion docs/en/how-to/generate_skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ toolbox <tool-source> skills-generate \
--toolset <toolset-name> \
--description <description> \
--output-dir <output-directory> \
--license-header <license-header>
--license-header <license-header> \
--additional-notes <additional-notes>
```

- `<tool-source>`: Can be `--tools-file`, `--tools-files`, `--tools-folder`, and `--prebuilt`. See the [CLI Reference](../reference/cli.md) for details.
Expand All @@ -37,6 +38,7 @@ toolbox <tool-source> skills-generate \
- `--toolset`: (Optional) Name of the toolset to convert into a skill. If not provided, all tools will be included.
- `--output-dir`: (Optional) Directory to output generated skills (default: "skills").
- `--license-header`: (Optional) Optional license header to prepend to generated node scripts.
- `--additional-notes`: (Optional) Additional notes to add under the Usage section of the generated SKILL.md.

{{< notice note >}}
**Note:** The `<skill-name>` must follow the Agent Skill [naming convention](https://agentskills.io/specification): it must contain only lowercase alphanumeric characters and hyphens, cannot start or end with a hyphen, and cannot contain consecutive hyphens (e.g., `my-skill`, `data-processing`).
Expand Down
1 change: 1 addition & 0 deletions docs/en/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ toolbox skills-generate --name <name> --description <description> --toolset <too
- `--toolset`: (Optional) Name of the toolset to convert into a skill. If not provided, all tools will be included.
- `--output-dir`: (Optional) Directory to output generated skills (default: "skills").
- `--license-header`: (Optional) Optional license header to prepend to generated node scripts.
- `--additional-notes`: (Optional) Additional notes to add under the Usage section of the generated SKILL.md.

For more detailed instructions, see [Generate Agent Skills](../how-to/generate_skill.md).

Expand Down
Loading