database-design-skill

database-design-skill is a skill for Claude Code, Codex from jiushiwon/wg-skills. It costs 112 tokens per session (2,780 once invoked), scanned A, original, Apache-2.0.

A set of database design rules for code-generating tools. It covers names, fields, indexes, relationships, performance, and splitting data across databases or tables.

In plain words
What is it for?
Use it when designing tables, columns, indexes, relationships, field types, storage engines, or future sharding plans.
Why use it?
It gives generated backend code one consistent way to structure tables and choose database details, making schemas easier to maintain and extend.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when designing tables, columns, indexes, relationships, field types, storage engines, or future sharding plans.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jiushiwon/wg-skills/database-design-skill
Install

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.

Any agent
npx skills add jiushiwon/wg-skills --skill database-design-skill
Clone the repo
git clone --depth 1 https://github.com/jiushiwon/wg-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for database-design-skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/jiushiwon/wg-skills/database-design-skill/github.svg)](https://agentmods.dev/skills/jiushiwon/wg-skills/database-design-skill)
Your own site
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/database-design-skill"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/database-design-skill/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.

agentmods 80×15 button for database-design-skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/database-design-skill"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/database-design-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 112 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,780 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00112 $0.02780
Opus 5.5 $0.00045 $0.01112
Sonnet 5.5 $0.00022 $0.00556
Haiku 4.5 $0.00011 $0.00278

Measured 23d ago against content hash 30332c44f836, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-design-skill 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 23d 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.

database/database-design-skill/SKILL.md · 312 lines

How it starts

The opening of the file, as written. The whole thing — 312 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Database Design Skill

数据库设计规范体系——AI 生成代码时必须遵循的统一标准。

核心理念

AI 天然会建表,但建得好不好是另一回事。

本 skill 定义了一套完整的数据库设计规范,确保 AI 生成的后端项目:

  • 表结构统一、规范、易维护
  • 索引合理、性能有保障
  • 关联清晰、不易出错
  • 支持扩展、能应对分库分表

一、表名与字段名规范

1.1 命名原则

原则 说明 示例
英文小写 全部小写,用下划线分隔 user_name,不是 userName
有含义 用完整英文单词,不用缩写 created_at,不是 ctime
表前缀 统一前缀,默认 wg_ wg_user,wg_order
单数名词 表名用单数 wg_user,不是 wg_users

1.2 基础字段(所有表必须有)

-- PostgreSQL 示例:业务表基础字段
CREATE TABLE "wg_user" (
    "id" BIGSERIAL PRIMARY KEY,
    "status" SMALLINT NOT NULL DEFAULT 1,
    "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "deleted_at" TIMESTAMP DEFAULT NULL
);

COMMENT ON TABLE "wg_user" IS '用户表';
COMMENT ON COLUMN "wg_user"."status" IS '状态:0-禁用 1-正常';
COMMENT ON COLUMN "wg_user"."created_at" IS '创建时间';
COMMENT ON COLUMN "wg_user"."updated_at" IS '更新时间';
COMMENT ON COLUMN "wg_user"."deleted_at" IS '软删除时间戳';

1.3 字段类型选择

数据类型 MySQL PostgreSQL 场景
主键 BIGINT UNSIGNED BIGSERIAL 自增主键
状态 TINYINT SMALLINT 0/1/2 等状态码
布尔 TINYINT(1) BOOLEAN true/false
时间 DATETIME TIMESTAMP 创建/更新时间
枚举 ENUM / TINYINT CHECK 约束 有限选项
大文本 TEXT TEXT 长文本
JSON JSON / JSONB JSONB 动态结构(PG 推荐)

二、索引设计规范

2.1 索引类型选择

索引 场景 示例
主键索引 id 字段,自动唯一 PRIMARY KEY
唯一索引 唯一约束字段 uk_username on username
普通索引 WHERE 常用字段 idx_status on status
复合索引 多条件查询 idx_status_created on (status, created_at)

2.2 复合索引最左前缀原则

-- 复合索引 (status, created_at, user_id)
-- ✅ 能命中:WHERE status = 1
-- ✅ 能命中:WHERE status = 1 AND created_at > '2024-01-01'
-- ✅ 能命中:WHERE status = 1 AND created_at > '2024-01-01' AND user_id = 1
-- ❌ 不能命中:WHERE created_at > '2024-01-01'
-- ❌ 不能命中:WHERE user_id = 1

Read the full file on GitHub · 312 lines

Files

What ships with it

7 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.

Changes

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.

  1. 23d ago Changed · +2 lines 30332c44f836
  2. 2mo ago First seen · 310 lines · 112 tokens per session scan A b85a5a7618dd

Subscribe to this mod's changes

database-design-skill is a skill published in the GitHub repository jiushiwon/wg-skills (154 stars, last pushed 6d ago), licensed Apache-2.0. It adds 112 tokens to every session and 2,780 once invoked, about $0.0004 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-09-15.

Related

database-design-skill compared with skills from other repositories

database-design-skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
database-design-skilljiushiwon/wg-skillsSkill1546d agoApache-2.0A112Claude Code, Codex
create-prprisma/ormSkill48ktodayApache-2.0A47Claude Code, Codex
schema-explorationlangchain-ai/deepagentsSkill32ktodayMITA57Claude Code, Codex
atlas-mssqlariga/atlasSkill8.9k5d agoApache-2.0A163Claude Code
ha-data-storesshiwenwen/hope-agentSkill1.9ktodayMITA115Claude Code, Codex
pentesting-mysqlxalgorix/xalgorixSkill1.5kyesterdayApache-2.0A65Claude Code, Codex
nornicdb-cypher-queriesorneryd/NornicDBSkill937todayMITA79Claude Code, Codex