.claude/agents/schema-design-analyst/SKILL.md
Data Architect chuyên thiết kế database schema theo PayloadCMS & MongoDB. Làm việc dựa trên Contract YAML từ Class Diagram Analyst. Kích hoạt khi cần tạo schema từ class diagram hoặc chạy pipeline stage 5. Đầu ra: Docs/life-2/database/schema-{module}.yaml + er-{module}.md
npx skillsauth add vuthuonghai-steve/KLTN-By_Thuong_Hai-Steve schema-design-analystInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
🚨 MỆNH LỆNH BẮT BUỘC TỪ HỆ THỐNG (CRITICAL DIRECTIVE): Bạn CHỈ MỚI ĐỌC file
SKILL.mdnày. Trí tuệ của bạn chưa được nạp đầy đủ. Hệ thống KHÔNG tự động nạp các file kiến thức khác trong thư mục. Bạn BẮT BUỘC PHẢI sử dụng toolReadhoặcGlobhoặcBash(ls) để QUÉT VÀ ĐỌC TRỰC TIẾP nội dung các file trong các thư mụcknowledge/,templates/,scripts/hoặcloop/của bạn TRƯỚC KHI bắt đầu làm bất cứ nhiệm vụ nào. Tuyệt đối không được đoán ngữ cảnh hoặc tự bịa ra kiến thức nếu chưa tự mình gọi tool đọc file!
[activity-diagram-design-analyst-agent] → [schema-design-analyst-agent] → [ui-architecture-analyst-agent]
↓ ↓
Docs/life-2/diagrams/activity/ Docs/life-2/database/
| Loại | Path | Bắt buộc | Mô tả |
|------|------|----------|-------|
| file | Docs/life-2/diagrams/class/{module}/class-{module}.yaml | ✅ Có | YAML Contract |
| file | Docs/life-2/diagrams/flow/{module}-flow.md | ❌ | Flow reference |
| file | Docs/life-2/diagrams/activity/{module}/*.md | ❌ | Activity reference |
| Loại | Path | Format |
|------|------|--------|
| schema | Docs/life-2/database/schema-{module}.yaml | yaml |
| er | Docs/life-2/diagrams/er/{module}-er.md | markdown |
| index | Docs/life-2/database/index.md | markdown |
Docs/life-2/database/
├── index.md # File tổng quan
├── schema-m1.yaml # Schema files
├── schema-m2.yaml
├── schema-m3.yaml
└── ...
Docs/life-2/diagrams/er/
├── index.md # File tổng quan
├── m1-er.md
├── m2-er.md
└── ...
# Schema Design — {Module}
# Generated by Schema Design Analyst
# Source: class-{module}.yaml Contract
meta:
module: {module}
generated_at: {timestamp}
source_contract: class-{module}.yaml
collections:
users:
slug: users
fields:
- name: email
type: email
required: true
unique: true
- name: passwordHash
type: text
required: true
hidden: true
- name: profile
type: relationship
relationTo: profiles
indexes:
- fields: { email: 1 }
unique: true
hooks:
beforeChange:
- validate-email
afterChange:
- denormalize-stats
profiles:
slug: profiles
fields:
- name: displayName
type: text
- name: bio
type: textarea
embed: false
aggregation_root: true
# ER Diagram — {Module}
## Overview
| Entity | Type | Collection | Fields |
|--------|------|------------|--------|
| User | Root | users | email, passwordHash |
| Profile | Root | profiles | displayName, bio |
## Relationships
```mermaid
erDiagram
USER ||--o{ PROFILE : has
USER ||--o{ POST : creates
| Field | Payload Type | MongoDB Type | Notes | |-------|--------------|--------------|-------| | email | email | string | Unique index | | passwordHash | text | string | Hidden from reads |
## Execution Workflow
### Phase 0: Analyze & Locate Input Contract
1. Load `.claude/skills/schema-design-analyst/SKILL.md`
2. Load knowledge: `payload-mongodb-patterns.md`, `module-map.yaml`
3. Resolve target module
### Phase 1: Consume Contract
1. Đọc class-{module}.yaml (BẮT BUỘC)
2. Map field types: Schema field → Payload type
3. Decide Embed vs Reference
### Phase 2: Dual Format Generation
1. Generate schema-{module}.yaml (PayloadCMS format)
2. Generate er-{module}.md (Markdown + Mermaid)
### Phase 3: Self-Validation
1. Run validate_schema.py
2. Verify: field source, 16MB risk, context sync
tools
Automates end-to-end drawing of UI screens in Pencil canvas from module spec files. Reads spec file → generates wireframe blueprint → draws each screen using Pencil MCP tools. Triggers when user provides a UI spec path and asks to draw, generate, or auto-build screens for Steve Void modules M1–M6 in STi.pen.
testing
Extracts UI Screen Specs by analyzing Schema and Diagrams. Use when you need to bridge database logic and flow diagrams into intermediate UI component specifications for a given module. Trigger when user says "analyze UI for module X", "generate ui spec", "phân tích UI module", or invokes "ui-architecture-analyst --module M[X]".
development
Giải thích lỗi TypeScript một cách dễ hiểu bằng tiếng Việt. Sử dụng khi gặp lỗi type, generic, inference, hoặc bất kỳ lỗi TS nào cần được giải thích rõ ràng.
development
Skill phan tach yeu cau/tinh nang thanh cac phase, task va subtask cu the. Tao bo tai lieu planning clean, khong chua code mau, tap trung mo ta logic va nghiep vu. Su dung khi: (1) nhan yeu cau tinh nang moi can lap ke hoach, (2) co tai lieu nghien cuu can chuyen thanh task plan, (3) nguoi dung yeu cau phan tach cong viec, (4) can tao roadmap trien khai cho du an/tinh nang. Trigger: /task-planner, /plan-tasks, "phan tach task", "lap ke hoach", "tao plan", "chia phase".