chavangorakh1999/sde-skills/data-modeling
Claude Code and agent skill by chavangorakh1999/sde-skills
- community
Checking that the SKILL.md file is still in the repository.
Schema design, normalization levels, indexing strategy matched to access patterns. Use when designing database schemas, choosing between embed vs reference, or optimizing slow queries.
Install
npx vskill@latest install chavangorakh1999/sde-skills/data-modelingSKILL.md
The same SKILL.md was published earlier as chavangorakh1999/sde-skills/data-modeling.
Data Modeling
Design schemas that serve your access patterns efficiently. The right schema makes queries fast and simple. The wrong schema makes every query a workaround.
Context
Domain to model: $ARGUMENTS
Step 1: Identify Access Patterns First
Schema follows access patterns, not the other way around. List every query before writing a single table definition.
This list drives every schema decision. If a query isn't on the list, it's not shaping the schema.
Step 2: Relational (PostgreSQL / MySQL)
Normalization levels in practice:
- 1NF: Atomic values, no repeating groups. Enforce with proper column types.
- 2NF: No partial dependencies on composite key. Each column depends on the whole key.
- 3NF: No transitive dependencies. Each column depends only on the primary key.
- Denormalization: Intentionally break 3NF when join cost exceeds duplication cost. Always document why.
Step 3: Indexing Strategy
Indexes are fast reads at the cost of slower writes and storage. Create indexes for columns that appear in WHERE, JOIN ON, and ORDER BY.
Index selection rules:
- B-tree (default): equality and range queries, sorting
- GIN: full-text search, JSONB operators, array contains
- GiST: geographic data, range types
- BRIN: time-series data, naturally ordered (cheap, but less precise)
- Hash: equality only, no range — rarely better than B-tree in PostgreSQL
Composite index column order: put equality predicates first, range predicates last.
Step 4: MongoDB / Document Store
Decide between embedding and referencing based on access patterns and cardinality.
Embed when:
- Data is always accessed together (read together = store together)
- One-to-few relationship (< ~16 documents in the embedded array)
- Embedded data doesn't grow unboundedly
- No need to query embedded documents independently
Reference when:
- Data is queried independently
- One-to-many or many-to-many with large cardinality
- Embedded array would grow unboundedly
- Multiple parents reference the same child
Extended Reference Pattern (denormalize a subset of frequently-needed fields):
Step 5: Common Pitfalls
N+1 queries: Loading N posts then issuing N queries to get each author.
Missing updated_at: Always add updatedAt timestamps — invaluable for debugging, cache invalidation, and change data capture.
Storing passwords in plain text: Use bcrypt with work factor 12. Never store plaintext, never log passwords.
Unbounded arrays (MongoDB): An array that grows without limit will hit the 16MB BSON document limit. Use references instead of embedding when array size is unbounded.
Missing soft delete: Use deletedAt TIMESTAMPTZ instead of hard delete for auditable entities. Filter with WHERE deleted_at IS NULL.
Output Format
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsde-system-design/skills/data-modeling/SKILL.md
Popularity
- Repository stars
- 4
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chavangorakh1999/sde-skills/data-modeling)