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 agentmods add skills/chaterm/terminal-skills/postgresqlnpx 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.svg" alt="Measured on agentmods" 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 | $0.00005 | $0.00800 |
| Sonnet 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 6d 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.
- 6d ago First seen · 240 lines · 9 tokens per session scan A 8003718c49df
postgresql is a skill published in the GitHub repository chaterm/terminal-skills (58 stars, last pushed 6mo 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. 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.
postgis
Use when extending PostgreSQL with spatial data types, spatial indexes (GiST/SP-GiST), geometry functions (STIntersects, STBuffer, STTransform), and spatial queries. PostGIS: the most widely used open-source spatial database extension.
Database Schema Reviewer
Reviews database schemas for normalization issues, missing indexes, naming inconsistencies, and scalability risks.
PostgreSQL
PostgreSQL 17.x — data types, DDL, DML, queries, indexes, full text search, concurrency, performance, functions.
postgres-sql-fundamentals
Postgres fundamentals for when you outgrow SQLite — psql, schema design, constraints, indexes, transactions, EXPLAIN, and connection pooling.
PostgreSQL Database Administration
Comprehensive PostgreSQL database administration skill for customer support tech enablement, covering database design, optimization, performance tuning, backup/recovery, and advanced query techniques.