Agent skill

Database Learning Skill

by jiushiwon in jiushiwon/wg-skills

数据库学习与选型技能。面向零基础学习者,系统学习数据结构、事务、索引、查询优化等核心概念,对比 MySQL 与 PostgreSQL 的差异与适用场景。触发词:"数据库学习"、"学数据库"、"数据库入门"、"MySQL vs PostgreSQL"、"数据库索引"、"数据库事务"、"数据库选型"、"数据库查询优化"。

Apache-2.0Auto-check passedDatabases

Install Database Learning Skill

skills CLI
$ npx skills add jiushiwon/wg-skills --skill database-learning-skill -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jiushiwon/wg-skills database-learning-skill --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jiushiwon/wg-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/vibeCoding/backend/database/database-learning-skill .claude/skills/database-learning-skill && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
database-learning-skill
GitHub stars
110
Token cost
~1k tokens
SKILL.md length
279 words
Files
7 (incl. references)
Skills in repo
121
Repo updated
First seen
Licence
Apache-2.0

At a glance

数据库学习与选型技能。面向零基础学习者,系统学习数据结构、事务、索引、查询优化等核心概念,对比 MySQL 与 PostgreSQL 的差异与适用场景。触发词:"数据库学习"、"学数据库"、"数据库入门"、"MySQL vs PostgreSQL"、"数据库索引"、"数据库事务"、"数据库选型"、"数据库查询优化"。

  • Works in 6 steps: 数据结构(表设计) → SQL 查询 → 索引(核心) → …
  • Databases work in your project
  • SKILL.md covers 核心理念, 学习路径, 学习模块 and 设计规范, plus 4 more sections
  • Calls mysql

What it does

Database Learning Skill is an agent skill from jiushiwon/wg-skills. 数据库学习与选型技能。面向零基础学习者,系统学习数据结构、事务、索引、查询优化等核心概念,对比 MySQL 与 PostgreSQL 的差异与适用场景。触发词:"数据库学习"、"学数据库"、"数据库入门"、"MySQL vs PostgreSQL"、"数据库索引"、"数据库事务"、"数据库选型"、"数据库查询优化"。

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `README.md`, `references/index-guide.md` and `references/mysql-vs-pgsql.md`).

It sits in Databases. It works with PostgreSQL, MySQL and SQL. The licence is Apache-2.0.

When your agent uses it

  • Databases work in your project

Example prompts

  • “MySQL vs PostgreSQL”
  • “数据库查询优化”
  • “/database-learning-skill”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. 数据结构(表设计)
  2. SQL 查询
  3. 索引(核心)
  4. 事务(核心)
  5. 查询优化
  6. MySQL vs PostgreSQL 选型

What it can do on your machine

Read from SKILL.md and the folder at commit a4a640b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • mysql

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Database Learning Skill loads about 1k tokens when it runs, and up to ~9.6k if it reads all its reference files. Until then it costs about 46 tokens; SKILL.md has 279 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jiushiwon/wg-skills at commit a4a640b, republished under its Apache-2.0 licence (© jiushiwon). 279 words, ~1,002 tokens.

Download SKILL.mdSave it as .claude/skills/database-learning-skill/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
database-learning-skill
description
数据库学习与选型技能。面向零基础学习者,系统学习数据结构、事务、索引、查询优化等核心概念,对比 MySQL 与 PostgreSQL 的差异与适用场景。触发词:"数据库学习"、"学数据库"、"数据库入门"、"MySQL vs PostgreSQL"、"数据库索引"、"数据库事务"、"数据库选型"、"数据库查询优化"。

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. 查询优化

为什么要优化?

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

如何发现慢查询?

sql
-- 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)

详细的性能优化规范见 database-design-skill。

6. MySQL vs PostgreSQL 选型
特性MySQLPostgreSQL
定位Web 应用企业级/复杂查询
事务支持支持(更完善)
JSON支持更强(JSONB)
全文搜索基础强大
地理信息插件原生支持
窗口函数支持完整支持
CTEs8.0+ 支持原生支持
主从复制MySQL BinlogPostgreSQL WAL
性能简单查询快复杂查询强
生态广泛增长快

选型建议

场景推荐
博客、CMS、电商MySQL
数据分析、报表PostgreSQL
需要 JSON 文档PostgreSQL
需要 GIS 地理PostgreSQL
团队熟悉 MySQLMySQL
需要事务强一致性PostgreSQL
高并发简单查询MySQL
复杂查询/联表PostgreSQL

设计规范

详细的设计规范(命名、字段类型、索引设计、分库分表等)见 database-design-skill。

速查要点:

  • 命名:英文小写 + 下划线,表前缀 wg_,单数名词
  • 基础字段:id、status、created_at、updated_at、deleted_at
  • 索引:WHERE/ORDER BY/JOIN 字段必须加索引

触发场景

数据库学习:
/database-learning-skill 什么是数据库事务
/database-learning-skill 索引是什么
/database-learning-skill MySQL 和 PostgreSQL 区别
/database-learning-skill 怎么优化慢查询
/database-learning-skill 复合索引怎么用
/database-learning-skill 帮我设计一个用户表

引用索引

文件内容
references/sql-basics.mdSQL 基础语法速查
references/index-guide.md索引详解与实战
references/transaction-guide.md事务与并发控制
references/query-optimization.md查询优化实战
references/mysql-vs-pgsql.mdMySQL vs PG 选型对比

相关技能

  • database-design-skill:数据库设计规范
  • mysql-guide-skill:MySQL 集成
  • pgsql-guide-skill:PostgreSQL 集成
  • springboot-init-skill:后端骨架(含数据库集成)
  • fastapi-init-skill:后端骨架(含数据库集成)
  • go-gin-init-skill:后端骨架(含数据库集成)

不做

  • 不涉及数据库安装部署(参考 database-design-skill)
  • 不涉及数据库集群/高可用架构
  • 不涉及具体 ORM 的使用(各后端 skill 负责)
  • 不涉及 SQL 深度优化(DBA 范畴)

© jiushiwon, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in vibeCoding/backend/database/database-learning-skill of jiushiwon/wg-skills.

  • SKILL.md
  • README.md
  • references/index-guide.md
  • references/mysql-vs-pgsql.md
  • references/query-optimization.md
  • references/sql-basics.md
  • references/transaction-guide.md

Open the folder on GitHubat commit a4a640b

Compare with similar skills

Database Learning Skill next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Database Learning Skill compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Database Learning Skill this skilljiushiwon/wg-skills110—~1kAutomated safety check: PassApache-2.0
SQL Database Support for pRESTprest/prest4.6k—~1.6kAutomated safety check: PassMIT
Chdb SQLvemetric/vemetric3941 repos~1.2kAutomated safety check: PassApache-2.0
Sql2erystemsrx/sql_to_ER188—~1.1kAutomated safety check: PassAGPL-3.0
Squixeduardofuncao/squix273—~784Automated safety check: PassMIT
Golang Databaseunxed/f42402 repos~2.9kAutomated safety check: PassMIT

Similar skills

  • Guides classifying, gap-analyzing and scaffolding support for a new SQL database in pREST, from Postgres-compatible variants to entirely new dialects.

    4.6k GitHub stars~1.6k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    394 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Sql2er

    ystemsrx/sql_to_ER

    A skill your agent uses when the user wants a Chen-model ER diagram from SQL CREATE TABLE statements or DBML, wants to rearrange or clean up an existing sql2er state, wants a skeleton-only overview…

    188 GitHub stars~1.1k tokensUpdated 7 days ago
    DatabasesAuto-check passed
  • Squix

    eduardofuncao/squix

    Run SQL queries across databases (Postgres, MySQL, SQLite, etc.) via the squix CLI.

    273 GitHub stars~784 tokensUpdated 15 days ago
    DatabasesAuto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    240 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed
  • Database Migrations SQL Migrations

    rmyndharis/antigravity-skills

    SQL database migrations with zero-downtime strategies for PostgreSQL, MySQL, SQL Server

    1.7k GitHub starsUsed in 2 repos~577 tokens
    DatabasesAuto-check: notes

More from jiushiwon/wg-skills

All 121 skills in this repo
  • Frontend UI Foundry

    jiushiwon/wg-skills

    A skill your agent uses when generating UI for a specific scenario (mobile/PC/官网/管理端/营销页/文档/金融/原生/3D), when refactoring an existing HTML/Vue/React project to a unified design system, when extracting…

    110 GitHub stars~1.4k tokensUpdated 3 days ago
    Auto-check passed
  • Workflow Diagram Skill

    jiushiwon/wg-skills

    A skill your agent uses when 用户想用一句话生成流程图、工作流图解、开发流程图、AI 流程图或任何步骤型图解,支持多风格输出(flat icon / 暖白手账风 / dark / cute),并提供现成模板一键出图。

    110 GitHub stars~1.2k tokensUpdated 3 days ago
    Auto-check passed
  • Uniapp App Generate Skill

    jiushiwon/wg-skills

    This skill should be used when the user wants to create a standardized uni-app project for WeChat mini-program, H5, and App from scratch.

    110 GitHub stars~5k tokensUpdated 3 days ago
    Auto-check: notes
  • Fastapi Init Skill

    jiushiwon/wg-skills

    FastAPI 项目一键初始化技能。面向零基础小白,提供环境探测、自动安装、完整 Web 骨架生成、SSE 流式框架、JWT 鉴权、统一响应封装、文件上传接口、一键启动/重启脚本、Swagger 文档,内置 MySQL(默认)/ PostgreSQL / MongoDB 数据库选择。用户只需说"帮我搭一个 FastAPI 项目"即可一条命令完成从零到跑的完整链路。触发词:"FastAPI…

    110 GitHub stars~1.8k tokensUpdated 3 days ago
    Auto-check: notes
  • Ffmpeg Skill

    jiushiwon/wg-skills

    FFmpeg 多媒体处理技能 — 将自然语言描述转为正确的 ffmpeg 命令,覆盖视频剪辑、转码、水印、合成、提取、生成等操作。内置一键安装脚本(Windows/Mac/Linux)。触发词:ffmpeg、视频剪辑、视频裁剪、视频转码、视频压缩、去水印、加水印、视频拼接、视频合成、提取音频、视频转…

    110 GitHub stars~1.4k tokensUpdated 3 days ago
    Auto-check passed
  • Frontend Request Skill

    jiushiwon/wg-skills

    A skill your agent uses when designing or reviewing the request layer of a frontend project (web / uni-app / mini-program), including request.ts wrappers, interceptors, deduplication, mocks, error…

    110 GitHub stars~3.6k tokensUpdated 3 days ago
    Auto-check passed

Categories

Questions about Database Learning Skill

What does Database Learning Skill do?

数据库学习与选型技能。面向零基础学习者,系统学习数据结构、事务、索引、查询优化等核心概念,对比 MySQL 与 PostgreSQL 的差异与适用场景。触发词:"数据库学习"、"学数据库"、"数据库入门"、"MySQL vs PostgreSQL"、"数据库索引"、"数据库事务"、"数据库选型"、"数据库查询优化"。. Database Learning Skill is an agent skill from jiushiwon/wg-skills.

When should I use Database Learning Skill?

Database Learning Skill fits situations like: databases work in your project.

How do I install Database Learning Skill in Claude Code?

Run `npx skills add jiushiwon/wg-skills --skill database-learning-skill -a claude-code`. Or copy the skill folder (vibeCoding/backend/database/database-learning-skill in jiushiwon/wg-skills) into .claude/skills/database-learning-skill in your project. Claude Code loads it when a task matches its description.

How do I install Database Learning Skill in Codex?

Run `npx skills add jiushiwon/wg-skills --skill database-learning-skill -a codex`. Or copy the skill folder (vibeCoding/backend/database/database-learning-skill in jiushiwon/wg-skills) into .agents/skills/database-learning-skill in your project. Codex loads it when a task matches its description.

Can I use Database Learning Skill in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jiushiwon/wg-skills --skill database-learning-skill -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/database-learning-skill, .gemini/skills/database-learning-skill, .github/skills/database-learning-skill and .opencode/skills/database-learning-skill in your project.

What does Database Learning Skill need to run?

Going by SKILL.md and its folder, Database Learning Skill needs the command-line tools its instructions call (mysql).

Does Database Learning Skill access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Database Learning Skill safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Database Learning Skill use?

Database Learning Skill is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Database Learning Skill use?

About 1k tokens (SKILL.md is roughly 4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.6k tokens, read only when the agent opens those files.

What are the alternatives to Database Learning Skill?

Skills that share tags, products or a category with Database Learning Skill: SQL Database Support for pREST (prest/prest, 4.6k stars), Chdb SQL (vemetric/vemetric, 394 stars), Sql2er (ystemsrx/sql_to_ER, 188 stars) and Squix (eduardofuncao/squix, 273 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Database Learning Skill?

jiushiwon (a GitHub user) maintains it in jiushiwon/wg-skills, which has 110 GitHub stars. The repository holds 121 skills in this directory. The repository was last updated on October 4, 2026.

Source: jiushiwon/wg-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.