mirror of
https://github.com/flutter/agent-plugins.git
synced 2026-09-14 16:19:33 +08:00
136 lines
3.8 KiB
Markdown
136 lines
3.8 KiB
Markdown
# Skills CLI
|
|
|
|
The Skills CLI simplifies the process of creating "Agent Skills" from external documentation. It allows you to crawl documentation websites to discover relevant pages and then uses Generative AI (Gemini) to convert those pages into structured `SKILL.md` files that agents can use.
|
|
|
|
## Context
|
|
|
|
* [Agent Skills Best Practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
|
|
|
|
## Prerequisite
|
|
|
|
This tool requires the `GEMINI_API_KEY` environment variable to be set.
|
|
|
|
## Commands
|
|
|
|
### `generate-skill`
|
|
|
|
Generates `SKILL.md` files from a YAML configuration file. Use the `--skill` option to generate a specific skill.
|
|
|
|
**Usage:**
|
|
```bash
|
|
dart run skills generate-skill [options] [config_file]
|
|
```
|
|
|
|
**Arguments:**
|
|
* `[config_file]`: Path to the YAML configuration file. Defaults to `resources/flutter_skills.yaml`.
|
|
|
|
**Options:**
|
|
* `--skill`: Filter to generate only the specified skill by name.
|
|
* `--directory` (`-d`): The directory to output the generated skill folder. Defaults to `../skills/`.
|
|
|
|
**Example:**
|
|
Generate all skills defined in resources/flutter_skills.yaml to the skills/ directory:
|
|
|
|
```bash
|
|
dart run skills generate-skill
|
|
```
|
|
|
|
Generate only the 'flutter-layout' skill to a custom directory:
|
|
|
|
```bash
|
|
dart run skills generate-skill --skill flutter-layout --directory ../skills
|
|
```
|
|
|
|
### `update-skill`
|
|
|
|
Updates an existing skill by combining its current content with fetched resources and new instructions.
|
|
|
|
**Usage:**
|
|
```bash
|
|
dart run skills update-skill [options] [config_file]
|
|
```
|
|
|
|
**Arguments:**
|
|
* `[config_file]`: Path to the YAML configuration file. Defaults to `resources/flutter_skills.yaml`.
|
|
|
|
**Options:**
|
|
* `--skill`: Filter to update only the specified skill by name.
|
|
* `--directory` (`-d`): The directory to search for skills. Defaults to `../skills/`.
|
|
* `--thinking-budget`: The token budget for the model to "think" before generating content. Defaults to 2048.
|
|
|
|
**Example:**
|
|
Update all skills defined in resources/flutter_skills.yaml:
|
|
|
|
```bash
|
|
dart run skills update-skill
|
|
```
|
|
|
|
Update only the 'flutter-layout' skill:
|
|
|
|
```bash
|
|
dart run skills update-skill --skill flutter-layout
|
|
```
|
|
|
|
### `validate-skill`
|
|
|
|
Validates skills by re-generating and comparing with existing skills. This is useful for testing prompts or verifying consistency.
|
|
|
|
**Usage:**
|
|
```bash
|
|
dart run skills validate-skill [options] [config_file]
|
|
```
|
|
|
|
**Arguments:**
|
|
* `[config_file]`: Path to the YAML configuration file. Defaults to `resources/flutter_skills.yaml`.
|
|
|
|
**Options:**
|
|
* `--skill`: Validate only the specified skill by name.
|
|
* `--directory` (`-d`): The directory containing the generated skills to validate. Defaults to `../skills/`.
|
|
* `--thinking-budget`: The token budget for the model to "think" before generating content. Defaults to 2048.
|
|
|
|
**Example:**
|
|
Validate skills in the default 'skills' directory:
|
|
|
|
```bash
|
|
dart run skills validate-skill
|
|
```
|
|
|
|
Validate skills in a custom directory:
|
|
|
|
```bash
|
|
dart run skills validate-skill --directory ../validation_results
|
|
```
|
|
|
|
### `update-readme`
|
|
|
|
Updates the `README.md` file with a table of available skills.
|
|
|
|
**Usage:**
|
|
```bash
|
|
dart run skills update-readme [config_file] [readme_file]
|
|
```
|
|
|
|
**Arguments:**
|
|
* `[config_file]`: Path to the YAML configuration file. Defaults to `resources/flutter_skills.yaml`.
|
|
* `[readme_file]`: Path to the README.md file to update. Defaults to `../README.md`.
|
|
|
|
**Example:**
|
|
Update the root README.md:
|
|
|
|
```bash
|
|
dart run skills update-readme
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The default configuration file is located at `tool/resources/flutter_skills.yaml`. It contains a list of skill definitions:
|
|
|
|
```yaml
|
|
- name: flutter-layout
|
|
description: "..."
|
|
resources:
|
|
- https://docs.flutter.dev/ui/widgets/layout
|
|
- https://docs.flutter.dev/ui/layout
|
|
- ../packages/flutter/lib/src/widgets/layout.md
|
|
```
|