Validate Prisma schema against requirements specification (read-only)
Validate that Prisma schema matches the requirements specification. This skill only checks for discrepancies - it does NOT modify any files.
Compare requirements documents with Prisma schema and report:
┌─────────────────────────────────────┐
│ Step 1: Read Requirements │
│ /docs/analysis/*.md │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 2: Read Prisma Schema │
│ /prisma/schema/*.prisma │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Step 3: Compare & Report │
│ - Missing tables │
│ - Missing columns │
│ - Type mismatches │
│ - Relationship issues │
└─────────────────────────────────────┘
find docs/analysis -name "*.md" -type f
Extract from each document:
find prisma/schema -name "*.prisma" -type f
Extract from schema:
For each entity in requirements:
For each required field:
For each relationship:
{prefix}_{entities} patternBoolean fields:
is_ prefix (e.g., is_active, is_public)is_ prefix (e.g., active → is_active)Field name consistency:
expires_at in one table, expired_at in another)*_at timestamps, *_id foreign keys, status fieldsCompare with requirements to identify unnecessary tables:
Duplicate tables:
Unnecessary snapshot/history tables:
# Validation Report: Database Schema
## Summary
- Total entities in requirements: X
- Entities found in schema: Y
- Missing entities: Z
## ✅ Valid Items
- [Entity] `users` - All fields match
- [Entity] `posts` - All fields match
## ❌ Issues Found
- [Missing Entity] `comments` - Defined in requirements but not in schema
- [Missing Field] `users.phone` - Required but not defined
- [Type Mismatch] `posts.view_count` - Expected Int, found String
- [Naming] `users.active` - Boolean field should be `is_active`
- [Naming] `sessions.expired_at` - Inconsistent with `tokens.expires_at`
- [Unnecessary Table] `post_snapshots` - Requirements say posts are directly editable
## ⚠️ Warnings
- [Nullable] `users.bio` - Requirements say required, schema allows null
- [Index] `posts` - Consider adding index on `created_at`
- [Duplicate] `user_profiles` and `users` - May have overlapping responsibilities
## Recommendation
Run `/fix-db` to fix the issues above.
This skill is READ-ONLY.
To fix issues, use /fix-db skill.