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 zhe-qi/clhoria-template --skill db-schemagit clone --depth 1 https://github.com/zhe-qi/clhoria-templateWrote 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/zhe-qi/clhoria-template/db-schema)<a href="https://agentmods.dev/skills/zhe-qi/clhoria-template/db-schema"><img src="https://agentmods.dev/badge/skills/zhe-qi/clhoria-template/db-schema/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/zhe-qi/clhoria-template/db-schema"><img src="https://agentmods.dev/badge/skills/zhe-qi/clhoria-template/db-schema.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00040 | $0.01096 |
| Opus 5 | $0.00020 | $0.00548 |
| Sonnet 5 | $0.00008 | $0.00219 |
| Haiku 4.5 | $0.00004 | $0.00110 |
Grade A, and why
db-schema 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 11d 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 — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.
数据库 Schema 开发指南
技术栈
- ORM: Drizzle ORM (postgres.js driver)
- Schema 验证: drizzle-zod + Zod v4
- 数据库: PostgreSQL
文件结构
src/db/schema/
├── _shard/ # 共享定义
│ ├── base-columns.ts # 基础列(id/createdAt/updatedAt/createdBy/updatedBy)
│ ├── enums.ts # 数据库枚举定义
│ └── types/ # 共享类型
├── _infra/ # 基础设施表(非业务表)
│ └── queue/ # 队列任务
├── admin/ # 管理端表
│ ├── system/ # 系统管理
│ └── auth/ # 认证相关
├── client/ # 客户端表
└── index.ts # 统一导出
注意:
_infra目录使用下划线前缀,存放基础设施相关的表(如审计日志、队列任务记录等),与业务表分开管理。
核心规则
导入方式
import db from "@/db"; // 数据库实例(default export)
import { users } from "@/db/schema"; // Schema 定义
命名约定
- TS 属性名:camelCase(自动转换为 snake_case)
- 表名:
{tier}_{feature}s(如system_users) - 索引名:
{表名}_{字段名}_idx - 主键:统一命名为
id
批量插入
// 正确:批量插入
db.insert(table).values([...items])
// 错误:循环单条插入
for (const item of items) {
db.insert(table).values(item) // 不要这样做
}
模板参考
数据库 Schema
参考 db-schema.md
包含:
- 标准表定义
- 字段类型参考
- 约束定义语法
- 主键设计规则
- 索引设计原则
- 枚举定义流程
- Relations 定义
- JSONB 使用规范
- Drizzle-kit 工作流程
Zod Schema
包含:
- 标准 Schema 文件结构
- Schema 派生规则
- 最佳实践
- Zod v4 注意事项
PostgreSQL 表设计最佳实践
包含:
- 数据类型选择(避免使用的类型、推荐类型)
- 约束设计(PK、FK、UNIQUE、CHECK、EXCLUDE)
- 索引类型(B-tree、GIN、GiST、BRIN)
- 分区策略(RANGE、LIST、HASH)
- 特殊场景优化(更新密集、插入密集、Upsert)
- 安全 Schema 演进
- JSONB 使用指南
- 常用扩展(pgcrypto、pg_trgm、timescaledb、postgis、pgvector)
数据库迁移指南
参考 migration.md
包含:
- Drizzle 工作流程(push vs generate vs migrate)
- 迁移最佳实践(小单位迁移、安全添加/删除列)
- 生产检查清单(迁移前/中/后)
- 回滚策略
- 常见问题解答
开发流程
创建新表
- 在
src/db/schema/{tier}/{category}/下创建文件 - 定义表结构(继承 baseColumns)
- 创建 selectSchema 和 insertSchema
- 在
src/db/schema/index.ts中导出 - 运行
pnpm push(开发环境)
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 11d ago First seen · 143 lines · 40 tokens per session scan A 4f2862d1446a
db-schema is a skill published in the GitHub repository zhe-qi/clhoria-template (190 stars, last pushed 1mo ago), licensed MIT. It adds 40 tokens to every session and 1,096 once invoked, about $0.0002 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
alloydb-basics
Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.
postgresql-table-design
Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.
db-repair
Auto-fix gbrain's Postgres access so the brain stays available. When any gbrain command or MCP tool result carries a GBRAINDBACCESS marker (or an operator reports the brain database is down), run the hardcoded gbrain db-repair ladder: diagnose, apply the safe tier, verify. The action is ALWAYS the hardcoded command …
dsql
Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…
volcengine-rds-postgresql
A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.
polar-local-environment
This skill should be used when setting up or managing Polar local development environment with Docker.