data-modeling
应用 Firestore 数据建模和模式设计模式。在添加新集合、设计关系、优化索引、数据迁移时使用。包含适合 NoSQL 特性的非规范化策略。
📖 中文导读:应用 Firestore 数据建模和模式设计模式。在添加新集合、设计关系、优化索引、数据迁移时使用。包含适合 NoSQL 特性的非规范化策略。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: data-modeling description: Firestore 데이터 모델링과 스키마 설계 패턴을 적용합니다. 새 컬렉션 추가, 관계 설계, 인덱스 최적화, 데이터 마이그레이션 시 사용하세요. NoSQL 특성에 맞는 비정규화 전략을 포함합니다. allowed-tools: Read, Glob, Grep
Data Modeling Skill
Instructions
- Denormalize frequently accessed data (NoSQL has no joins)
- Use composite keys for unique relationships (e.g.,
${userId}_${projectId}) - Maintain counters on parent documents for read optimization
- Use soft delete for legal compliance
- Apply consistent timestamp patterns
Current Collections
firestore/
├── projects # Main content
├── users # User profiles
├── comments # Project comments
├── whispers # Private feedback
├── ai_usage # AI rate limiting
├── likes # User-project likes (composite key)
├── digests # Newsletter digests
└── subscriptions # Newsletter subscriptions
Key Patterns
// Denormalization: embed author info
const project = {
authorId: 'user123',
authorName: '홍길동', // Copied from user
}
// Composite Key: unique constraint
const likeId = `${userId}_${projectId}`
// Counter Pattern
await docRef.update({ likes: FieldValue.increment(1) })
For complete schemas, design patterns, and migration strategies, see reference.md.