Setup
On first use, read setup.md for local initialization, activation preferences, and operating defaults.
When to Use
User needs a reliable database operating system for schema design, query hygiene, migration rollout, and recovery readiness.
Agent keeps data work safe by enforcing preflight checks, explicit rollback plans, and incident-ready runbooks.
Use this skill when database changes can affect production reliability, latency, or data integrity.
Architecture
Memory lives in ~/database-manager/. See memory-template.md for the base structure.
CODEBLOCK0
Quick Reference
| Topic | File |
|---|
| Setup flow | INLINECODE3 |
| Memory template |
memory-template.md |
| Inventory and ownership model |
inventory-and-governance.md |
| Query operations and change windows |
query-operations.md |
| Migration and release controls |
migration-and-release.md |
| Backup and recovery workflows |
backup-and-recovery.md |
| Incident response sequence |
incident-playbook.md |
| Reusable templates |
templates.md |
Core Rules
1. Never Change Production Without a Preflight Packet
Every schema or data change must include:
- - intent
- blast radius
- rollback path
- verification query set
Skipping preflight creates unbounded operational risk.
2. Separate Read Validation from Write Execution
Validate assumptions with read-only checks first, then run writes in explicit, audited steps.
This prevents accidental broad updates caused by stale predicates or wrong join keys.
3. Treat Migrations as Product Releases
Each migration requires:
- - owner
- deployment window
- rollback deadline
- post-deploy verification criteria
Schema changes without release discipline are a primary source of prolonged incidents.
4. Make Index and Query Trade-offs Explicit
When changing indexes or query plans, state expected impact on:
- - read latency
- write throughput
- storage growth
Invisible trade-offs create hidden cost and unpredictable performance regressions.
5. Backup Is Not Real Until Restore Is Proven
Do not trust backup status alone.
Run restore drills, validate recovered row counts, and document measured recovery time.
Unverified backups are operationally equivalent to no backups.
6. Encode Safety Gates for Destructive Operations
Before
DROP,
TRUNCATE, broad
DELETE, or bulk
UPDATE:
- - confirm table and environment
- capture row count baseline
- require explicit user confirmation
- log exact rollback route
Destructive steps without safety gates can permanently corrupt business data.
7. Close Every Incident with Durable Learning
After mitigation:
- - capture root cause
- record missing guardrail
- add one concrete prevention change
Without closure rules, the same incident class repeats.
Common Traps
- - Running updates without a restrictive predicate -> unintended mass writes and long rollback windows.
- Shipping migrations without timing and lock analysis -> production latency spikes and blocked transactions.
- Assuming replica lag is harmless -> stale reads and misleading verification outcomes.
- Declaring backup success without restore drills -> false confidence during outages.
- Fixing incidents without permanent guardrails -> repeated operational failures.
Security & Privacy
Data that leaves your machine:
Data that stays local:
- - Database operating context and records under
~/database-manager/.
This skill does NOT:
- - Execute destructive commands without explicit user confirmation.
- Access unrelated credentials or services by default.
- Store secrets in memory files.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
sql - SQL query authoring and analysis - INLINECODE18 - MySQL-specific workflows and troubleshooting
- INLINECODE19 - Prisma schema and migration tooling
- INLINECODE20 - local database workflows and prototyping
- INLINECODE21 - backend architecture and service delivery
Feedback
- - If useful: INLINECODE22
- Stay updated: INLINECODE23
设置
首次使用时,请阅读 setup.md 了解本地初始化、激活偏好和操作默认值。
使用时机
当用户需要一个可靠的数据库操作系统,用于模式设计、查询规范、迁移部署和恢复准备时使用。
代理通过强制执行预检检查、明确的回滚计划和事故就绪运行手册,确保数据操作安全。
当数据库变更可能影响生产可靠性、延迟或数据完整性时,请使用此技能。
架构
数据存储在 ~/database-manager/ 目录下。基础结构请参见 memory-template.md。
~/database-manager/
├── memory.md # 持久化上下文和操作偏好
├── inventory.md # 系统、引擎、所有者和关键数据集
├── standards.md # 命名、索引和模式约定
├── migrations.md # 已计划和已执行的迁移记录
├── backups.md # 备份计划、保留策略和恢复演练
├── incidents.md # 事故时间线、缓解措施和后续跟进
└── archive/
├── migrations-YYYY-MM.md # 按月份归档的已关闭迁移
└── incidents-YYYY-MM.md # 按月份归档的已关闭事故
快速参考
memory-template.md |
| 清单和所有权模型 | inventory-and-governance.md |
| 查询操作和变更窗口 | query-operations.md |
| 迁移和发布控制 | migration-and-release.md |
| 备份和恢复工作流 | backup-and-recovery.md |
| 事故响应流程 | incident-playbook.md |
| 可复用模板 | templates.md |
核心规则
1. 未经预检包,绝不更改生产环境
每次模式或数据变更必须包含:
跳过预检将带来不可控的操作风险。
2. 将读取验证与写入执行分离
先用只读检查验证假设,然后以明确的、可审计的步骤执行写入操作。
这可以防止因过时的谓词或错误的连接键导致的意外大规模更新。
3. 将迁移视为产品发布
每次迁移需要:
缺乏发布纪律的模式变更是导致长时间事故的主要原因。
4. 明确索引和查询的权衡
更改索引或查询计划时,需说明对以下方面的预期影响:
不可见的权衡会带来隐藏成本和不可预测的性能退化。
5. 未经恢复验证的备份不算真正的备份
不要仅信任备份状态。
执行恢复演练,验证恢复的行数,并记录测量的恢复时间。
未经验证的备份在操作上等同于没有备份。
6. 为破坏性操作设置安全门
在执行 DROP、TRUNCATE、大规模 DELETE 或批量 UPDATE 之前:
- - 确认表和环境
- 捕获行数基线
- 要求用户明确确认
- 记录精确的回滚路径
没有安全门的破坏性步骤可能永久损坏业务数据。
7. 每次事故都要以持久学习收尾
缓解措施之后:
- - 捕获根本原因
- 记录缺失的防护措施
- 添加一项具体的预防性变更
没有收尾规则,同类事故会反复发生。
常见陷阱
- - 运行没有限制性谓词的更新 -> 导致意外的大规模写入和长时间的回滚窗口。
- 未进行时序和锁分析就部署迁移 -> 导致生产延迟飙升和事务阻塞。
- 假设副本延迟无害 -> 导致读取过时数据和误导性的验证结果。
- 未进行恢复演练就宣布备份成功 -> 在故障期间产生虚假信心。
- 修复事故而不添加永久性防护措施 -> 导致操作故障反复发生。
安全与隐私
离开您机器的数据:
保留在本地数据:
- - ~/database-manager/ 目录下的数据库操作上下文和记录。
此技能不会:
- - 在未经用户明确确认的情况下执行破坏性命令。
- 默认访问无关的凭据或服务。
- 在内存文件中存储密钥。
相关技能
如果用户确认,使用 clawhub install
安装:
- - sql - SQL 查询编写和分析
- mysql - MySQL 特定工作流和故障排除
- prisma - Prisma 模式和迁移工具
- sqlite - 本地数据库工作流和原型开发
- backend - 后端架构和服务交付
反馈
- - 如果觉得有用:clawhub star database-manager
- 保持更新:clawhub sync