skillfed

database-fundamentals

Database Fundamentals guides code review of schemas, queries, and migrations across SQL and NoSQL systems. It surfaces common pitfalls like N+1 queries, missing indexes, and unsafe string concatenation, while providing checklists for normalization, data types, and reversible migrations.

Database Fundamentals reviews schema design, queries, and migrations to catch normalization issues, missing indexes, and N+1 problems.

AI-generated summary based on this skill's SKILL.md

265 17 MIT updated by DanielPodolsky

Install

DanielPodolsky/ownyourcode/database · repository language: Shell

git clone https://github.com/DanielPodolsky/ownyourcode
cp -r ownyourcode/.claude/skills/fundamentals/database ~/.claude/skills/database
npx skillfed install DanielPodolsky/ownyourcode/database

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What does database-fundamentals cover in schema review?

Database Fundamentals guides you through schema design review by checking normalization, primary and foreign keys, and data types. It helps ensure your tables follow proper structure, relationships are correctly defined, and columns use appropriate types for their data. This foundation prevents future scaling issues and data integrity problems.

How can I avoid N+1 queries in my application?

Database Fundamentals identifies N+1 query problems by analyzing how your code fetches related data. Common solutions include eager loading (fetching all related records upfront), batch queries, or restructuring your ORM calls. The skill helps you spot where loops trigger repeated queries and recommends fixes for Prisma, MongoDB, and other ORMs.

What is SQL injection prevention with parameterized queries?

Database Fundamentals teaches SQL injection prevention by enforcing parameterized queries—separating SQL code from user input so attackers cannot manipulate your statements. It flags unsafe string concatenation and shows how to use placeholders and bound parameters. This is critical for any application accepting user data.

What database indexing strategy should I use for my queries?

Database Fundamentals evaluates your index strategy by analyzing query patterns and recommending where indexes help most. It covers single-column indexes, composite indexes for multi-column queries, and when indexing hurts write performance. Proper indexing dramatically improves SELECT speed without changing your code.

How do I ensure database migrations are reversible and safe?

Database Fundamentals checks that your migrations are reversible and prevent data loss. It verifies up/down steps are paired, destructive changes are avoided or backed up, and rollback paths exist. Safe migrations let you deploy confidently and recover quickly if issues arise in production.

What are common database anti-patterns and mistakes to avoid?

Database Fundamentals surfaces anti-patterns like SELECT *, missing foreign keys, denormalization without justification, and pagination without indexes on large datasets. It provides a junior developer guide to schema design, helping you recognize pitfalls early and follow best practices for normalization, eager/lazy loading, and EXPLAIN analysis.

SKILL.md

rendered from the published skill — quoted content, verbatim

Database Fundamentals Review

> "Your database is the foundation. Build it wrong, and everything above it will crack."

When to Apply

Activate this skill when reviewing: - Schema design and migrations - SQL/NoSQL queries - ORM model definitions - Data relationships - Index creation - Query performance


Review Checklist

Schema Design
  • [ ] Normalization: Is data normalized appropriately (no excessive duplication)?
  • [ ] Denormalization justified: If denormalized, is there a performance reason?
  • [ ] Primary keys: Does every table have a clear primary key?
  • [ ] Foreign keys: Are relationships enforced at the database level?
  • [ ] Data types: Are appropriate types used (not everything TEXT)?
Indexes
  • [ ] Query-based: Are indexes created for frequently queried columns?
  • [ ] Composite indexes: Are multi-column queries covered?
  • [ ] Not over-indexed: Are there unnecessary indexes

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
.claude/skills/fundamentals/database/SKILL.md

Related skills

Tags

query-optimization data-integrity performance-tuning schema-design sql-safety orm-patterns migration-strategy indexing-tactics normalization-rules code-review