Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add chaterm/terminal-skills --skill postgresqlgit clone --depth 1 https://github.com/chaterm/terminal-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/chaterm/terminal-skills/postgresql)<a href="https://agentmods.dev/skills/chaterm/terminal-skills/postgresql"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/postgresql/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/postgresql"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/postgresql.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00009 | $0.01601 |
| Opus 5.5 | $0.00004 | $0.00640 |
| Sonnet 5.5 | $0.00002 | $0.00320 |
| Haiku 4.5 | $0.00001 | $0.00160 |
Grade A, and why
postgresql scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 240 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PostgreSQL 数据库管理
概述
PostgreSQL 数据库管理、扩展使用、查询优化等技能。
连接管理
# 本地连接
psql -U postgres
psql -U username -d database
# 远程连接
psql -h hostname -p 5432 -U username -d database
# 执行 SQL 文件
psql -U username -d database -f script.sql
# 执行单条命令
psql -U username -d database -c "SELECT version();"
psql 常用命令
\l -- 列出数据库
\c dbname -- 切换数据库
\dt -- 列出表
\d tablename -- 表结构
\du -- 列出用户
\dn -- 列出 schema
\df -- 列出函数
\di -- 列出索引
\q -- 退出
\? -- 帮助
\timing -- 显示执行时间
\x -- 扩展显示模式
用户与权限
-- 创建用户
CREATE USER username WITH PASSWORD 'password';
CREATE ROLE username WITH LOGIN PASSWORD 'password';
-- 创建超级用户
CREATE USER admin WITH SUPERUSER PASSWORD 'password';
-- 授权
GRANT ALL PRIVILEGES ON DATABASE dbname TO username;
GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO username;
GRANT USAGE ON SCHEMA schema_name TO username;
-- 设置默认权限
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO readonly_user;
-- 查看权限
\du username
SELECT * FROM information_schema.role_table_grants WHERE grantee = 'username';
-- 修改密码
ALTER USER username WITH PASSWORD 'newpassword';
数据库操作
-- 创建数据库
CREATE DATABASE dbname;
CREATE DATABASE dbname OWNER username ENCODING 'UTF8';
-- 删除数据库
DROP DATABASE dbname;
-- 查看数据库大小
SELECT pg_database.datname, pg_size_pretty(pg_database_size(pg_database.datname))
FROM pg_database ORDER BY pg_database_size(pg_database.datname) DESC;
-- 查看表大小
SELECT relname, pg_size_pretty(pg_total_relation_size(relid))
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
备份与恢复
pg_dump
# 备份单个数据库
pg_dump -U username dbname > backup.sql
pg_dump -U username -Fc dbname > backup.dump # 自定义格式
# 备份所有数据库
pg_dumpall -U postgres > all_backup.sql
# 只备份结构
pg_dump -U username --schema-only dbname > schema.sql
# 只备份数据
pg_dump -U username --data-only dbname > data.sql
# 备份特定表
pg_dump -U username -t tablename dbname > table.sql
# 并行备份(大数据库)
pg_dump -U username -Fd -j 4 dbname -f backup_dir/
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 240 lines · 9 tokens per session scan A 8003718c49df
postgresql is a skill published in the GitHub repository chaterm/terminal-skills (59 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 9 tokens to every session and 1,601 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
postgresql-expert
Expert-level PostgreSQL database administration, advanced queries, performance tuning, and production operations. Use when the user mentions database, SQL, or performance, or when the task involves Advanced Data Types, Full-Text Search, Advanced Indexes, or Advanced Queries.
postgresdb
Use when PostgreSQL engine behaviour decides the answer — schema and type design, index choice, reading EXPLAIN on a slow query, zero-downtime DDL and backfills, or ops (roles, RLS, pooling, vacuum, partitioning, PITR). PG16, ORM-agnostic. NOT portable query logic (that is sql), NOT a managed provider's platform…
kysely
Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.
postgresql-best-practices
PostgreSQL development best practices for schema design, query optimization, and database administration.
diesel-guard
Lints Diesel and SQLx Postgres migrations for unsafe schema changes that lock tables or cause downtime, and authors custom Rhai checks. Use when reviewing, writing, or fixing SQL migrations, when diesel-guard reports a violation, when configuring diesel-guard.toml, or when the user mentions migration safety, table…
database-migrator
Migrates databases between providers (Postgres, MySQL, Supabase, PlanetScale, MongoDB). Reads source schema, generates migration scripts, handles data type mapping, foreign keys, indexes, triggers, stored procedures. Validates migration with row counts and checksums. Generates migration-plan.md with step-by-step…