database-learning-skill

database-learning-skill is a skill for Claude Code, Codex from jiushiwon/wg-skills. It costs 101 tokens per session (1,965 once invoked), scanned A, original, Apache-2.0.

A beginner-oriented learning guide to databases, including table design, SQL queries, indexes, transactions, and choosing between MySQL and PostgreSQL. SQL is the language commonly used to read and change database records.

In plain words
What is it for?
It is for learning database structure, writing basic queries, understanding indexes and transactions, improving query performance, and comparing MySQL with PostgreSQL.
Why use it?
It explains database ideas from the ground up instead of assuming prior knowledge. It helps clarify how databases organise data, keep changes consistent, and speed up searches.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for learning database structure, writing basic queries, understanding indexes and transactions, improving query performance, and comparing MySQL with PostgreSQL.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jiushiwon/wg-skills/database-learning-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-learning-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-learning-skill

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/jiushiwon/wg-skills/database-learning-skill"><img src="https://agentmods.dev/badge/skills/jiushiwon/wg-skills/database-learning-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,965 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.00101 $0.01965
Opus 5 $0.00051 $0.00983
Sonnet 5 $0.00020 $0.00393
Haiku 4.5 $0.00010 $0.00197

Measured 5d ago against content hash 2f764dc945c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

database-learning-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 5d 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.

vibeCoding/backend/database/database-learning-skill/SKILL.md · 232 lines

How it starts

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

Database Learning Skill

面向零基础学习者,系统学习数据库核心概念,掌握数据库选型与优化能力。

核心理念

数据库 = 数据的仓库 + 管理的艺术

学数据库不是背命令,而是理解:

  • 数据如何组织(表结构)
  • 数据如何关联(关系)
  • 数据如何高效查找(索引)
  • 数据如何安全(事务)
  • 什么场景选什么数据库(选型)

学习路径

数据库入门
    ↓
表结构设计(数据结构)
    ↓
数据查询(SQL 基础)
    ↓
索引与查询优化
    ↓
事务与并发控制
    ↓
MySQL vs PostgreSQL 选型

学习模块

1. 数据结构(表设计)

概念 说明
表(Table) 数据的二维表格,像 Excel
字段(Column) 表的列,如 id、name、age
记录(Row) 表的行,一条数据
主键(Primary Key) 唯一标识一条记录
外键(Foreign Key) 表与表的关联
约束 数据的规则(唯一、非空、默认值)

实战:设计一个用户表、一个订单表

2. SQL 查询

操作 SQL 关键字
查询 SELECT
插入 INSERT
更新 UPDATE
删除 DELETE
条件 WHERE
排序 ORDER BY
分组 GROUP BY
聚合 COUNT/SUM/AVG/MAX/MIN

3. 索引(核心)

为什么需要索引?

无索引:逐行扫描 → 10万行 = 10万次 IO
有索引:B+Tree 定位 → 10万行 ≈ 3次 IO
索引类型 说明 适用场景
主键索引 自动唯一,非空 主键字段
唯一索引 字段值唯一 username、email
普通索引 加速查找 常用查询字段
复合索引 多字段组合 多条件查询
全文索引 文本搜索 文章内容搜索

最左前缀原则:复合索引 (a, b, c) 能命中 a、a+b、a+b+c,不能命中 b、c

4. 事务(核心)

什么是事务?

事务 = 一组 SQL 操作,要么全部成功,要么全部失败

转账场景:
1. A 账户 -1000
2. B 账户 +1000
必须一起成功或一起失败

ACID 特性

特性 说明
Atomic(原子性) 不可分割,要么全成功要么全失败
Consistency(一致性) 事务前后数据状态一致
Isolation(隔离性) 并发事务互不干扰
Durability(持久性) 提交后数据永久保存

隔离级别

级别 脏读 不可重复读 幻读
读未提交
读已提交
可重复读
串行化

MySQL 默认:可重复读(RR) PostgreSQL 默认:读已提交(RC)

5. 查询优化

慢查询分析

-- 开启慢查询日志
SHOW VARIABLES LIKE 'slow_query_log';

-- 查看慢查询
SELECT * FROM slow_log ORDER BY start_time DESC LIMIT 10;

-- 使用 EXPLAIN 分析查询
EXPLAIN SELECT * FROM users WHERE username = 'test';

优化技巧

  1. **避免 SELECT *** → 只查询需要的字段
  2. 避免函数运算 → WHERE age * 2 > 30 改为 WHERE age > 15
  3. 避免隐式转换 → '123' vs 123
  4. 使用索引 → 确保 WHERE 条件有索引
  5. 分页优化 → SELECT * FROM users LIMIT 100000, 10 改为 WHERE id > last_id

Read the full file on GitHub · 232 lines

Files

What ships with it

6 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. 5d ago First seen · 232 lines · 101 tokens per session scan A 2f764dc945c0

Subscribe to this mod's changes

database-learning-skill is a skill published in the GitHub repository jiushiwon/wg-skills (102 stars, last pushed 2d ago), licensed Apache-2.0. It adds 101 tokens to every session and 1,965 once invoked, about $0.0005 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-09-07.

Related

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.

google/skills · 72 tokens

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.

wshobson/agents · 37 tokens

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 …

garrytan/gbrain · 96 tokens

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.

bytedance/agentkit-samples · 63 tokens

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…

awslabs/agent-plugins · 229 tokens

polar-local-environment

This skill should be used when setting up or managing Polar local development environment with Docker.

fcakyon/claude-codex-settings · 22 tokens