Skip to content

Commit 73bf962

Browse files
feat(skills): add additional-notes flag to generate skills command (#2696)
## Description This PR adds a new `--additional-notes` flag to the skills-generate command. This allows users to provide custom text that will be appended to the Usage section of the generated SKILL.md file. ## PR Checklist > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #<issue_number_goes_here> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 86c9843 commit 73bf962

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

cmd/internal/skills/command.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ import (
3434
// skillsCmd is the command for generating skills.
3535
type skillsCmd struct {
3636
*cobra.Command
37-
name string
38-
description string
39-
toolset string
40-
outputDir string
41-
licenseHeader string
37+
name string
38+
description string
39+
toolset string
40+
outputDir string
41+
licenseHeader string
42+
additionalNotes string
4243
}
4344

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

6163
_ = cmd.MarkFlagRequired("name")
6264
_ = cmd.MarkFlagRequired("description")
@@ -185,7 +187,7 @@ func run(cmd *skillsCmd, opts *internal.ToolboxOptions) error {
185187
}
186188

187189
// Generate SKILL.md
188-
skillContent, err := generateSkillMarkdown(cmd.name, cmd.description, allTools, parser.EnvVars)
190+
skillContent, err := generateSkillMarkdown(cmd.name, cmd.description, cmd.additionalNotes, allTools, parser.EnvVars)
189191
if err != nil {
190192
errMsg := fmt.Errorf("error generating SKILL.md content: %w", err)
191193
opts.Logger.ErrorContext(ctx, errMsg.Error())

cmd/internal/skills/generator.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ All scripts can be executed using Node.js. Replace ` + "`" + `<param_name>` + "`
3838
3939
**PowerShell:**
4040
` + "`" + `node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'` + "`" + `
41+
{{if .AdditionalNotes}}
42+
{{.AdditionalNotes}}
43+
{{end}}
4144
4245
## Scripts
4346
@@ -61,13 +64,14 @@ type toolTemplateData struct {
6164
type skillTemplateData struct {
6265
SkillName string
6366
SkillDescription string
67+
AdditionalNotes string
6468
Tools []toolTemplateData
6569
}
6670

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

7377
// Order tools based on name
@@ -96,6 +100,7 @@ func generateSkillMarkdown(skillName, skillDescription string, toolsMap map[stri
96100
data := skillTemplateData{
97101
SkillName: skillName,
98102
SkillDescription: skillDescription,
103+
AdditionalNotes: additionalNotes,
99104
Tools: toolsData,
100105
}
101106

cmd/internal/skills/generator_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func TestGenerateSkillMarkdown(t *testing.T) {
183183
},
184184
}
185185

186-
got, err := generateSkillMarkdown("MySkill", "My Description", toolsMap, nil)
186+
got, err := generateSkillMarkdown("MySkill", "My Description", "Some extra notes", toolsMap, nil)
187187
if err != nil {
188188
t.Fatalf("generateSkillMarkdown() error = %v", err)
189189
}
@@ -197,6 +197,7 @@ func TestGenerateSkillMarkdown(t *testing.T) {
197197
"`node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'`",
198198
"**PowerShell:**",
199199
"`node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'`",
200+
"Some extra notes",
200201
"## Scripts",
201202
"### tool1",
202203
"First tool",

docs/en/how-to/generate_skill.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ toolbox <tool-source> skills-generate \
2828
--toolset <toolset-name> \
2929
--description <description> \
3030
--output-dir <output-directory> \
31-
--license-header <license-header>
31+
--license-header <license-header> \
32+
--additional-notes <additional-notes>
3233
```
3334

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

4143
{{< notice note >}}
4244
**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`).

docs/en/reference/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ toolbox skills-generate --name <name> --description <description> --toolset <too
7171
- `--toolset`: (Optional) Name of the toolset to convert into a skill. If not provided, all tools will be included.
7272
- `--output-dir`: (Optional) Directory to output generated skills (default: "skills").
7373
- `--license-header`: (Optional) Optional license header to prepend to generated node scripts.
74+
- `--additional-notes`: (Optional) Additional notes to add under the Usage section of the generated SKILL.md.
7475

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

0 commit comments

Comments
 (0)