DB Schema Designer
Overview
Turn product and backend requirements into review-ready database design briefs.
This skill stops at the database design stage. Its job is to help humans review and approve the data model before any Ent schema coding, entproto annotations, or project integration work begins.
Because approved designs will later be implemented in Ent and exposed through proto3 messages, this skill must reject or redesign field types that do not map cleanly to the Ent + proto3 constraint set.
Scope Boundary
Do:
- Extract entities, fields, relationships, constraints, statuses, and timestamps.
- Design table-level structure, key naming, nullability, uniqueness, indexing, and field-type compatibility.
- Surface assumptions, trade-offs, and open questions for review.
- Produce a review brief using the required output template.
Do not:
- Write Ent schema code unless the user explicitly asks for a follow-up implementation step.
- Add entproto numbering or Go integration instructions.
- Mix bind/render/service tasks into the review document.
If the design is approved and code should be written, hand off to ent-schema-implementer.
Required Reading
Read these files in order before producing a database design:
Workflow
Phase 1: Evidence and Extraction
- Gather inputs from prompt, docs, mockups, proto files, existing schemas, and service behavior.
- Extract candidate entities, lifecycle states, key timestamps, and business invariants.
- Record evidence conflicts and resolve them explicitly.
Phase 2: Database Design
- Design fields with type, requiredness, default behavior, uniqueness, and mutability.
- Apply the field-type policy from references/modeling-rules.md and redesign unsupported types before approval.
- Choose ID strategy and explain why.
- Design one-to-many and many-to-many relations.
- Build an index plan from list/filter/sort/query patterns.
- Decide deletion strategy, snapshot fields, and audit timestamps.
Phase 3: Review Packaging
- Mark assumptions explicitly as
Assumption:. - List unresolved questions and approval blockers clearly.
- Produce the final review brief using references/review-output-template.md.
Hard Gates
- The output must be understandable without showing Ent code.
- Every major table needs a business purpose, key fields, and lifecycle notes.
- Every proposed index must be tied to a real query pattern.
- Every field type must be checked against downstream Ent + proto3 compatibility before approval.
- If a type does not map cleanly, redesign it in the review output instead of deferring the problem to implementation.
- If the request is incomplete, stop at design options and blocking questions rather than forcing implementation details.
- If DDL is requested, provide it only as an optional appendix after the review brief, not as the primary artifact.
Output Requirements
Use the review template exactly:
- Keep section order unchanged.
- Write
N/Afor non-applicable sections. - Include a dedicated field-type compatibility section.
- Separate confirmed design decisions from open questions.
- Keep the document review-oriented rather than code-oriented.
Scan to join WeChat group