database

database is a skill for Claude Code from cass-2003/local-workflow-skill. It costs 47 tokens per session (4,505 once invoked), scanned A, original, MIT.

A database-focused coding aid for designing schemas, writing SQL, and working with MySQL, PostgreSQL, Redis, and MongoDB. It also covers indexes, backups, replication, and connection pools.

In plain words
What is it for?
Use it to design tables, write queries, improve indexes, investigate slow queries with EXPLAIN, and plan database operations.
Why use it?
It gives developers a structured way to inspect database structures, diagnose data-access problems, and choose suitable storage and indexing approaches.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: positional $N argument.

Good fit Use it to design tables, write queries, improve indexes, investigate slow queries with EXPLAIN, and plan database operations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/database
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 cass-2003/local-workflow-skill --skill database
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/database"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/database.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,505 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.00047 $0.04505
Opus 5 $0.00023 $0.02253
Sonnet 5 $0.00009 $0.00901
Haiku 4.5 $0.00005 $0.00451

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

Security

Grade A, and why

database 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 6d 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.

skills/data-analysis/codex/database/SKILL.md · 516 lines

How it starts

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

数据库

角色定义

你是数据库专家,精通关系型/NoSQL 数据库设计与优化。目标:编写高效的数据库操作和优化查询性能。

行为指令

  1. 确认数据库: 类型(MySQL/PG/Redis/Mongo)、版本、当前问题
  2. 读取 Schema: 先看现有表结构、索引、查询
  3. 执行: 编写/优化 SQL、设计 Schema、配置调优
  4. 验证: EXPLAIN ANALYZE 验证查询计划

工具策略

任务 首选工具 备选
读取配置/SQL Read
编辑 SQL/配置 Edit
执行查询 Bash (mysql/psql/redis-cli)
查文档 mcp__context7__query-docs WebSearch

决策树

问题类型?
├── Schema 设计
│   ├── 关系数据 → MySQL/PostgreSQL (范式化)
│   ├── 文档数据 → MongoDB (嵌套 vs 引用)
│   ├── 缓存/会话 → Redis
│   └── 时序数据 → TimescaleDB / InfluxDB
├── 查询优化
│   ├── 慢查询 → EXPLAIN → 缺少索引?全表扫描?
│   ├── N+1 问题 → JOIN / 批量查询
│   ├── 聚合慢 → 物化视图 / 预计算
│   └── 锁争用 → 事务隔离级别 / 乐观锁
├── 索引策略
│   ├── WHERE 条件列 → B-tree 索引
│   ├── 全文搜索 → GIN/FULLTEXT
│   ├── JSON 字段 → GIN (PG) / 多键索引 (Mongo)
│   └── 复合条件 → 复合索引 (遵循最左前缀)
└── 运维
    ├── 备份恢复 → pg_dump/mysqldump
    ├── 主从复制 → streaming replication
    └── 连接池 → PgBouncer / ProxySQL

索引优化速查

场景 PostgreSQL MySQL
等值查询 B-tree (默认) B-tree
范围查询 B-tree B-tree
全文搜索 GIN + tsvector FULLTEXT
JSON 查询 GIN (jsonb) 虚拟列+索引
数组包含 GIN
前缀匹配 text_pattern_ops INDEX(col(N))
覆盖索引 INCLUDE — (联合索引)
-- 查看慢查询
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;

-- 索引使用统计 (PG)
SELECT schemaname, tablename, indexname, idx_scan
FROM pg_stat_user_indexes ORDER BY idx_scan;

-- 未使用索引
SELECT * FROM pg_stat_user_indexes WHERE idx_scan = 0;

Redis 模式速查

模式 命令 适用场景
缓存 SET/GET + TTL 热点数据
计数器 INCR/DECR 限流、统计
分布式锁 SET NX EX 互斥操作
排行榜 ZADD/ZRANGE 排名
消息队列 XADD/XREAD (Stream) 异步任务
发布订阅 PUBLISH/SUBSCRIBE 实时通知

安全要点

  • 参数化查询,禁止字符串拼接 SQL
  • 最小权限原则(只读用户 vs 管理员)
  • 敏感数据加密存储(密码 bcrypt/argon2,PII 列加密)
  • 审计日志(pgaudit / MySQL audit plugin)

输出格式

**数据库**: [类型 + 版本]
**问题**: [描述]
**方案**: [SQL/配置变更]
**验证**: [EXPLAIN 结果 / 性能对比]
**风险**: [兼容性/数据影响评估]

Read the full file on GitHub · 516 lines

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. 6d ago First seen · 516 lines · 47 tokens per session scan A 2a7f283d91cd

Subscribe to this mod's changes

database is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 47 tokens to every session and 4,505 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-09-03.

Related

Other skills, from other repositories

fastapi-init-skill

A tool that creates a complete FastAPI web-service starting point, including database choices, login protection, file uploads, streaming responses, API documentation, and start or restart scripts.

jiushiwon/wg-skills · 229 tokens

ring:mapping-service-resources

Mapping a Go service's Service -> Module -> Resource hierarchy for dispatch-layer registration: detects modules and per-module PostgreSQL/MongoDB/RabbitMQ resources, database names, and shared databases, generates MongoDB index migration pairs (.up.json/.down.json), detects existing Postgres migrations, emits an HTML…

LerianStudio/ring · 97 tokens

database-expert

Advanced database design and administration for PostgreSQL, MongoDB, and Redis. Use when designing schemas, optimizing queries, managing database performance, or implementing data patterns.

travisjneuman/.claude · 36 tokens

software-database-design

Designs database schemas, migrations, and data models for PostgreSQL, MySQL, MongoDB, and Redis. Use when planning tables, relationships, indexes, or ORM-backed schema changes.

vasilyu1983/AI-Agents-public · 43 tokens

ck:databases

Design schemas, write queries for MongoDB and PostgreSQL. Use for database design, SQL/NoSQL queries, aggregation pipelines, indexes, migrations, replication, performance optimization, psql CLI.

manhvann/codexkit · 44 tokens

database-migrator

Migrates databases between providers (Postgres, MySQL, Supabase, PlanetScale, MongoDB). Reads source schema, generates migration scripts, handles data type mapping, foreign keys, indexes, triggers, stored procedures. Validates migration with row counts and checksums. Generates migration-plan.md with step-by-step…

OneWave-AI/claude-skills · 76 tokens