moai-domain-db-docs

Parses database migration files and synchronizes schema, ERD, and migration documentation.

2|Updated May 27, 2026
One-click install
npx skills add https://github.com/yekinya/moai-novel --skill moai-domain-db-docs-yekinya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-domain-db-docs
Source: https://github.com/yekinya/moai-novel/tree/main/moai-novel/.claude/skills/moai-domain-db-docs
Command: npx skills add https://github.com/yekinya/moai-novel --skill moai-domain-db-docs-yekinya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Database documentation drifts out of sync with actual migrations as schemas evolve. This Skill parses migration files (Prisma, Alembic, Rails, raw SQL) and keeps schema.md, erd.mmd, and migrations.md continuously updated, with drift detection to catch discrepancies. ## Core Features & Use Cases - Proposal-Based Sync: Consumes a parsed migration proposal and updates schema.md in place, regenerates the Mermaid erDiagram, and appends checksummed entries to migrations.md. - Drift Verification: The /moai db verify mode compares tables found in migration files against documented tables and reports a unified diff of any drift. - Full Rebuild: The /moai db refresh mode rescans all migration files and rebuilds all three documentation files from scratch after user confirmation. - Use Case: After applying a new Alembic migration, the PostToolUse hook proposes a schema update; approving it updates the schema registry, ERD diagram, and migration log automatically. ## Quick Start Ask the assistant to run /moai db verify to check whether the schema documentation matches the current migration files.

Frequently Asked Questions about moai-domain-db-docs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep database schema documentation in sync with migrations?

Run /moai db refresh to rebuild schema.md, erd.mmd, and migrations.md from all migration files, or let the PostToolUse hook propose incremental updates after each migration change. The skill parses Prisma, Alembic, Rails, and raw SQL migration files.

How to detect drift between migrations and schema documentation?

Use /moai db verify, which scans migration files for CREATE TABLE statements, compares them against the tables documented in schema.md, and prints a unified diff of any added or missing tables. It exits 0 when in sync and 1 when drift is found.

Which migration formats are supported for schema parsing?

The skill supports Prisma, Alembic, Rails, and raw SQL migration files. Migration file discovery is driven by patterns configured in db.yaml under migration_patterns.

Does the schema sync overwrite my manual edits to schema.md?

No. In-place updates preserve user-edited descriptions and _TBD_ markers, only updating column counts and last migration file references. The ERD comment header is also preserved verbatim during regeneration.

What happens if ERD generation or checksum computation fails?

Failures are non-blocking: a minimal valid erDiagram is written and the error is logged to .moai/logs/db-sync-errors.log, while failed SHA-256 computations fall back to an 'unknown' checksum value.