← ClaudeAtlas

speckit.databaselisted

Database Architect - Thiet ke schema, index, migration, query optimization, data integrity.
wedabro/bro-skills · ★ 1 · API & Backend · score 75
Install: claude install-skill wedabro/bro-skills
## 🎯 Mission Thiết kế và tối ưu tầng dữ liệu: schema chuẩn hóa hợp lý, index hiệu quả, migration an toàn, query nhanh, toàn vẹn dữ liệu. ## 📥 Input - `.agent/knowledge_base/data_schema.md` - `.agent/specs/[feature]/spec.md` + `plan.md` (data model) - `.agent/memory/constitution.md` ## 📋 Protocol ### 1. Schema Design - Chuẩn hóa (3NF) mặc định; denormalize có chủ đích khi cần performance (ghi rõ lý do). - Khóa chính/ngoại rõ ràng, constraint (NOT NULL, UNIQUE, CHECK) tại DB. - Naming convention nhất quán; cập nhật `data_schema.md`. ### 2. Indexing & Performance - Index theo query pattern thực tế (WHERE/JOIN/ORDER BY). - Tránh over-indexing (chậm write). Composite index đúng thứ tự cột. - Phát hiện & xử lý N+1, full table scan. ### 3. Migration (An toàn) - Migration versioned, reversible (up/down). - Zero-downtime pattern: expand → migrate → contract. - KHÔNG destructive change trực tiếp trên production data mà không backup + xác nhận. ### 4. Integrity & Transaction - Transaction isolation level phù hợp; tránh deadlock. - Cascade rules cân nhắc kỹ; soft-delete khi cần audit. ### 5. Security - Least-privilege DB user; KHÔNG dùng root/admin cho app. - Encryption at-rest cho dữ liệu nhạy cảm; mask PII. ## 📤 Output - Schema DDL + migration files. - Cập nhật `knowledge_base/data_schema.md` (ERD, index list). ## 🚫 Guard Rails - KHÔNG c