Preface¶
In business development, inspecting schemas, running a single UPDATE, or comparing data between the test and production databases often requires switching to a desktop client or hand-assembling a psql connection string. Storing connection details in the project’s .env or scripts risks leaking passwords during commits. If you want a coding Agent to perform queries and limited write operations on your behalf, you also need a layer of safeguards: no real commits by default, separate confirmation for production, and a second gate for dangerous DDL.
Below we introduce the Postgres Connection Assistant on SkillHub (@user_2ea0925b/postgresql). It encapsulates the capability of “connecting to PostgreSQL directly via CLI” as an Agent Skill, and stipulates that credentials live only in the user directory, while write operations default to dry-run.
What This Is¶
The Postgres Connection Assistant is a toolset that connects to PostgreSQL directly via CLI, targeting everyday database operations such as CRUD, inspecting table schemas, listing tables, and executing DDL.
- Coordinates:
@user_2ea0925b/postgresql - Version: 1.0.0
- Source: community (SkillHub category
dev-programming) - Publisher: user_2ea0925b
Official page: SkillHub - Postgres Connection Assistant. The Skill metadata API endpoint is https://api.skillhub.cn/user_2ea0925b/postgresql (referenced on the page side).
The Skill’s tags on SkillHub include requires_api_key=true, indicating that installing or using SkillHub-related capabilities may require configuring an API Key; specific fields are subject to SkillHub and the Skill documentation.
Core Features¶
The following capabilities are drawn from the official introduction; any subcommands or parameters not explicitly listed are not fabricated here.
- Data read/write: Query, modify, and delete PostgreSQL data; supports write operations such as
UPDATE/INSERT/DELETE. - Metadata and schema: View table schemas, indexes, and foreign keys; list tables in a database.
- DDL: Execute DDL (including statement types that require extra caution).
- Multi-environment connections: Switch database connections across test, staging, production, etc. (credentials are managed via a local config file, not within the repository).
- Execution troubleshooting: Suitable for troubleshooting execution issues related to
pg_query/pg_execute. - Security defaults:
- All write operations are dry-run by default; you must explicitly add--confirmfor a real commit.
- For production, in addition to--confirm,--confirm-prodis also required.
- Dangerous SQL (such asDROP/TRUNCATE) requires a second confirmation (consistent with the usage scenarios described in the introduction).
The credentials path is fixed to:
~/.codebuddy/postgres-cli/credentials.json
Official requirement: Do not create files containing passwords inside the project repository.
Installation and Enablement¶
The Skill follows the common SKILL.md format and will only be recognized after being installed via SkillHub into the current Agent’s skills directory.
1. Install the SkillHub CLI (if not already installed)¶
First check whether skillhub is present:
command -v skillhub && skillhub --version
If it’s not installed, follow SkillHub’s official installation documentation to perform a full installation (CLI + default Skill):
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
If you only need the CLI:
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only
See: SkillHub installation and priority source configuration.
2. Install this Skill¶
The method provided on the official page is to have the Agent install the coordinate @user_2ea0925b/postgresql according to the installation documentation. The command-line equivalent is (--dir must point to the current Agent’s skills directory):
skillhub install @user_2ea0925b/postgresql --dir <skills directory>
Common Agent skills paths (excerpted from SkillHub installation docs):
| Agent | skills directory |
|---|---|
| Cursor | ~/.cursor/skills/ |
| Claude Code | ~/.claude/skills/ |
| Codex | ~/.codex/skills/ or .agents/skills/ under the project |
If installed to the wrong directory (such as the default ./skills/), the Agent may fail to load it; adjust per the documentation and restart or reload.
3. Configure database credentials¶
Create ~/.codebuddy/postgres-cli/credentials.json in the user directory and write connection information for each environment. The JSON field names inside are defined by the SKILL.md within the Skill package; this article will not fabricate example passwords or field structures.
After configuration, state the target environment (test / staging / production) and the intended operation in the conversation, and the Agent will invoke the CLI per the Skill conventions.
Typical Usage (Conversation Side)¶
The official introduction summarizes natural-language scenarios that trigger this Skill; reproducible usage patterns are as follows.
- Read-only troubleshooting: “List all tables in a database,” “View indexes and foreign keys of a table,” “Run a SELECT to verify data.”
- Controlled writes: “Execute UPDATE / INSERT / DELETE” — first accept the dry-run result, then request a commit with
--confirmafter confirming correctness. - Production changes: For write operations in production, in addition to
--confirm, explicitly include--confirm-prod(executed by the Agent per Skill conventions). - DDL and high-risk statements: When involving
DROP,TRUNCATE, etc., complete the second confirmation as required by the Skill before execution. - Environment switching: “Switch to the staging DB connection” — depends on the environment configuration in
credentials.json, not by adding new connection files to the repository.
Specific CLI subcommands and parameters are subject to the Skill documentation after installation; write operations always follow: no commit by default; only persist after explicit confirmation.
Use Cases and Notes¶
Who it’s for
- Already using tools that support Skills (such as Cursor, Claude Code, Codex) and want the Agent to run PostgreSQL queries and limited writes.
- Need to distinguish test / staging / production and are willing to centralize connection info in
~/.codebuddy/postgres-cli/credentials.json. - Want write operations to preview by default (dry-run), with an extra confirmation layer for production and dangerous SQL.
Limitations and notes
- Credentials must not enter the Git repository; teams should uniformly use local or secret management rather than committing
credentials.jsonto the project. - SkillHub page statistics (as of crawl): rating 100000, downloads 940, category dev-programming; install counts etc. are subject to SkillHub’s real-time display.
- Tag
requires_api_key=true: Using SkillHub search or install may require an API Key, which is a separate layer from the database password. - For in-package CLI help and credentials field examples not covered here, refer to the documentation inside the installed
@user_2ea0925b/postgresql.
Closing¶
The Postgres Connection Assistant consolidates PostgreSQL CLI operations into an Agent Skill: listing tables, modifying data, viewing schemas, running DDL, with dry-run by default and extra confirmation for production and dangerous statements, and credentials fixed in the user directory. If you’re looking for a database-related dev-programming Skill on SkillHub, you can install @user_2ea0925b/postgresql from the official page:
https://www.skillhub.cn/skills/user_2ea0925b/postgresql