← Back to Skills Marketplace
289
Downloads
1
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install pg-copilot
Description
PostgreSQL AI 助手 - 自然语言转 SQL、SQL 转自然语言、ERD、性能优化、分区管理、实时同步。一个技能搞定 PostgreSQL 所有需求。
Usage Guidance
要不要安装/使用这项技能——需要考虑的关键点:
1) 凭据存储与传输:该脚本会在 ~/.pg-copilot/config.json 中保存数据库连接信息(包括密码),并优先使用该本地配置;虽然代码包含 base64 加解密函数,但实际保存流程没有使用它,意味着密码可能以明文或可直接恢复的形式保存在磁盘上。评估是否可接受:最好只用低权限/只读账号或临时凭据测试。
2) 外部端点风险:技能会把数据发送到你配置的 LLM API URL(使用 LLM_API_KEY)和任意 webhook URL。不要把真实生产凭据或敏感数据指向不受信任的端点;仅在你信任的 LLM 服务或受控 webhook 上配置这些值。
3) 数据库修改影响:启用实时同步将创建触发器和额外表(_sync_changes、_sync_log、_sync_config 等),并可向目标库写入数据。不要在生产库直接启用这些功能,先在隔离环境或副本上验证触发器/同步逻辑和冲突处理策略。
4) 环境声明不一致:技能元数据没有列出需要的环境变量,但脚本会读取多种 env 变量。安装前审查并测试脚本,确保你理解将被读取/写入的 env 与文件位置(~/.pg-copilot)。
5) 代码审计与最小特权:如果可能,先人工审阅 scripts/pg_copilot.py 的完整代码;为数据库创建专用最小权限账户(只给必要的表/操作权限),并限制脚本运行主机的网络访问(防止意外对任意域名发出请求)。
6) 可信来源与版本:发布方/主页未知且元数据版本不一致,增加了供应链追踪难度。优先在受控环境中测试,或仅在你能接受代码在本机执行并能够回滚修改的情况下使用。
Capability Analysis
Type: OpenClaw Skill
Name: pg-copilot
Version: 1.0.3
The skill bundle provides a PostgreSQL management utility with features for remote data synchronization and SQL execution. It is classified as suspicious because it handles sensitive database credentials and stores them in a local configuration file (~/.pg-copilot/config.json) using only Base64 encoding, which is easily reversible. Furthermore, the 'dangerous operation' filter in scripts/pg_copilot.py is rudimentary and can be bypassed with simple SQL formatting tricks, and the inclusion of remote synchronization and webhook notification capabilities (send_alert) provides a significant surface for data exfiltration if the AI agent is subverted.
Capability Assessment
Purpose & Capability
技能声明并实现了 PostgreSQL 查询生成/解释、ERD、EXPLAIN 分析、分区管理及实时同步到 MySQL/PG 的功能;_meta.json 中声明的依赖(psycopg2-binary, pymysql)与代码使用一致。小不一致:注册表元数据显示版本 1.0.3,而 _meta.json 中为 1.3.0;来源/主页未知(无主页),这降低了可追溯性,但功能本身与名称/描述相符。
Instruction Scope
SKILL.md 与脚本指示会在用户主目录下创建 ~/.pg-copilot/config.json 并写入数据库连接信息(包括密码),可以初始化同步表、创建触发器并记录变更、向外部 webhook 发送告警、以及向任意配置的 LLM API 端点提交请求。指令允许接受目标数据库凭据与 webhook URL,意味着在启用“实时同步”或运行脚本时会读取/传输敏感数据——这是实现同步所需,但扩展了技能的风险面,应谨慎对待。
Install Mechanism
技能是 instruction-only(无 install spec),但包含脚本依赖 psycopg2 和 pymysql(在 _meta.json 的 requires 列出)。没有自动安装步骤意味着运行前需手动安装依赖;这不是自动化安装风险,但会导致运行时失败(或用户自行在主机上安装包)。
Credentials
注册信息声明“无需环境变量”,但脚本会读取多个 env 变量 if config absent:PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE、LLM_API_URL, LLM_API_KEY, LLM_MODEL 等。与声明不一致。脚本还会将数据库密码写入本地配置文件(configure_database 将密码以原文保存),并提供基于 Base64 的 encrypt/decrypt 函数 — meta/README 提到“Base64 加密存储”,但实际保存流程并未使用加密函数,存在误导和凭据以可逆/明文形式持久化的风险。技能也会向任意 webhook 或 api_url 发起请求(send_alert, call_llm),这可用于必要的告警/LLM 调用,但同样使得敏感数据在配置或同步时暴露给外部端点。
Persistence & Privilege
技能不会被强制常驻(always:false),但在运行时会在用户家目录写入 ~/.pg-copilot/config.json 并在数据库中创建同步表/触发器并写入 _sync_log、_sync_changes 等表——这些操作需要对数据库有创建表/触发器和写入的权限,这是该功能所需但具有长期影响(会修改数据库 schema/数据、保留变更记录)。技能不会修改其它技能的配置。
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install pg-copilot - After installation, invoke the skill by name or use
/pg-copilot - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
pg-copilot 1.0.3
- 修正同步命令说明,sync-add 示例中 `<port>` 参数置于正确位置,避免用户配置错误
- 文档示例一致性提升,MySQL/PostgreSQL 示例端口参数保持格式统一
- 其他内容未变,核心功能与前置条件无变动
v1.0.1
pg-copilot 1.0.0
- Initial release with full-featured PostgreSQL AI assistant.
- Supports natural language to SQL, SQL to natural language, ERD generation, query optimization, partition management, and real-time sync.
- Provides comprehensive CLI commands for database operations and synchronization.
- Includes production-ready features: password encryption, retry logic, webhook notifications, and batch sync.
- Multi-database connection and automatic schema management.
v1.0.0
PostgreSQL AI Assistant
Natural language to SQL
SQL to natural language
ERD diagram generation
Performance optimization
Partition management
Real-time synchronization (MySQL supported)
Data validation
Conflict resolution
Metadata
Frequently Asked Questions
What is pg-copilot?
PostgreSQL AI 助手 - 自然语言转 SQL、SQL 转自然语言、ERD、性能优化、分区管理、实时同步。一个技能搞定 PostgreSQL 所有需求。 It is an AI Agent Skill for Claude Code / OpenClaw, with 289 downloads so far.
How do I install pg-copilot?
Run "/install pg-copilot" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is pg-copilot free?
Yes, pg-copilot is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does pg-copilot support?
pg-copilot is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created pg-copilot?
It is built and maintained by jiabusit (@jiabusit); the current version is v1.0.3.
More Skills