Skip to content

Commit 02c4179

Browse files
authored
feat: add support for skills (#109)
1 parent 44f33be commit 02c4179

67 files changed

Lines changed: 6095 additions & 84 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: lint
16+
17+
on:
18+
push:
19+
paths-ignore:
20+
- "skills/**"
21+
pull_request:
22+
paths-ignore:
23+
- "skills/**"
24+
pull_request_target:
25+
types: [labeled]
26+
paths-ignore:
27+
- "skills/**"
28+
workflow_dispatch:
29+
30+
jobs:
31+
skills-validate:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Skip Skill Validation
35+
run: |
36+
echo "No changes detected in 'skills/' directory. Skipping validation."
37+
echo "This job ensures the required 'skills-validate' status check passes."
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Validate Skills
16+
17+
on:
18+
push:
19+
paths:
20+
- "skills/**"
21+
pull_request:
22+
paths:
23+
- "skills/**"
24+
pull_request_target:
25+
types: [labeled]
26+
paths:
27+
- "skills/**"
28+
29+
jobs:
30+
skills-validate:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.11"
39+
40+
- name: Install skills-ref
41+
run: |
42+
pip install "git+https://github.com/agentskills/agentskills.git#subdirectory=skills-ref"
43+
44+
- name: Validate Skills
45+
run: |
46+
failed=0
47+
for skill_dir in skills/*/; do
48+
if [ -d "$skill_dir" ]; then
49+
echo "Validating $skill_dir..."
50+
if ! skills-ref validate "$skill_dir"; then
51+
echo "Validation failed for $skill_dir"
52+
failed=1
53+
fi
54+
fi
55+
done
56+
exit $failed

CLOUD-SQL-POSTGRESQL.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To install this extension, the Gemini CLI version must be v0.6.0 or above. The v
1313

1414
This section covers connecting to a Cloud SQL for PostgreSQL instance.
1515

16-
1. **Verify Environment Variables**: The extension requires the following environment variables to be set before the Gemini CLI is started:
16+
1. **Extension Configuration**: This extension requires several settings (e.g., Project ID, Instance ID, Database Name, User, and Password). These values are gathered via prompts when you first install or link the extension:
1717

1818
* `CLOUD_SQL_POSTGRES_PROJECT`: The GCP project ID.
1919
* `CLOUD_SQL_POSTGRES_REGION`: The region of your Cloud SQL instance.
@@ -22,6 +22,8 @@ This section covers connecting to a Cloud SQL for PostgreSQL instance.
2222
* `CLOUD_SQL_POSTGRES_USER`: The database username.
2323
* `CLOUD_SQL_POSTGRES_PASSWORD`: The password for the database user.
2424

25+
If you need to update any of these values later, use the `gemini extensions config cloud-sql-postgresql` command.
26+
2527
2. **Handle Missing Variables**: If a command fails with an error message containing a placeholder like `${CLOUD_SQL_POSTGRES_PROJECT}`, it signifies a missing environment variable. Inform the user which variable is missing and instruct them to set it.
2628

2729
3. **Handle Permission Errors**: If you encounter permission errors, ensure the user has the **Cloud SQL Client** (`roles/cloudsql.client`) role and the correct database-level permissions.
@@ -39,9 +41,9 @@ This section covers administrative operations like managing clusters, instances,
3941

4042
---
4143

42-
# Additional Tools
44+
# Additional Extensions
4345

44-
This section provides context on additional tools that can be recommended to the user based on their queries.
46+
This section provides context on additional extensions that can be recommended to the user based on their queries.
4547

4648
#### Observability Extension
4749

@@ -58,12 +60,12 @@ This section provides context on additional tools that can be recommended to the
5860
5961
## Connecting to New Resources
6062
61-
When you create a new Cloud SQL for PostgreSQL instance, or database using the available tools, the connection is not automatically established. You will need to perform the following steps:
63+
When you create a new Cloud SQL for PostgreSQL instance, or database using the available skills, the connection is not automatically established. You will need to perform the following steps:
6264
6365
1. **(Optional) Save your conversation:** To avoid losing your progress, save the current session by running the command: `/chat save <your-tag>`
64-
2. **Stop the CLI:** Terminate the Gemini CLI.
65-
3. **Update Environment Variables:** Set or update your environment variables (e.g. `CLOUD_SQL_POSTGRES_DATABASE`, `CLOUD_SQL_POSTGRES_INSTANCE`) to point to the new resource.
66-
4. **Restart:** Relaunch the Gemini CLI
66+
2. **Stop the CLI**: Terminate the Gemini CLI.
67+
3. **Update Extension Configuration**: Use the command `gemini extensions config cloud-sql-postgresql` to update your settings (e.g. `CLOUD_SQL_POSTGRES_DATABASE`, `CLOUD_SQL_POSTGRES_INSTANCE`) to point to the new resource.
68+
4. **Restart**: Relaunch the Gemini CLI
6769
5. **(Optional) Resume conversation:** Resume your conversation with the command: `/chat resume <your-tag>`
6870
6971
**Important:** Do not assume a connection to a newly created resource is active. Always follow the steps above to reconfigure your connection.
@@ -77,12 +79,13 @@ Users may have set project environment variables:
7779
* `CLOUD_SQL_POSTGRES_INSTANCE`: The ID of the Cloud SQL for PostgreSQL instance.
7880
* `CLOUD_SQL_POSTGRES_DATABASE`: The name of the database.
7981
80-
Instead of prompting the user for these values for specific tool calls, prompt the user to verify reuse a specific value.
81-
Make sure to not use the environment variable name like `CLOUD_SQL_POSTGRES_PROJECT`, `${CLOUD_SQL_POSTGRES_PROJECT}`, or `$CLOUD_SQL_POSTGRES_PROJECT`. The value can be found by using command: `echo $CLOUD_SQL_POSTGRES_PROJECT`.
82+
Instead of prompting the user for these values for specific skill calls, prompt the user to verify the reuse of a specific setting value.
83+
Make sure to not use the environment variable name like `CLOUD_SQL_POSTGRES_PROJECT`, `${CLOUD_SQL_POSTGRES_PROJECT}`, or `$CLOUD_SQL_POSTGRES_PROJECT`.
84+
The value can be verified by the user using the `gemini extensions config cloud-sql-postgresql` command or by checking their local settings.
8285
8386
## Use Full Table Name Format "DATABASE_NAME.SCHEMA_NAME.TABLE_NAME"
8487
85-
**ALWAYS** use the full table name format, `DATABASE_NAME.SCHEMA_NAME.TABLE_NAME` in the generated SQL when using the `execute_sql` or `cloud_sql_postgresql__execute_sql` tool.
88+
**ALWAYS** use the full table name format, `DATABASE_NAME.SCHEMA_NAME.TABLE_NAME` in the generated SQL when executing the `execute_sql` script.
8689
* Default to using "public" for the schema name.
8790
* Use command `echo $CLOUD_SQL_POSTGRES_DATABASE` to get the current database value.
8891
@@ -92,7 +95,7 @@ When working with AI features like vector embeddings in Cloud SQL, leverage the
9295
9396
Embeddings can be generated using the `embedding()` function. For example: `embedding(<model_name>, <text_column_or_variable>)`.
9497
95-
As an agent, if you do not know which model to use, you should use your tools to search for available and appropriate text embedding models compatible with the `google_ml_integration` extension (e.g., by searching for "Cloud SQL google_ml_integration supported models").
98+
As an agent, if you do not know which model to use, you should use your skills to search for available and appropriate text embedding models compatible with the `google_ml_integration` extension (e.g., by searching for "Cloud SQL google_ml_integration supported models").
9699
97100
When performing similarity searches, remember to cast the result of the `embedding` function to the `vector` type. For example:
98101
`ORDER BY description_vector <-> embedding(<model_name>, $1)::vector`

DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The core logic for this extension is handled by a pre-built `toolbox` binary. Th
4343
extension from your local directory.
4444

4545
```bash
46-
gemini extensions link .
46+
gemini extensions install .
4747
```
4848
The CLI will prompt you to confirm the installation. Accept it to proceed.
4949

README.md

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> [!NOTE]
44
> This extension is currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
55
6-
This Gemini CLI extension provides a set of tools to interact with [Cloud SQL for PostgreSQL](https://cloud.google.com/sql/docs/postgres) instances. It allows you to manage your databases, execute queries, explore schemas, and troubleshoot issues directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.
6+
This Gemini CLI extension provides a set of skills to interact with [Cloud SQL for PostgreSQL](https://cloud.google.com/sql/docs/postgres) instances. It allows you to manage your databases, execute queries, explore schemas, and troubleshoot issues directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.
77

88
Learn more about [Gemini CLI Extensions](https://github.com/google-gemini/gemini-cli/blob/main/docs/extensions/index.md).
99
> [!IMPORTANT]
@@ -57,9 +57,6 @@ You will be prompted to configure the following settings during installation. Th
5757
* `CLOUD_SQL_POSTGRES_PASSWORD`: (Optional) The password for the database user.
5858
* `CLOUD_SQL_POSTGRES_IP_TYPE`: (Optional) Type of the IP address: `PUBLIC`, `PRIVATE`, or `PSC`. Defaults to `PUBLIC`.
5959

60-
> [!NOTE]
61-
> This configuration is primarily for the Data Plane tools (querying). The Admin toolset does not strictly require these to be pre-set if you provide them in your prompts, but it is recommended for a smoother experience.
62-
6360
To view or update your configuration:
6461

6562
**List Settings:**
@@ -72,22 +69,10 @@ To view or update your configuration:
7269
* `scope`: (Optional) The scope of the setting in (`user` or `workspace`). Defaults to `user`.
7370
* Currently, you must restart the Gemini CLI for changes to take effect. We recommend using `gemini --resume` to resume your session.
7471

75-
Alternatively, you can manually set these environment variables before starting the Gemini CLI:
76-
77-
```bash
78-
export CLOUD_SQL_POSTGRES_PROJECT="<your-gcp-project-id>"
79-
export CLOUD_SQL_POSTGRES_REGION="<your-cloud-sql-region>"
80-
export CLOUD_SQL_POSTGRES_INSTANCE="<your-cloud-sql-instance-id>"
81-
export CLOUD_SQL_POSTGRES_DATABASE="<your-database-name>"
82-
export CLOUD_SQL_POSTGRES_USER="<your-database-user>" # Optional
83-
export CLOUD_SQL_POSTGRES_PASSWORD="<your-database-password>" # Optional
84-
export CLOUD_SQL_POSTGRES_IP_TYPE="PUBLIC" # Optional: `PUBLIC`, `PRIVATE`, `PSC`. Defaults to `PUBLIC`.
85-
```
86-
8772
> [!NOTE]
8873
> * Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
8974
> * If your Cloud SQL for PostgreSQL instance uses private IPs, you must run Gemini CLI in the same Virtual Private Cloud (VPC) network.
90-
> * See [Troubleshooting](#troubleshooting) for debugging your configuration.
75+
> * See [Troubleshooting](#troubleshooting) for debugging your configuration.
9176
9277
### Start Gemini CLI
9378

@@ -116,43 +101,17 @@ Interact with Cloud SQL for PostgreSQL using natural language:
116101
* **Generate Code:**
117102
* "Generate a Python dataclass to represent the 'customers' table."
118103

119-
## Supported Tools
120-
121-
* **Admin:**
122-
* `clone_instance`: Creates a clone for an existing Cloud SQL for PostgreSQL instance.
123-
* `create_backup`: Creates a backup on a Cloud SQL instance.
124-
* `create_instance`: Use this tool to create an Postgres instance.
125-
* `create_user`: Use this tool to create Postgres-BUILT-IN or IAM-based users.
126-
* `create_database`: Creates a new database in a Cloud SQL instance.
127-
* `get_instance`: Use this tool to get details about an Postgres instance.
128-
* `list_instances`: Use this tool to list instances in a given project and location.
129-
* `list_databases`: Lists all databases for a Cloud SQL instance.
130-
* `restore_backup`: Restores a backup of a Cloud SQL instance.
131-
* `wait_for_operation`: Use this tool to poll the operations API until the operation is done.
132-
133-
* **Data:**
134-
* `list_tables`: Use this tool to lists tables in the database.
135-
* `database_overview`: Use this tool to fetches the current state of the PostgreSQL server.
136-
* `execute_sql`: Use this tool to executes a SQL query.
137-
* `list_active_queries`: Use this tool to list currently running queries.
138-
* `list_available_extensions`: Use this tool to list available extensions for installation.
139-
* `list_installed_extensions`: Use this tool to list installed extensions.
140-
* `get_query_plan`: Use this tool to get query plan.
141-
* `list_autovacuum_configurations`: Use this tool to list autovacuum configurations and its value.
142-
* `list_database_stats`: Use this tool to lists the key performance and activity statistics for each database in the postgreSQL instance.
143-
* `list_indexes`: Use this tool to list available user indexes in a PostgreSQL database.
144-
* `list_memory_configurations`: Use this tool to list memory configurations and its value.
145-
* `list_pg_settings`: Use this tool to list configuration parameters for the PostgreSQL server.
146-
* `list_publication_tables`: Use this tool to list publication tables in a PostgreSQL database.
147-
* `list_replication_slots`: Use this tool to list replication slots.
148-
* `list_roles`: Use this tool to lists all the user-created roles in PostgreSQL database.
149-
* `list_schemas`: Use this tool to lists schemas in the database.
150-
* `list_sequences`: Use this tool to list sequences in a PostgreSQL database.
151-
* `list_tablespaces`: Use this tool to lists tablespaces in the database.
152-
* `list_top_bloated_tables`: Use this tool to list top bloated tables.
153-
* `list_triggers`: Use this tool to lists triggers in the database.
154-
* `list_views`: Use this tool to lists views in the database from pg_views with a default limit of 50 rows.
155-
* `list_invalid_indexes`: Use this tool to list invalid indexes.
104+
## Supported Skills
105+
106+
This extension provides the following skills:
107+
108+
* [Cloud SQL for PostgreSQL Admin](./skills/cloud-sql-postgres-admin/SKILL.md) - Use these tools when you need to provision new Cloud SQL instances, create databases and users, clone existing environments, and monitor the progress of long-running operations.
109+
* [Cloud SQL for PostgreSQL Data](./skills/cloud-sql-postgres-data/SKILL.md) - Use these tools when you need to explore the database structure, discover schema objects like views or stored procedures, and execute custom SQL queries to interact with your data.
110+
* [Cloud SQL for PostgreSQL Health](./skills/cloud-sql-postgres-health/SKILL.md) - Use these tools when you need to audit database health, identify storage bloat, find invalid indexes, analyze table statistics, and manage maintenance configurations like autovacuum.
111+
* [Cloud SQL for PostgreSQL Lifecycle](./skills/cloud-sql-postgres-lifecycle/SKILL.md) - Use these tools when you need to manage the lifecycle of your instances, including performing backups and restores, checking major version upgrade compatibility, and monitoring overall instance status.
112+
* [Cloud SQL for PostgreSQL Monitor](./skills/cloud-sql-postgres-monitor/SKILL.md) - Use these tools when you need to troubleshoot performance bottlenecks, analyze query execution plans, identify resource-heavy processes, and monitor system-level PromQL metrics.
113+
* [Cloud SQL for PostgreSQL Replication](./skills/cloud-sql-postgres-replication/SKILL.md) - Use these tools when you need to monitor replication health, manage sync states between nodes, and audit database roles and security settings to ensure environment integrity.
114+
* [Cloud SQL for PostgreSQL View Config](./skills/cloud-sql-postgres-view-config/SKILL.md) - Use these tools when you need to discover and manage PostgreSQL extensions or fine-tune engine-level settings such as memory allocation and server configuration parameters.
156115

157116
## Additional Extensions
158117

gemini-extension.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22
"name": "cloud-sql-postgresql",
33
"version": "0.2.0",
44
"description": "Create, connect, and interact with a Cloud SQL for PostgreSQL database and data.",
5-
"mcpServers": {
6-
"cloud_sql_postgresql_admin": {
7-
"command": "${extensionPath}${/}toolbox",
8-
"args": [
9-
"--prebuilt",
10-
"cloud-sql-postgres-admin",
11-
"--stdio"
12-
]
13-
},
14-
"cloud_sql_postgresql": {
15-
"command": "${extensionPath}${/}toolbox",
16-
"args": [
17-
"--prebuilt",
18-
"cloud-sql-postgres",
19-
"--stdio"
20-
]
21-
}
22-
},
235
"contextFileName": "CLOUD-SQL-POSTGRESQL.md",
246
"settings": [
257
{

0 commit comments

Comments
 (0)