重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
database-expert by oimiragieo/agent-studio
npx skills add https://github.com/oimiragieo/agent-studio --skill database-expert在审查或编写代码时,应用以下准则:
在审查或编写代码时,应用以下准则:
与数据库交互时:
在审查或编写代码时,应用以下准则:
在审查或编写代码时,应用以下准则:
在审查或编写代码时,应用以下准则:
在审查或编写代码时,应用以下准则:
在审查或编写代码时,应用以下准则:
您熟悉 Supabase 的最新功能以及如何与 Next.js 应用程序集成。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在审查或编写代码时,应用以下准则:
在审查或编写代码时,
此专家技能整合了 1 项独立技能:
| 反模式 | 失败原因 | 正确方法 |
|---|---|---|
| 字符串拼接的 SQL 查询 | SQL 注入向量;一个未净化的输入就可能危及数据库 | 使用 ORM 查询构建器或参数化预处理语句 |
| 多租户表上未启用 RLS | 任何经过身份验证的用户都可以读取/写入其他用户的数据 | 在所有用户范围的表上启用基于 auth.uid() 范围的 RLS 策略 |
无限制的 .findAll() / SELECT * 不带 LIMIT | 返回整个表;在大型数据集上导致超时和内存激增 | 始终使用 LIMIT/OFFSET 或基于游标的分页 |
| 无连接池 | 无服务器函数在负载下耗尽数据库连接 | 在事务模式下使用 PgBouncer / Supavisor |
| 记录包含值的完整查询字符串 | 将 PII 和凭据泄露到日志聚合器中 | 仅记录查询模板;对所有绑定参数值进行脱敏处理 |
使用官方的 MCP 服务器,让代理能够直接访问数据库,而无需编写自定义集成代码。
# 快速开始 — 无需安装
npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost/mydb
# Claude Desktop / agent-studio settings.json
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}
可用工具: query(只读 SELECT)、list_tables、describe_table
关键设计:只读强制执行
PostgreSQL MCP 服务器将查询包装在 BEGIN READ ONLY 事务中,防止意外修改。对于写入操作,请构建一个自定义的 MCP 服务器,并为其工具标注 destructiveHint: true。
代理工作流模式:
1. list_tables → 发现可用表
2. describe_table → 在查询前理解模式
3. query → 运行带有明确列列表 + LIMIT 的 SELECT 查询
npx -y @modelcontextprotocol/server-sqlite /path/to/database.db
# settings.json
{
"mcpServers": {
"sqlite": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db"]
}
}
}
可用工具: read_query、write_query、create_table、list_tables、describe_table、insert_row、delete_rows
SQLite MCP 使用模式:
-- 发现模式
list_tables()
describe_table({ table_name: "users" })
-- 安全读取模式
read_query({ query: "SELECT id, name, email FROM users WHERE active = 1 LIMIT 100" })
-- 使用明确列进行写入(绝不使用 INSERT SELECT *)
insert_row({ table_name: "users", data: { name: "Alice", email: "alice@example.com" } })
-- 条件删除(始终使用 WHERE)
delete_rows({ table_name: "sessions", where: "expires_at < datetime('now')" })
SQLite MCP 安全规则:
write_query 和 delete_rows 调用| 场景 | 使用 MCP 服务器 | 构建自定义 |
|---|---|---|
| 代理需要查询数据库以获取上下文 | MCP(postgres/sqlite) | 否 |
| 只读探索/分析 | MCP | 否 |
| 复杂的业务逻辑 + 数据库写入 | 否 | 带有已验证工具的自定义 MCP |
| 在一个事务中进行多个数据库操作 | 否 | 自定义(MCP 是单操作) |
| 在一个工作流中进行数据库 + 外部 API 操作 | 否 | 自定义编排 |
开始前:
cat .claude/context/memory/learnings.md
完成后: 记录发现的任何新模式或例外情况。
假设中断:您的上下文可能会重置。如果它不在记忆中,那就没有发生过。
每周安装量
63
仓库
GitHub 星标数
17
首次出现
2026年1月27日
安全审计
安装于
github-copilot62
gemini-cli61
kimi-cli60
amp60
codex60
opencode60
When reviewing or writing code, apply these guidelines:
When reviewing or writing code, apply these guidelines:
When interacting with databases:
When reviewing or writing code, apply these guidelines:
When reviewing or writing code, apply these guidelines:
When reviewing or writing code, apply these guidelines:
When reviewing or writing code, apply these guidelines:
When reviewing or writing code, apply these guidelines:
You are familiar with latest features of supabase and how to integrate with Next.js application.
When reviewing or writing code, apply these guidelines:
When reviewing or writing code,
This expert skill consolidates 1 individual skills:
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| String-concatenated SQL queries | SQL injection vector; one unsanitized input compromises the database | Use ORM query builders or parameterized prepared statements |
| No RLS on multi-tenant tables | Any authenticated user can read/write other users' data | Enable RLS policies scoped to auth.uid() on all user-scoped tables |
Unbounded .findAll() / SELECT * without LIMIT | Returns entire table; causes timeouts and memory spikes on large datasets | Always paginate with LIMIT/OFFSET or cursor-based pagination |
| No connection pooling | Serverless functions exhaust database connections under load | Use PgBouncer / Supavisor in transaction mode |
| Logging full query strings with values | Leaks PII and credentials into log aggregators | Log query templates only; redact all bound parameter values |
Use official MCP servers to give agents direct database access without writing custom integration code.
# Quick start — no install required
npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost/mydb
# Claude Desktop / agent-studio settings.json
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}
Available tools: query (read-only SELECT), list_tables, describe_table
Key design: read-only enforcement
The PostgreSQL MCP server wraps queries in BEGIN READ ONLY transactions, preventing accidental mutations. For write operations, build a custom MCP server with explicit write tools annotated destructiveHint: true.
Agent workflow pattern:
1. list_tables → discover available tables
2. describe_table → understand schema before querying
3. query → run SELECT with explicit column list + LIMIT
npx -y @modelcontextprotocol/server-sqlite /path/to/database.db
# settings.json
{
"mcpServers": {
"sqlite": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db"]
}
}
}
Available tools: read_query, write_query, create_table, list_tables, describe_table, insert_row, delete_rows
SQLite MCP usage patterns:
-- Discover schema
list_tables()
describe_table({ table_name: "users" })
-- Safe read pattern
read_query({ query: "SELECT id, name, email FROM users WHERE active = 1 LIMIT 100" })
-- Write with explicit columns (never INSERT SELECT *)
insert_row({ table_name: "users", data: { name: "Alice", email: "alice@example.com" } })
-- Conditional delete (always use WHERE)
delete_rows({ table_name: "sessions", where: "expires_at < datetime('now')" })
Security rules for SQLite MCP:
write_query and delete_rows calls in audit trail| Scenario | Use MCP Server | Build Custom |
|---|---|---|
| Agent needs to query a DB for context | MCP (postgres/sqlite) | No |
| Read-only exploration / analysis | MCP | No |
| Complex business logic + DB writes | No | Custom MCP with validated tools |
| Multiple DB operations in one transaction | No | Custom (MCP is single-op) |
| DB + external API in one workflow | No | Custom orchestration |
Before starting:
cat .claude/context/memory/learnings.md
After completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Weekly Installs
63
Repository
GitHub Stars
17
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
github-copilot62
gemini-cli61
kimi-cli60
amp60
codex60
opencode60
Lark Mail CLI 使用指南:邮件管理、安全规则与自动化工作流
47,900 周安装