database-learning-skill

database-learning-skill is a skill for Claude Code, Codex from jiushiwon/wg-skills. It costs 101 tokens per session (1,897 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,897 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.01897
Opus 5.5 $0.00040 $0.00759
Sonnet 5.5 $0.00020 $0.00379
Haiku 4.5 $0.00010 $0.00190

Measured 2mo ago against content hash be5db4d1cf0b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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-learning-skill/SKILL.md · 221 lines

How it starts

The opening of the file, as written. The whole thing — 221 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. 查询优化

为什么要优化?

慢查询是数据库性能的最大杀手。一个没有索引的查询可能让整个系统变慢。

如何发现慢查询?

-- MySQL:开启慢查询日志
SHOW VARIABLES LIKE 'slow_query_log';
SELECT * FROM slow_log ORDER BY start_time DESC LIMIT 10;

-- PostgreSQL:查看慢查询统计
SELECT * FROM pg_stat_statements ORDER BY total_time DESC LIMIT 10;

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

核心优化思路

  1. 加索引 → WHERE 条件字段必须有索引
  2. **避免 SELECT *** → 只查询需要的字段
  3. 避免函数运算 → WHERE YEAR(created_at)=2024 改为 WHERE created_at >= '2024-01-01'
  4. 分页优化 → 大偏移量用游标分页(WHERE id > last_id)

Read the full file on GitHub · 221 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. 2mo ago Changed be5db4d1cf0b
  2. 2mo ago Changed · -11 lines 393165c924eb
  3. 2mo 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 (154 stars, last pushed 6d ago), licensed Apache-2.0. It adds 101 tokens to every session and 1,897 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-07.

Related

database-learning-skill compared with skills from other repositories

database-learning-skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
database-learning-skilljiushiwon/wg-skillsSkill1546d agoApache-2.0A101Claude Code, Codex
postgresql-table-designwshobson/agentsSkill43k6d agoMITA37Claude Code
db-repairgarrytan/gbrainSkill34ktodayMITA96Claude Code
dsqlawslabs/agent-pluginsSkill953todayApache-2.0A247Claude Code
volcengine-rds-postgresqlbytedance/agentkit-samplesSkill4965d agoApache-2.0A63Claude Code, Codex
postgresdbericrisco/rsc-harnessSkill6825d agoMITA91Claude Code, Codex
analyzing-insights-across-teamsPostHog/posthog-fossSkill733todayMITA115Claude Code, Codex