Agent skill
schema-doc-sync
Update database schema documentation when Prisma schema changes. Use after modifying schema.prisma or when the user asks to sync database documentation.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/schema-doc-sync
SKILL.md
Schema Documentation Sync Skill
Purpose: Automatically update database schema documentation when Prisma schema changes. Maintains consistency between code and docs.
Trigger
When: After migration.skill completes OR prisma/schema.prisma is modified
Context Needed: Schema diff, affected tables, existing docs
MCP Tools: mcp_payment-syste_query_docs_by_type, read_file, replace_string_in_file
Schema → Doc Mapping
| Schema Model | Doc File | Module |
|---|---|---|
| User, Business, Role | 01-AUTH-SCHEMA.md | authentication |
| Merchant, Location | 02-BUSINESS-SCHEMA.md | business |
| Notification, Template | 03-COMMUNICATION-SCHEMA.md | communication |
| Product, Category, Stock | 04-INVENTORY-SCHEMA.md | inventory |
| Order, OrderItem, Cart | 05-SALES-SCHEMA.md | sales |
| Payment, Transaction | 06-PAYMENTS-SCHEMA.md | payments |
| Invoice, TaxConfig | 07-BILLING-SCHEMA.md | billing |
| Customer, Loyalty | 08-CRM-SCHEMA.md | crm |
| Metrics, Reports | 09-ANALYTICS-SCHEMA.md | analytics |
Update Process
- Detect changes - Parse schema diff
- Identify affected docs - Map models to schema docs
- Load existing docs - Read current content
- Update tables - Modify table definitions
- Update stats - Recalculate schema_stats
- Bump version - Increment patch version
- Update date - Set last_updated to today
- Update ER diagram - Modify FULL-ER-DIAGRAM.md
Table Format
### TableName
| Column | Type | Constraints | Description |
| :--------- | :------- | :---------------------- | :----------------- |
| id | String | PK, CUID | Unique identifier |
| createdAt | DateTime | NOT NULL, DEFAULT now() | Creation timestamp |
| name | String | NOT NULL | Display name |
| merchantId | String | FK → Merchant | Owner reference |
Frontmatter Updates
# Auto-update these fields
last_updated: "2026-01-26" # Today's date
version: "1.0.1" # Bump patch
# Recalculate these
schema_stats:
total_tables: 5 # Count models
total_columns: 45 # Count fields
total_indexes: 12 # Count @@index
ER Diagram Update
When models change, update PlantUML in FULL-ER-DIAGRAM.md:
' Add new entity
entity "NewModel" {
*id : String <<PK>>
--
createdAt : DateTime
name : String
}
' Add relation
NewModel ||--o{ OtherModel : has
Validation
After sync:
- Doc version incremented
- last_updated is today
- Table columns match schema
- Indexes documented
- Relations accurate
Reference
- 03-DATABASE-SCHEMA-TEMPLATE.md
- FULL-ER-DIAGRAM.md
- DATABASE-DESIGN.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?