Token导航 LogoToken导航

Agent Skill · 研究检索

postgres(Postgres 数据库)

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

postgres 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 42,382。

总安装 1,080周安装 45GitHub Stars 1下载 360核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:postgres(Postgres 数据库)
来源仓库:https://github.com/alemar11/skills
仓库路径:skills/postgres
安装命令:
npx skills add https://github.com/alemar11/skills --skill postgres
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alemar11/skills --skill postgres

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

postgres 连接 PostgreSQL 数据库执行 SQL 查询与 schema 分析。支持索引优化、查询性能审查与迁移流程管理。必须通过 shipped scripts/postgres 脚本调用,确保环境隔离。涉及数据变更时应优先 dry-run 或事务保护,防止丢失数据。

postgres 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/postgres

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/alemar11/skills --skill postgres;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

postgres 怎么安装?

在终端执行 npx skills add https://github.com/alemar11/skills --skill postgres。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

postgres 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

postgres 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

postgres 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

postgres 用的人多吗?

公开数据是累计安装 1,080 次,近一周安装 45 次,下载 360 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

postgres 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
postgres

Postgres 数据库 · 本页

1,0801接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Postgres

Goal

Use this skill to connect to Postgres, run SQL, inspect schemas, review query performance, design tables and indexes, work with common PostGIS or pgvector patterns, and manage migration release flow through the shipped scripts/postgres artifact in the skill package.

Runtime surface

  • The only supported runtime entrypoint is the shipped scripts/postgres artifact inside this skill package.
  • If your current working directory is the skill root, run it as ./scripts/postgres.
  • If you are invoking the skill from another repo, resolve the skill package path first and run <postgres-skill-root>/scripts/postgres.
  • <postgres-skill-root>/scripts/postgres --version is the runtime version check.
  • Do not use or reintroduce per-task helper scripts from the pre-Rust runtime surface.
  • The implementation lives in projects/postgres/ and is maintenance-only. Normal usage stays on the scripts/postgres surface.
  • Canonical persisted config lives at <project-root>/.skills/postgres/config.toml.
  • This runtime skill does not provide dump, restore, export, or schema-diff workflows. Keep those operator tasks outside this skill.

Fast path

  • Resolve the shipped CLI once and reuse it in commands below:

- POSTGRES_CLI=/path/to/postgres-skill/scripts/postgres

  • Doctor / setup status:

- DB_PROJECT_ROOT=/path/to/repo "$POSTGRES_CLI" --json doctor

  • Bootstrap and save a profile:

- DB_PROJECT_ROOT=/path/to/repo "$POSTGRES_CLI" profile bootstrap --save

  • Resolve the active connection:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" --json profile resolve

  • Run ad-hoc SQL:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" query run -c "select now();"

  • Run a SQL file:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" query run -f./query.sql

  • Safe heredoc for multi-statement SQL / DO $$:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" query run <<'SQL' - select now(); - SQL

  • Connection test:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" profile test

  • Schema introspection:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" schema inspect

  • Object search:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" query find users --types table,column

  • Release a pending migration file:

- DB_PROJECT_ROOT=/path/to/repo DB_PROFILE=local "$POSTGRES_CLI" migration release --summary "Add agent-context prompt sections"

Workflow

  1. Confirm connection source:

- If DB_URL is provided, use it for a one-off connection unless the user explicitly asks to persist it. - Prefer DB_* environment variables. Compatibility inputs such as DATABASE_URL, POSTGRES_URL, POSTGRESQL_URL, and libpq vars (PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD, PGSSLMODE) are also accepted. - PROJECT_ROOT remains unsupported; use DB_PROJECT_ROOT. - If <project-root>/.skills/postgres/config.toml exists, use it. - Else if legacy <project-root>/.skills/postgres/postgres.toml exists, runtime migrates it one-way into canonical config.toml and continues on the canonical path. - During that migration, make sure the consuming repo ignores .skills/postgres/config.toml too; do not leave the canonical file unignored when the legacy postgres.toml had ignore coverage. - If the user explicitly asks to create or refresh a saved profile, use the shipped scripts/postgres artifact from the skill package, for example <postgres-skill-root>/scripts/postgres profile bootstrap.

  1. Choose action:

- Query or inspect data - Inspect schema, indexes, roles, or activity - Review query shape or schema design - Draft or release migrations - Search official PostgreSQL docs only when explicitly requested

  1. Execute and report:

- Return the answer first, then only the supporting context needed to trust it. - Keep backup, restore, export, and schema-diff requests out of this skill's runtime surface.

  1. Persist only if asked:

- Update config.toml only with explicit user approval, except canonical config migration plus explicit profile bootstrap or set-ssl flows. - Treat <project-root>/.skills/postgres/config.toml as local persisted operator config; consuming repos should gitignore it just as they previously gitignored legacy postgres.toml.

Command map

  • doctor

- Validate config resolution and report runtime readiness without mutating config.

  • profile resolve

- Show the active URL, profile, and source.

  • profile bootstrap [--save]

- Interactively create or print a profile.

  • profile test

- Quick connection check.

  • profile info

- Print connection details and key server settings.

  • profile version

- Show server version.

  • profile migrate-toml

- Migrate legacy postgres.toml into canonical config.toml using schema 2.0.0, and ensure ignore coverage follows the canonical file.

  • profile set-ssl <profile> <true|false>

- Persist sslmode for a saved profile.

  • query run

- Execute SQL from -c, -f, or stdin, preserving per-statement results.

  • query explain

- Run EXPLAIN, defaulting to ANALYZE.

  • query find <pattern> [--types...]

- Search schemas, tables, columns, views, and functions by name.

  • activity overview|locks|slow|long-running|cancel|terminate|cancel-pid|terminate-pid|pg-stat-top

- Runtime diagnostics and query-control operations.

  • schema inspect|table-sizes|index-health|missing-fk-indexes|vacuum-status|roles

- Schema and catalog inspection.

  • migration release

- Move a pending migration into released/ and update CHANGELOG.md.

  • docs search

- Search official PostgreSQL current docs.

Config shape

Canonical persisted config uses owner-level config.toml:

schema_version = "2.0.0"

[defaults]
profile = "local"

[tools.postgres]
sslmode = false
migrations_path = "db/migrations"

[tools.postgres.profiles.local]
description = "Local development DB"
host = "127.0.0.1"
port = 5432
database = "app"
user = "postgres"
password = "postgres"
sslmode = false
migrations_path = "db/migrations"

Rules:

  • schema_version is top-level and required in canonical saved configs.
  • Do not add or rely on [meta].
  • Canonical config.toml is local persisted operator config, not normal repo content; consuming repos should gitignore .skills/postgres/config.toml.
  • When migrating from legacy postgres.toml, update ignore rules in the same rollout so the canonical file stays untracked too.
  • [defaults] stores the default saved profile.
  • [tools.postgres] stores shared Postgres defaults.
  • [tools.postgres.profiles.<name>] stores per-profile overrides.

Schema and feature design

  • For schema or table design, start with:

- references/postgres_best_practices/schema-design.md - references/postgres_best_practices/advanced-features.md

  • For geospatial tables, SRIDs, radius search, nearest-neighbor lookups, or spatial indexing, use references/postgres_best_practices/postgis.md.
  • For embeddings, semantic search, similarity search, vector indexes, or retrieval/RAG in Postgres, use references/postgres_best_practices/pgvector.md.

Backend query performance review

  • Inventory read queries separately from write queries before recommending changes.
  • Unless the user explicitly includes writes, optimize only read-side paths.
  • Prioritize:

- N+1 query patterns - repeated correlated subqueries - dynamic IN (...) SQL that should become parameterized arrays - missing composite indexes matching real join and filter predicates

  • Validate with schema and catalog inspection first (schema inspect, schema table-sizes, schema index-health, activity slow) before asking for live benchmarking.

SQL safety

  • Prefer query run with heredoc or -f for multi-statement SQL.
  • Do not inline DO $$... $$ into double-quoted shell strings.

Data-copy migrations

  • When copying selected rows from dev or local into a production SQL file:

- inspect source values and target table shape first - treat copied values as a draft for production - do not preserve generated primary-key values by default - prefer INSERT... RETURNING and stable business keys when dependent rows need new IDs

  • Keep DDL reasoning separate from requested data-copy SQL.

Trigger rules

  • If .skills/postgres/config.toml exists, use it without scanning unless the user asks to bootstrap or refresh.
  • Else if only legacy .skills/postgres/postgres.toml exists, use it as migration input to generate canonical config.toml, and make sure ignore coverage follows the canonical path too.
  • If DB_PROFILE is unset and exactly one profile exists, use it.
  • If multiple profiles exist, prefer the saved [defaults].profile when present; otherwise require an explicit profile or interactive selection.
  • If the user asks to bootstrap or refresh a saved profile, use profile bootstrap.
  • Do not run docs search unless the user explicitly asks for official docs lookup or verification.
  • For migrations path resolution and schema-change workflow, follow references/postgres_guardrails.md.
  • If a pending migration file contains its own BEGIN or COMMIT, do not wrap it in an outer rollback transaction during scratch validation.
  • If the user explicitly marks a pending migration as migrated, released, or run in production, perform migration release immediately unless they ask for a dry run only.
  • Do not use this runtime skill to refresh best-practices references or otherwise upgrade the skill package itself.

Guardrails

  • Always ask for approval before making DDL changes.
  • Keep pending changes in prerelease migration files and maintain a changelog.
  • Use pending migration file and released migration file as the canonical workflow terms.
  • Do not edit existing released SQL files.
  • Do not create a new file under released/ for pending work.
  • Only create a released migration file by moving a pending prerelease file when the user explicitly confirms release.
  • After any schema change, run the least expensive validation query that proves the change landed.
  • For full rules and migration workflow, read references/postgres_guardrails.md.

CLI Maintenance

  • Keep normal execution on the shipped scripts/postgres artifact.
  • Treat projects/postgres/Cargo.toml as the single source of truth for the CLI semver, and use the shipped scripts/postgres --version to verify the runtime version.
  • Open projects/postgres/ only when fixing bugs, improving performance, rebuilding the shipped binary, or extending the CLI contract.
  • Make maintenance changes in projects/postgres/, then rebuild scripts/postgres so the shipped artifact stays current.
  • Treat compiled outputs in projects/postgres/target/ as intermediates, not supported runtime entrypoints.
  • Keep project-local ignore rules in projects/postgres/.gitignore. Only add a skill-root .gitignore if new generated state truly lives at the skill root.
  • Follow semver for shipped CLI changes:

- major for breaking CLI contract changes - minor for backward-compatible new features or meaningful capability additions - patch for backward-compatible bug fixes and corrections

  • After maintenance changes, re-verify through the shipped artifact with:

- from the skill root: ./scripts/postgres --help - from the skill root: ./scripts/postgres --version - from any cwd: DB_PROJECT_ROOT=/path/to/repo <postgres-skill-root>/scripts/postgres --json doctor

  • Keep config migration one-way from legacy postgres.toml to canonical config.toml.
  • Keep the runtime surface focused on query, inspection, and migration release. Do not reintroduce dump, restore, export, or schema-diff commands.

Usage references

  • Setup and runtime usage: references/postgres_usage.md
  • Env var contract: references/postgres_env.md
  • Config schema: references/postgres_skill_schema.md
  • Migration guardrails: references/postgres_guardrails.md
  • Design guidance: references/postgres_best_practices/README.md
  • Local/Docker recovery: references/postgres_local_recovery.md

平台分布

Codex

36.85%
按下载量换算133

Claude

32.5%
按下载量换算117

Cursor

17.58%
按下载量换算63

Gemini CLI

8.89%
按下载量换算32

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills