Skip to content

Commit 3c32748

Browse files
committed
update readme
1 parent e44f6b2 commit 3c32748

1 file changed

Lines changed: 98 additions & 72 deletions

File tree

README.md

Lines changed: 98 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,158 @@
1-
# Gemini CLI Extension - Cloud SQL for PostgreSQL
1+
# Cloud SQL for PostgreSQL Agent Skills
22

33
> [!NOTE]
4-
> This extension is currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
4+
> These skills are 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 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.
6+
This repository provides a set of agent skills to interact with [Cloud SQL for PostgreSQL](https://cloud.google.com/sql/docs/postgres) instances. These skills can be used with various AI agents, including [Gemini CLI](https://google-gemini.github.io/gemini-cli/), Claude Code, and Codex, to manage your databases, execute queries, explore schemas, and troubleshoot issues using natural language prompts.
77

8-
Learn more about [Gemini CLI Extensions](https://github.com/google-gemini/gemini-cli/blob/main/docs/extensions/index.md).
98
> [!IMPORTANT]
109
> **We Want Your Feedback!**
11-
> Please share your thoughts with us by filling out our feedback [form][form].
10+
> Please share your thoughts with us by filling out our feedback [form][form].
1211
> Your input is invaluable and helps us improve the project for everyone.
1312
1413
[form]: https://docs.google.com/forms/d/e/1FAIpQLSfEGmLR46iipyNTgwTmIDJqzkAwDPXxbocpXpUbHXydiN1RTw/viewform?usp=pp_url&entry.157487=cloud-sql-postgresql
1514

16-
## Why Use the Cloud SQL for PostgreSQL Extension?
17-
18-
* **Seamless Workflow:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment. No need to constantly switch contexts for common database tasks.
19-
* **Natural Language Queries:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
20-
* **Full Lifecycle Control:** Manage the entire lifecycle of your database, from creating instances to exploring schemas and running queries.
21-
* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas.
15+
## Why Use Cloud SQL for PostgreSQL Agent Skills?
2216

17+
- **Seamless Workflow:** Integrates seamlessly into your AI agent's environment. No need to constantly switch contexts for common database tasks.
18+
- **Natural Language Queries:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
19+
- **Full Lifecycle Control:** Manage the entire lifecycle of your database, from creating instances to exploring schemas and running queries.
20+
- **Code Generation:** Accelerate development by asking your agent to generate data classes and other code snippets based on your table schemas.
2321

2422
## Prerequisites
2523

2624
Before you begin, ensure you have the following:
2725

28-
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed with version **+v0.6.0**.
29-
* Setup Gemini CLI [Authentication](https://github.com/google-gemini/gemini-cli/tree/main?tab=readme-ov-file#-authentication-options).
30-
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
31-
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
32-
* IAM Permissions:
33-
* Cloud SQL Client (`roles/cloudsql.client`)
34-
* Cloud SQL Admin (`roles/cloudsql.admin`)
26+
- An AI agent installed (e.g., [Gemini CLI](https://github.com/google-gemini/gemini-cli) version **+v0.6.0**, [Claude Code](https://claude.ai/install.sh), or [Codex](https://openai.com/blog/openai-codex/)).
27+
- A Google Cloud project with the **Cloud SQL Admin API** enabled.
28+
- Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
29+
- IAM Permissions:
30+
- Cloud SQL Client (`roles/cloudsql.client`)
31+
- Cloud SQL Admin (`roles/cloudsql.admin`)
32+
3533
> [!NOTE]
36-
> If you do not configure a specific `CLOUD_SQL_POSTGRES_USER` or `CLOUD_SQL_POSTGRES_PASSWORD`, this extension defaults to using the active local IAM user credentials. You must also add the IAM user to your Cloud SQL instance, see [Creating a database user](https://cloud.google.com/sql/docs/postgres/add-manage-iam-users#creating-a-database-user).
34+
> If you do not configure a specific `CLOUD_SQL_POSTGRES_USER` or `CLOUD_SQL_POSTGRES_PASSWORD`, these skills default to using the active local IAM user credentials. You must also add the IAM user to your Cloud SQL instance, see [Creating a database user](https://cloud.google.com/sql/docs/postgres/add-manage-iam-users#creating-a-database-user).
3735
3836
## Getting Started
3937

4038
### Installation
4139

42-
To install the extension, use the command:
40+
To install these skills as a plugin for your preferred AI agent:
41+
42+
**Gemini CLI:**
4343

4444
```bash
4545
gemini extensions install https://github.com/gemini-cli-extensions/cloud-sql-postgresql
4646
```
4747

48-
### Configuration
48+
To view or update your configuration in Gemini CLI:
4949

50-
You will be prompted to configure the following settings during installation. These settings are saved in an `.env` file within the extension's directory.
50+
- Terminal: `gemini extensions config cloud-sql-postgresql [setting name] [--scope <scope>]`
51+
- Gemini CLI: `/extensions list`
5152

52-
* `CLOUD_SQL_POSTGRES_PROJECT`: The GCP project ID.
53-
* `CLOUD_SQL_POSTGRES_REGION`: The region of your Cloud SQL instance.
54-
* `CLOUD_SQL_POSTGRES_INSTANCE`: The ID of your Cloud SQL instance.
55-
* `CLOUD_SQL_POSTGRES_DATABASE`: The name of the database to connect to.
56-
* `CLOUD_SQL_POSTGRES_USER`: (Optional) The database username. Defaults to the active IAM user.
57-
* `CLOUD_SQL_POSTGRES_PASSWORD`: (Optional) The password for the database user.
58-
* `CLOUD_SQL_POSTGRES_IP_TYPE`: (Optional) Type of the IP address: `PUBLIC`, `PRIVATE`, or `PSC`. Defaults to `PUBLIC`.
53+
**Claude Code:**
5954

60-
To view or update your configuration:
55+
```bash
56+
claude plugin add https://github.com/gemini-cli-extensions/cloud-sql-postgresql
57+
```
6158

62-
**List Settings:**
63-
* Terminal: `gemini extensions list`
64-
* Gemini CLI: `/extensions list`
59+
**Codex:**
6560

66-
**Update Settings:**
67-
* Terminal: `gemini extensions config cloud-sql-postgresql [setting name] [--scope <scope>]`
68-
* `setting name`: (Optional) The single setting to configure.
69-
* `scope`: (Optional) The scope of the setting in (`user` or `workspace`). Defaults to `user`.
70-
* Currently, you must restart the Gemini CLI for changes to take effect. We recommend using `gemini --resume` to resume your session.
61+
```bash
62+
codex plugin add https://github.com/gemini-cli-extensions/cloud-sql-postgresql
63+
```
64+
65+
### Configuration
66+
67+
You may be prompted to configure the following settings during installation. These settings can also be set as environment variables.
68+
69+
- `CLOUD_SQL_POSTGRES_PROJECT`: The GCP project ID.
70+
- `CLOUD_SQL_POSTGRES_REGION`: The region of your Cloud SQL instance.
71+
- `CLOUD_SQL_POSTGRES_INSTANCE`: The ID of your Cloud SQL instance.
72+
- `CLOUD_SQL_POSTGRES_DATABASE`: The name of the database to connect to.
73+
- `CLOUD_SQL_POSTGRES_USER`: (Optional) The database username. Defaults to the active IAM user.
74+
- `CLOUD_SQL_POSTGRES_PASSWORD`: (Optional) The password for the database user.
75+
- `CLOUD_SQL_POSTGRES_IP_TYPE`: (Optional) Type of the IP address: `PUBLIC`, `PRIVATE`, or `PSC`. Defaults to `PUBLIC`.
7176

7277
> [!NOTE]
73-
> * Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
74-
> * If your Cloud SQL for PostgreSQL instance uses private IPs, you must run Gemini CLI in the same Virtual Private Cloud (VPC) network.
75-
> * See [Troubleshooting](#troubleshooting) for debugging your configuration.
78+
>
79+
> - Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
80+
> - If your Cloud SQL for PostgreSQL instance uses private IPs, you must run your agent in the same Virtual Private Cloud (VPC) network.
81+
82+
### Usage
7683

77-
### Start Gemini CLI
84+
To start interacting with your database, launch your preferred AI agent and use natural language to ask questions or perform tasks.
7885

79-
To start the Gemini CLI, use the following command:
86+
**Gemini CLI:**
8087

8188
```bash
8289
gemini
8390
```
8491

92+
_(Tip: Run `/extensions list` to verify your configuration and active extensions.)_
93+
94+
**Claude Code:**
95+
96+
```bash
97+
claude
98+
```
99+
100+
_(Tip: Run `/plugin list` inside Claude Code to verify the plugin is active, or `/reload-plugins` if you just installed it.)_
101+
102+
**Codex:**
103+
104+
```bash
105+
codex
106+
```
107+
108+
_(Tip: Run `codex plugin list` or use the `/plugins` interactive menu to verify your installed plugins.)_
109+
85110
> [!WARNING]
86111
> **Changing Instance & Database Connections**
87-
> Currently, the database connection must be configured before starting the Gemini CLI and can not be changed during a session.
88-
> To save and resume conversation history use command: `/chat save <tag>` and `/chat resume <tag>`.
112+
> Currently, the database connection must be configured before starting the agent and can not be changed during a session.
113+
> To save and resume conversation history in Gemini CLI use command: `/chat save <tag>` and `/chat resume <tag>`.
89114
90115
## Usage Examples
91116

92117
Interact with Cloud SQL for PostgreSQL using natural language:
93118

94-
* **Provision Infrastructure:**
95-
* "Create a new CLoud SQL for Postgres instance named 'e-commerce-prod' in the 'my-gcp-project' project."
96-
* "Create a new user named 'analyst' with read access to all tables."
97-
* **Explore Schemas and Data:**
98-
* "Show me all tables in the 'orders' database."
99-
* "What are the columns in the 'products' table?"
100-
* "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
101-
* **Generate Code:**
102-
* "Generate a Python dataclass to represent the 'customers' table."
119+
- **Provision Infrastructure:**
120+
- "Create a new Cloud SQL for Postgres instance named 'e-commerce-prod' in the 'my-gcp-project' project."
121+
- "Create a new user named 'analyst' with read access to all tables."
122+
- **Explore Schemas and Data:**
123+
- "Show me all tables in the 'orders' database."
124+
- "What are the columns in the 'products' table?"
125+
- "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
126+
- **Generate Code:**
127+
- "Generate a Python dataclass to represent the 'customers' table."
103128

104129
## Supported Skills
105130

106-
This extension provides the following skills:
131+
The following skills are available in this repository:
132+
133+
- [Cloud SQL for PostgreSQL Admin](./skills/cloud-sql-postgres-admin/SKILL.md) - Use these skills when you need to provision new Cloud SQL instances, create databases and users, clone existing environments, and monitor the progress of long-running operations.
134+
- [Cloud SQL for PostgreSQL Data](./skills/cloud-sql-postgres-data/SKILL.md) - Use these skills 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.
135+
- [Cloud SQL for PostgreSQL Health](./skills/cloud-sql-postgres-health/SKILL.md) - Use these skills when you need to audit database health, identify storage bloat, find invalid indexes, analyze table statistics, and manage maintenance configurations like autovacuum.
136+
- [Cloud SQL for PostgreSQL Lifecycle](./skills/cloud-sql-postgres-lifecycle/SKILL.md) - Use these skills 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.
137+
- [Cloud SQL for PostgreSQL Monitor](./skills/cloud-sql-postgres-monitor/SKILL.md) - Use these skills when you need to troubleshoot performance bottlenecks, analyze query execution plans, identify resource-heavy processes, and monitor system-level PromQL metrics.
138+
- [Cloud SQL for PostgreSQL Replication](./skills/cloud-sql-postgres-replication/SKILL.md) - Use these skills when you need to monitor replication health, manage sync states between nodes, and audit database roles and security settings to ensure environment integrity.
139+
- [Cloud SQL for PostgreSQL View Config](./skills/cloud-sql-postgres-view-config/SKILL.md) - Use these skills when you need to discover and manage PostgreSQL extensions or fine-tune engine-level settings such as memory allocation and server configuration parameters.
107140

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.
141+
## Additional Agent Skills
115142

116-
## Additional Extensions
143+
Find additional skills to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions), including:
117144

118-
Find additional extensions to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions), including:
119-
* [Generic PostgreSQL extension](https://github.com/gemini-cli-extensions/postgres)
120-
* [Cloud SQL for PostgreSQL Observability extension](https://github.com/gemini-cli-extensions/cloud-sql-postgresql-observability)
121-
* and more!
145+
- [Generic PostgreSQL skills](https://github.com/gemini-cli-extensions/postgres)
146+
- [Cloud SQL for PostgreSQL Observability skills](https://github.com/gemini-cli-extensions/cloud-sql-postgresql-observability)
147+
- and more!
122148

123149
## Troubleshooting
124150

125-
Use `gemini --debug` to enable debugging.
151+
Use the debug mode of your agent (e.g., `gemini --debug`) to enable debugging.
126152

127153
Common issues:
128154

129-
* "failed to find default credentials: google: could not find default credentials.": Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information.
130-
* "✖ Error during discovery for server: MCP error -32000: Connection closed": The database connection has not been established. Ensure your configuration is set via environment variables.
131-
* "✖ MCP ERROR: Error: spawn /Users/USER/.gemini/extensions/cloud-sql-postgresql/toolbox ENOENT": The Toolbox binary did not download correctly. Ensure you are using Gemini CLI v0.6.0+.
132-
* "cannot execute binary file": The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information.
155+
- "failed to find default credentials: google: could not find default credentials.": Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information.
156+
- "✖ Error during discovery for server: MCP error -32000: Connection closed": The database connection has not been established. Ensure your configuration is set via environment variables.
157+
- "✖ MCP ERROR: Error: spawn .../toolbox ENOENT": The Toolbox binary did not download correctly. Ensure you are using the latest version of your agent.
158+
- "cannot execute binary file": The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information.

0 commit comments

Comments
 (0)