@google/gemini-cli-core 0.41.0-preview.1 → 0.42.0-nightly.20260501.gcaa046641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/changelogs/index.md +18 -0
- package/dist/docs/changelogs/latest.md +167 -242
- package/dist/docs/changelogs/preview.md +99 -385
- package/dist/docs/cli/cli-reference.md +1 -0
- package/dist/docs/cli/creating-skills.md +165 -38
- package/dist/docs/cli/custom-commands.md +1 -0
- package/dist/docs/cli/model-routing.md +3 -3
- package/dist/docs/cli/plan-mode.md +2 -1
- package/dist/docs/cli/skills-best-practices.md +78 -0
- package/dist/docs/cli/skills.md +98 -93
- package/dist/docs/cli/tutorials/session-management.md +13 -0
- package/dist/docs/cli/tutorials/skills-getting-started.md +140 -92
- package/dist/docs/cli/using-agent-skills.md +89 -0
- package/dist/docs/core/gemma-setup.md +83 -0
- package/dist/docs/core/index.md +3 -2
- package/dist/docs/core/local-model-routing.md +14 -7
- package/dist/docs/reference/commands.md +14 -4
- package/dist/docs/reference/configuration.md +76 -4
- package/dist/docs/reference/keyboard-shortcuts.md +1 -1
- package/dist/docs/reference/policy-engine.md +14 -3
- package/dist/docs/sidebar.json +24 -2
- package/dist/docs/tools/activate-skill.md +1 -1
- package/dist/{google-gemini-cli-core-0.41.0-preview.0.tgz → google-gemini-cli-core-0.42.0-nightly.20260428.g59b2dea0e.tgz} +0 -0
- package/dist/src/agent/event-translator.js +1 -1
- package/dist/src/agent/event-translator.js.map +1 -1
- package/dist/src/agent/event-translator.test.js +2 -2
- package/dist/src/agent/event-translator.test.js.map +1 -1
- package/dist/src/agent/legacy-agent-session.test.js +1 -1
- package/dist/src/agent/legacy-agent-session.test.js.map +1 -1
- package/dist/src/agents/a2aUtils.js +1 -1
- package/dist/src/agents/a2aUtils.js.map +1 -1
- package/dist/src/agents/a2aUtils.test.js +18 -0
- package/dist/src/agents/a2aUtils.test.js.map +1 -1
- package/dist/src/agents/agentLoader.d.ts +105 -0
- package/dist/src/agents/agentLoader.js +20 -0
- package/dist/src/agents/agentLoader.js.map +1 -1
- package/dist/src/agents/agentLoader.test.js +60 -0
- package/dist/src/agents/agentLoader.test.js.map +1 -1
- package/dist/src/agents/auth-provider/types.d.ts +5 -0
- package/dist/src/availability/autoRoutingFallback.integration.test.d.ts +6 -0
- package/dist/src/availability/autoRoutingFallback.integration.test.js +287 -0
- package/dist/src/availability/autoRoutingFallback.integration.test.js.map +1 -0
- package/dist/src/availability/fallbackIntegration.test.js +28 -0
- package/dist/src/availability/fallbackIntegration.test.js.map +1 -1
- package/dist/src/availability/modelAvailabilityService.d.ts +1 -1
- package/dist/src/availability/modelAvailabilityService.js +3 -2
- package/dist/src/availability/modelAvailabilityService.js.map +1 -1
- package/dist/src/availability/modelAvailabilityService.test.js +5 -0
- package/dist/src/availability/modelAvailabilityService.test.js.map +1 -1
- package/dist/src/availability/modelPolicy.d.ts +1 -0
- package/dist/src/availability/policyCatalog.d.ts +1 -0
- package/dist/src/availability/policyCatalog.js +38 -9
- package/dist/src/availability/policyCatalog.js.map +1 -1
- package/dist/src/availability/policyCatalog.test.js +5 -2
- package/dist/src/availability/policyCatalog.test.js.map +1 -1
- package/dist/src/availability/policyHelpers.js +14 -6
- package/dist/src/availability/policyHelpers.js.map +1 -1
- package/dist/src/availability/policyHelpers.test.js +36 -1
- package/dist/src/availability/policyHelpers.test.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +76 -4
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/core/baseLlmClient.js +3 -1
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +27 -23
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +1 -6
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +1 -7
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/output/json-formatter.d.ts +1 -1
- package/dist/src/output/json-formatter.js +4 -1
- package/dist/src/output/json-formatter.js.map +1 -1
- package/dist/src/output/json-formatter.test.js +7 -0
- package/dist/src/output/json-formatter.test.js.map +1 -1
- package/dist/src/output/types.d.ts +1 -0
- package/dist/src/output/types.js.map +1 -1
- package/dist/src/prompts/snippets.js +2 -2
- package/dist/src/prompts/snippets.js.map +1 -1
- package/dist/src/prompts/snippets.legacy.js +1 -1
- package/dist/src/prompts/snippets.legacy.js.map +1 -1
- package/dist/src/scheduler/confirmation.test.js +29 -0
- package/dist/src/scheduler/confirmation.test.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +6 -0
- package/dist/src/services/chatRecordingService.js +65 -17
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +66 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/tools/grep.js +1 -1
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +17 -0
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.js +2 -1
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +29 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/utils/channel.d.ts +8 -0
- package/dist/src/utils/channel.js +21 -10
- package/dist/src/utils/channel.js.map +1 -1
- package/dist/src/utils/events.d.ts +6 -1
- package/dist/src/utils/events.js +13 -2
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/events.test.js +39 -0
- package/dist/src/utils/events.test.js.map +1 -1
- package/dist/src/utils/fetch.js +10 -8
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fetch.test.js +1 -1
- package/dist/src/utils/fetch.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.js +16 -5
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +50 -1
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/partUtils.d.ts +6 -0
- package/dist/src/utils/partUtils.js +9 -0
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/retry.js +7 -3
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +17 -0
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
# Creating Agent Skills
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Agent Skills let you extend Gemini CLI with specialized expertise, procedural
|
|
4
|
+
workflows, and task-specific resources. This guide walks you through both
|
|
5
|
+
automated and manual methods for creating and organizing your skills.
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## Quickstart: Create a skill with a prompt
|
|
7
8
|
|
|
8
|
-
The
|
|
9
|
-
skill
|
|
9
|
+
The fastest way to create a new skill is to use the built-in `skill-creator`.
|
|
10
|
+
This meta-skill guides you through designing, scaffolding, and validating your
|
|
11
|
+
expertise.
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Simply ask Gemini CLI to create a skill for you:
|
|
12
14
|
|
|
13
|
-
> "
|
|
15
|
+
> "Create a new skill called 'code-reviewer' that analyzes local files for
|
|
16
|
+
> common errors and style violations."
|
|
14
17
|
|
|
15
|
-
Gemini
|
|
18
|
+
Gemini will then:
|
|
16
19
|
|
|
17
20
|
1. Generate a new directory for your skill (for example, `my-new-skill/`).
|
|
18
21
|
2. Create a `SKILL.md` file with the necessary YAML frontmatter (`name` and
|
|
@@ -20,61 +23,185 @@ Gemini CLI will then use the `skill-creator` to generate the skill:
|
|
|
20
23
|
3. Create the standard resource directories: `scripts/`, `references/`, and
|
|
21
24
|
`assets/`.
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
Once created, you can find your new skill in `.gemini/skills/code-reviewer/`.
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
## Manual creation
|
|
26
29
|
|
|
27
30
|
1. **Create a directory** for your skill (for example, `my-new-skill/`).
|
|
28
31
|
2. **Create a `SKILL.md` file** inside the new directory.
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
structure.
|
|
33
|
+
### 1. Create the directory structure
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
The first step is to create the necessary folders for your skill and its
|
|
36
|
+
scripts.
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
**macOS/Linux**
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
```bash
|
|
41
|
+
mkdir -p .gemini/skills/code-reviewer/scripts
|
|
42
|
+
```
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
following structure for organizing your skill's resources:
|
|
44
|
+
**Windows (PowerShell)**
|
|
41
45
|
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
├── SKILL.md (Required) Instructions and metadata
|
|
45
|
-
├── scripts/ (Optional) Executable scripts
|
|
46
|
-
├── references/ (Optional) Static documentation
|
|
47
|
-
└── assets/ (Optional) Templates and other resources
|
|
46
|
+
```powershell
|
|
47
|
+
New-Item -ItemType Directory -Force -Path ".gemini\skills\code-reviewer\scripts"
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
### `SKILL.md`
|
|
50
|
+
### 2. Define the skill (`SKILL.md`)
|
|
51
51
|
|
|
52
|
-
The `SKILL.md` file
|
|
53
|
-
|
|
52
|
+
The `SKILL.md` file defines the skill's purpose and instructions for the agent.
|
|
53
|
+
Create a file at `.gemini/skills/code-reviewer/SKILL.md`.
|
|
54
54
|
|
|
55
55
|
```markdown
|
|
56
56
|
---
|
|
57
57
|
name: code-reviewer
|
|
58
58
|
description:
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
Expertise in reviewing code changes for correctness, security, and style. Use
|
|
60
|
+
when the user asks to "review" their code or a PR.
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
# Code Reviewer
|
|
63
|
+
# Code Reviewer Instructions
|
|
64
|
+
|
|
65
|
+
You act as a senior software engineer specialized in code quality. When this
|
|
66
|
+
skill is active, you MUST:
|
|
67
|
+
|
|
68
|
+
1. **Analyze**: Review the provided code for logical errors, security
|
|
69
|
+
vulnerabilities, and style violations.
|
|
70
|
+
2. **Review**: Use the bundled `scripts/review.js` utility to perform an
|
|
71
|
+
automated check.
|
|
72
|
+
3. **Feedback**: Provide constructive feedback, clearly distinguishing between
|
|
73
|
+
critical issues and minor improvements.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Add the tool logic
|
|
77
|
+
|
|
78
|
+
Skills can bundle resources like scripts to perform deterministic tasks. Create
|
|
79
|
+
a file at `.gemini/skills/code-reviewer/scripts/review.js`.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
// .gemini/skills/code-reviewer/scripts/review.js
|
|
83
|
+
const file = process.argv[2];
|
|
64
84
|
|
|
65
|
-
|
|
85
|
+
if (!file) {
|
|
86
|
+
console.error('Usage: node review.js <file>');
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
66
89
|
|
|
67
|
-
|
|
90
|
+
console.log(`Reviewing ${file}...`);
|
|
91
|
+
// Simple mock review logic
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
console.log(`Result: Success (No major issues found in ${file})`);
|
|
94
|
+
}, 500);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 4. Test the skill
|
|
98
|
+
|
|
99
|
+
Gemini CLI automatically discovers skills in the `.gemini/skills` directory.
|
|
100
|
+
|
|
101
|
+
1. Start a new session and ask a question that triggers the skill's
|
|
102
|
+
description: "Can you review index.js"
|
|
103
|
+
2. Gemini identifies the request matches the `code-reviewer` description and
|
|
104
|
+
asks for permission to activate it.
|
|
105
|
+
3. Once you approve, Gemini executes the bundled script:
|
|
106
|
+
`node .gemini/skills/code-reviewer/scripts/review.js index.js`
|
|
68
107
|
|
|
69
|
-
|
|
108
|
+
To determine whether your skill has been correctly loaded, run the command:
|
|
70
109
|
|
|
71
|
-
|
|
72
|
-
|
|
110
|
+
```bash
|
|
111
|
+
/skills
|
|
73
112
|
```
|
|
74
113
|
|
|
114
|
+
### 5. Optional: Share your skill
|
|
115
|
+
|
|
116
|
+
You can share your skills in several ways depending on your target audience.
|
|
117
|
+
|
|
118
|
+
- **Workspace skills**: Commit your skill to a `.gemini/skills/` directory in
|
|
119
|
+
your project repository.
|
|
120
|
+
- **Extensions**: Bundle your skill within a
|
|
121
|
+
[Gemini CLI extension](../extensions/writing-extensions.md).
|
|
122
|
+
- **Git repositories**: Share the skill directory as a standalone Git repo and
|
|
123
|
+
install it using `gemini skills install <url>`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Core concepts
|
|
128
|
+
|
|
129
|
+
Now that you've built your first skill, let's explore the core components and
|
|
130
|
+
workflows for developing more complex expertise.
|
|
131
|
+
|
|
132
|
+
### Skill structure
|
|
133
|
+
|
|
134
|
+
While a `SKILL.md` file is the only required component, we recommend the
|
|
135
|
+
following structure for organizing your skill's resources.
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
my-skill/
|
|
139
|
+
├── SKILL.md (Required) Instructions and metadata
|
|
140
|
+
├── scripts/ (Optional) Executable scripts
|
|
141
|
+
├── references/ (Optional) Static documentation
|
|
142
|
+
└── assets/ (Optional) Templates and other resources
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
When a skill is activated, the model is granted access to this entire directory.
|
|
146
|
+
You can instruct the model to use the tools and files found within these
|
|
147
|
+
folders.
|
|
148
|
+
|
|
149
|
+
### Metadata and triggers
|
|
150
|
+
|
|
151
|
+
The `SKILL.md` file uses YAML frontmatter for metadata.
|
|
152
|
+
|
|
75
153
|
- **`name`**: A unique identifier for the skill. This should match the directory
|
|
76
154
|
name.
|
|
77
|
-
- **`description`**:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
155
|
+
- **`description`**: **CRITICAL.** This is how Gemini decides when to use the
|
|
156
|
+
skill. Be specific about the tasks it handles and the keywords that should
|
|
157
|
+
trigger it.
|
|
158
|
+
|
|
159
|
+
### Discovery tiers
|
|
160
|
+
|
|
161
|
+
Gemini CLI discovers skills from several locations, following a specific order
|
|
162
|
+
of precedence (lowest to highest):
|
|
163
|
+
|
|
164
|
+
1. **Built-in Skills**: Included with Gemini CLI (pre-approved).
|
|
165
|
+
2. **Extension Skills**: Bundled within [extensions](../extensions/).
|
|
166
|
+
3. **User Skills**: `~/.gemini/skills/` or the `~/.agents/skills/` alias.
|
|
167
|
+
4. **Workspace Skills**: `.gemini/skills/` or the `.agents/skills/` alias.
|
|
168
|
+
|
|
169
|
+
### Discovery aliases
|
|
170
|
+
|
|
171
|
+
You can use `.agents/skills` as an alternative to `.gemini/skills`. This alias
|
|
172
|
+
is compatible with other AI agent tools following the
|
|
173
|
+
[Agent Skills](https://agentskills.io) standard.
|
|
174
|
+
|
|
175
|
+
## Advanced development
|
|
176
|
+
|
|
177
|
+
Once you've built a basic skill, you can use specialized scripts and workflows
|
|
178
|
+
to streamline your development process.
|
|
179
|
+
|
|
180
|
+
### Creation scripts
|
|
181
|
+
|
|
182
|
+
If you are developing a skill and want to use the same scripts the built-in
|
|
183
|
+
tools use, you can find them in the core package. These scripts help automate
|
|
184
|
+
the initialization, validation, and packaging of skills.
|
|
185
|
+
|
|
186
|
+
- **Initialize**: `node scripts/init_skill.cjs <name> --path <dir>`
|
|
187
|
+
- **Validate**: `node scripts/validate_skill.cjs <path/to/skill>`
|
|
188
|
+
- **Package**: `node scripts/package_skill.cjs <path/to/skill>` (Creates a
|
|
189
|
+
`.skill` zip file)
|
|
190
|
+
|
|
191
|
+
### Linking for local development
|
|
192
|
+
|
|
193
|
+
If you are developing a skill in a separate directory, you can link it to your
|
|
194
|
+
user skills directory for testing:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
gemini skills link .
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Next steps
|
|
201
|
+
|
|
202
|
+
- [Skill best practices](./skills-best-practices.md): Learn strategies for
|
|
203
|
+
building reliable and effective skills.
|
|
204
|
+
- [Agent Skills overview](./skills.md): Deep dive into discovery tiers and the
|
|
205
|
+
skill lifecycle.
|
|
206
|
+
- [Get started with Agent Skills](./tutorials/skills-getting-started.md): A
|
|
207
|
+
quick walkthrough of triggering and using skills.
|
|
@@ -34,6 +34,7 @@ separator (`/` or `\`) being converted to a colon (`:`).
|
|
|
34
34
|
> [!TIP]
|
|
35
35
|
> After creating or modifying `.toml` command files, run
|
|
36
36
|
> `/commands reload` to pick up your changes without restarting the CLI.
|
|
37
|
+
> To see all available command files, run `/commands list`.
|
|
37
38
|
|
|
38
39
|
## TOML file format (v1)
|
|
39
40
|
|
|
@@ -34,11 +34,11 @@ Gemini CLI will use a locally-running **Gemma** model to make routing decisions
|
|
|
34
34
|
reduce costs associated with hosted model usage while offering similar routing
|
|
35
35
|
decision latency and quality.
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
The easiest way to set this up is using the automated `gemini gemma setup`
|
|
38
|
+
command.
|
|
39
39
|
|
|
40
40
|
For more details on how to configure local model routing, see
|
|
41
|
-
[Local Model Routing](../core/
|
|
41
|
+
[`gemini gemma` — Local Model Routing Setup](../core/gemma-setup.md).
|
|
42
42
|
|
|
43
43
|
### Model selection precedence
|
|
44
44
|
|
|
@@ -470,7 +470,8 @@ associated plan files and task trackers.
|
|
|
470
470
|
|
|
471
471
|
- **Default behavior:** Sessions (and their plans) are retained for **30 days**.
|
|
472
472
|
- **Configuration:** You can customize this behavior via the `/settings` command
|
|
473
|
-
(search for **Session
|
|
473
|
+
(search for **Enable Session Cleanup** or **Keep chat history**) or in your
|
|
474
|
+
`settings.json` file. See
|
|
474
475
|
[session retention](../cli/session-management.md#session-retention) for more
|
|
475
476
|
details.
|
|
476
477
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Agent Skill best practices
|
|
2
|
+
|
|
3
|
+
Create high-quality, reliable Agent Skills by following these established design
|
|
4
|
+
principles and patterns.
|
|
5
|
+
|
|
6
|
+
## Design for discovery
|
|
7
|
+
|
|
8
|
+
The most important part of a skill is its `description`. This is the only
|
|
9
|
+
information the model has before activation.
|
|
10
|
+
|
|
11
|
+
- **Be specific**: Use keywords that are likely to appear in user prompts (for
|
|
12
|
+
example, "audit," "security," "refactor," "migration").
|
|
13
|
+
- **Define the trigger**: Clearly state _when_ the skill should be used (for
|
|
14
|
+
example, "Use this skill when the user asks to review a PR for performance
|
|
15
|
+
regressions").
|
|
16
|
+
- **Avoid overlap**: Ensure your skill descriptions are distinct from one
|
|
17
|
+
another and from the general capabilities of the model.
|
|
18
|
+
|
|
19
|
+
## Progressive disclosure
|
|
20
|
+
|
|
21
|
+
The "context window" is a shared resource. Use a three-level loading system to
|
|
22
|
+
manage context efficiently.
|
|
23
|
+
|
|
24
|
+
1. **Metadata (name + description)**: Always in context (~100 words).
|
|
25
|
+
2. **`SKILL.md` body**: Loaded only after the skill triggers (<5k words).
|
|
26
|
+
3. **Bundled resources**: Loaded only as needed by the model.
|
|
27
|
+
|
|
28
|
+
**Best practice**: Keep the `SKILL.md` body focused on core procedural
|
|
29
|
+
instructions. Move detailed reference material, schemas, and examples into
|
|
30
|
+
separate files in a `references/` directory.
|
|
31
|
+
|
|
32
|
+
## Degrees of freedom
|
|
33
|
+
|
|
34
|
+
Match the level of instruction specificity to the task's fragility.
|
|
35
|
+
|
|
36
|
+
- **High freedom (text-based instructions)**: Use when multiple approaches are
|
|
37
|
+
valid or decisions depend heavily on context.
|
|
38
|
+
- **Medium freedom (pseudocode or scripts with parameters)**: Use when a
|
|
39
|
+
preferred pattern exists but some variation is acceptable.
|
|
40
|
+
- **Low freedom (specific scripts, few parameters)**: Use when operations are
|
|
41
|
+
fragile and error-prone, or a specific sequence MUST be followed.
|
|
42
|
+
|
|
43
|
+
## Bundle resources effectively
|
|
44
|
+
|
|
45
|
+
Leverage the skill's ability to include scripts and assets to extend the agent's
|
|
46
|
+
capabilities.
|
|
47
|
+
|
|
48
|
+
- **Use scripts for deterministic tasks**: If a task can be automated with a
|
|
49
|
+
script (for example, running a linter, fetching data from an API), bundle it
|
|
50
|
+
in the `scripts/` folder.
|
|
51
|
+
- **Agentic ergonomics**: Ensure scripts output LLM-friendly stdout. Suppress
|
|
52
|
+
verbose tracebacks and provide clear, concise success/failure messages.
|
|
53
|
+
- **Provide templates**: Include common file headers or boilerplate code in the
|
|
54
|
+
`assets/` folder to ensure the agent produces consistent output.
|
|
55
|
+
|
|
56
|
+
## Anatomy of a great skill
|
|
57
|
+
|
|
58
|
+
A well-structured skill directory organizes its resources into specialized
|
|
59
|
+
sub-folders.
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
my-skill/
|
|
63
|
+
├── SKILL.md (Required) Core instructions and metadata
|
|
64
|
+
├── scripts/ (Optional) Executable logic (Node.js, Python, etc.)
|
|
65
|
+
├── references/ (Optional) Documentation to be loaded as needed
|
|
66
|
+
└── assets/ (Optional) Templates and non-executable resources
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Security and privacy
|
|
70
|
+
|
|
71
|
+
Design your skills with security in mind to protect your workspace and data.
|
|
72
|
+
|
|
73
|
+
- **Avoid hardcoded secrets**: Never include API keys or passwords in your
|
|
74
|
+
skill's scripts or documentation.
|
|
75
|
+
- **Review third-party skills**: Inspect the `SKILL.md` and scripts of any skill
|
|
76
|
+
before installing it from an untrusted source.
|
|
77
|
+
- **Limit scope**: Design skills to be as focused as possible to minimize the
|
|
78
|
+
potential impact of errors.
|
package/dist/docs/cli/skills.md
CHANGED
|
@@ -1,136 +1,141 @@
|
|
|
1
1
|
# Agent Skills
|
|
2
2
|
|
|
3
|
-
Agent Skills
|
|
4
|
-
|
|
3
|
+
Agent Skills let you extend Gemini CLI with specialized expertise, procedural
|
|
4
|
+
workflows, and task-specific resources. Based on the
|
|
5
5
|
[Agent Skills](https://agentskills.io) open standard, a "skill" is a
|
|
6
6
|
self-contained directory that packages instructions and assets into a
|
|
7
7
|
discoverable capability.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Unlike general context files ([`GEMINI.md`](./gemini-md.md)), which provide
|
|
9
|
+
Unlike general context files ([GEMINI.md](./gemini-md.md)), which provide
|
|
12
10
|
persistent workspace-wide background, Skills represent **on-demand expertise**.
|
|
13
|
-
This
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
This lets Gemini CLI maintain a vast library of specialized capabilities—such as
|
|
12
|
+
security auditing, cloud deployments, or codebase migrations—without cluttering
|
|
13
|
+
the model's immediate context window.
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
skill's description. When a relevant skill is identified, the model "pulls in"
|
|
19
|
-
the full instructions and resources required to complete the task using the
|
|
20
|
-
`activate_skill` tool.
|
|
15
|
+
## How it works
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
The lifecycle of an Agent Skill involves discovery, activation, and conditional
|
|
18
|
+
resource access.
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
1. **Discovery**: At the start of a session, Gemini CLI scans the discovery
|
|
21
|
+
tiers and injects the name and description of all enabled skills into the
|
|
22
|
+
system prompt.
|
|
23
|
+
2. **Activation**: When Gemini identifies a task matching a skill's
|
|
24
|
+
description, it calls the `activate_skill` tool.
|
|
25
|
+
3. **Consent**: You will see a confirmation prompt in the UI detailing the
|
|
26
|
+
skill's name, purpose, and the directory path it will gain access to.
|
|
27
|
+
4. **Injection**: Upon your approval:
|
|
28
|
+
- The `SKILL.md` body and folder structure is added to the conversation
|
|
29
|
+
history.
|
|
30
|
+
- The skill's directory is added to the agent's allowed file paths, granting
|
|
31
|
+
it permission to read any bundled assets.
|
|
32
|
+
5. **Execution**: The model proceeds with the specialized expertise active. It
|
|
33
|
+
is instructed to prioritize the skill's procedural guidance within reason.
|
|
33
34
|
|
|
34
|
-
##
|
|
35
|
+
## Discovery tiers
|
|
35
36
|
|
|
36
|
-
Gemini CLI discovers skills from
|
|
37
|
+
Gemini CLI discovers skills from several locations, following a specific order
|
|
38
|
+
of precedence (lowest to highest):
|
|
37
39
|
|
|
38
|
-
1. **
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
2. **User Skills**: Located in `~/.gemini/skills/` or the `~/.agents/skills/`
|
|
42
|
-
alias. These are personal skills available across all your workspaces.
|
|
43
|
-
3. **Extension Skills**: Skills bundled within installed
|
|
40
|
+
1. **Built-in skills**: Standard skills included with Gemini CLI that provide
|
|
41
|
+
foundational capabilities.
|
|
42
|
+
2. **Extension skills**: Skills bundled within installed
|
|
44
43
|
[extensions](../extensions/index.md).
|
|
44
|
+
3. **User skills**: Located in `~/.gemini/skills/` or the `~/.agents/skills/`
|
|
45
|
+
alias.
|
|
46
|
+
4. **Workspace skills**: Located in `.gemini/skills/` or the `.agents/skills/`
|
|
47
|
+
alias. Workspace skills are shared with your team via version control.
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
locations override lower ones: **Workspace > User > Extension**.
|
|
49
|
+
### Precedence and aliases
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
across different AI agent tools.
|
|
51
|
+
If multiple skills share the same name, the version from the higher-precedence
|
|
52
|
+
location is used. Within the same tier (user or workspace), the
|
|
53
|
+
`.agents/skills/` alias takes precedence over the `.gemini/skills/` directory.
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
The `.agents/skills/` alias provides an interoperable path for managing
|
|
56
|
+
agent-specific expertise that remains compatible across different AI tools.
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
## Key benefits
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
Agent Skills provide several advantages for managing specialized knowledge and
|
|
61
|
+
complex workflows.
|
|
59
62
|
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
-
|
|
63
|
+
- **Shared expertise**: Package complex workflows (like a specific team's PR
|
|
64
|
+
review process) into a folder that anyone can use.
|
|
65
|
+
- **Repeatable workflows**: Ensure complex multi-step tasks are performed
|
|
66
|
+
consistently by providing a procedural framework.
|
|
67
|
+
- **Resource bundling**: Include scripts, templates, or example data alongside
|
|
68
|
+
instructions so the agent has everything it needs.
|
|
69
|
+
- **Progressive disclosure**: Only skill metadata (name and description) is
|
|
70
|
+
loaded initially. Detailed instructions and resources are only disclosed when
|
|
71
|
+
the model explicitly activates the skill, saving context tokens.
|
|
65
72
|
|
|
66
73
|
<!-- prettier-ignore -->
|
|
67
74
|
> [!NOTE]
|
|
68
75
|
> `/skills disable` and `/skills enable` default to the `user` scope. Use
|
|
69
76
|
> `--scope workspace` to manage workspace-specific settings.
|
|
70
77
|
|
|
71
|
-
|
|
78
|
+
To see all available skills in your current session, use the `/skills list`
|
|
79
|
+
command.
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
## Managing skills
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
gemini skills list
|
|
83
|
+
You can manage Agent Skills through interactive session commands or directly
|
|
84
|
+
from your terminal.
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
# Discovers skills (SKILL.md or */SKILL.md) and creates symlinks in ~/.gemini/skills
|
|
81
|
-
# (or ~/.agents/skills)
|
|
82
|
-
gemini skills link /path/to/my-skills-repo
|
|
86
|
+
### In an interactive session
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
gemini skills link /path/to/my-skills-repo --scope workspace
|
|
88
|
+
Use the `/skills` slash command to view and manage available expertise:
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
- `/skills list [all] [nodesc]`: Shows discovered skills. Use `all` to include
|
|
91
|
+
built-in skills and `nodesc` to hide descriptions.
|
|
92
|
+
- `/skills link <path> [--scope user|workspace]`: Links skills from a local
|
|
93
|
+
directory.
|
|
94
|
+
- `/skills disable <name>`: Prevents a specific skill from being used.
|
|
95
|
+
- `/skills enable <name>`: Re-enables a disabled skill.
|
|
96
|
+
- `/skills reload` (or `/skills refresh`): Refreshes the list of discovered
|
|
97
|
+
skills from all tiers.
|
|
92
98
|
|
|
93
|
-
|
|
94
|
-
gemini skills install https://github.com/my-org/my-skills.git --path skills/frontend-design
|
|
99
|
+
### From the terminal
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
gemini skills install /path/to/skill --scope workspace
|
|
101
|
+
The `gemini skills` command provides management utilities:
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
```bash
|
|
104
|
+
# List all discovered skills. Use --all to include built-in skills.
|
|
105
|
+
gemini skills list --all
|
|
101
106
|
|
|
102
|
-
#
|
|
103
|
-
|
|
107
|
+
# Install a skill from a Git repository or local directory.
|
|
108
|
+
# Use --consent to skip the security confirmation prompt.
|
|
109
|
+
gemini skills install https://github.com/user/repo.git --consent
|
|
104
110
|
|
|
105
|
-
#
|
|
106
|
-
gemini skills
|
|
111
|
+
# Uninstall a skill.
|
|
112
|
+
gemini skills uninstall my-skill --scope workspace
|
|
107
113
|
```
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
#### Command options
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- The `SKILL.md` body and folder structure is added to the conversation
|
|
120
|
-
history.
|
|
121
|
-
- The skill's directory is added to the agent's allowed file paths, granting
|
|
122
|
-
it permission to read any bundled assets.
|
|
123
|
-
5. **Execution**: The model proceeds with the specialized expertise active. It
|
|
124
|
-
is instructed to prioritize the skill's procedural guidance within reason.
|
|
117
|
+
The skill management commands support several global and command-specific
|
|
118
|
+
options.
|
|
119
|
+
|
|
120
|
+
- `--scope`: Either `user` (global, default) or `workspace` (local to the
|
|
121
|
+
project).
|
|
122
|
+
- `--path`: The sub-directory within a Git repository containing the skill.
|
|
123
|
+
- `--consent`: Acknowledge security risks and skip the interactive confirmation
|
|
124
|
+
during installation.
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
For more details on CLI commands, see the
|
|
127
|
+
[CLI reference](./cli-reference.md#skills-management).
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
the skill's description and your approval), its specialized instructions and
|
|
130
|
-
resources are loaded into the agent's context. A skill remains active and its
|
|
131
|
-
guidance is prioritized for the duration of the session.
|
|
129
|
+
## Next steps
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
Explore these resources to refine your skills and understand the framework
|
|
132
|
+
better.
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
- [Get started with Agent Skills](./tutorials/skills-getting-started.md): A
|
|
135
|
+
quick walkthrough of triggering and using skills.
|
|
136
|
+
- [Creating Agent Skills](./creating-skills.md): Create your first skill and
|
|
137
|
+
bundle custom logic.
|
|
138
|
+
- [Using Agent Skills](./using-agent-skills.md): Learn how to leverage built-in
|
|
139
|
+
and custom skills.
|
|
140
|
+
- [Best practices](./skills-best-practices.md): Learn strategies for building
|
|
141
|
+
effective skills.
|
|
@@ -61,6 +61,19 @@ gemini --list-sessions
|
|
|
61
61
|
gemini --delete-session 1
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
### Scenario: Delete session on exit
|
|
65
|
+
|
|
66
|
+
If you're doing a one-off task and don't want to leave any session history
|
|
67
|
+
behind, use the `--delete` flag when exiting:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
/exit --delete
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This removes the current session's conversation history and tool output files
|
|
74
|
+
before exiting. It's useful for privacy-sensitive tasks or quick one-off
|
|
75
|
+
interactions.
|
|
76
|
+
|
|
64
77
|
## How to rewind time (Undo mistakes)
|
|
65
78
|
|
|
66
79
|
Gemini CLI's **Rewind** feature is like `Ctrl+Z` for your workflow.
|