# AGENT.md & GEMINI.md Rule Template To ensure that any AI assistant working on the project strictly adheres to the database design process and never modifies the database without updating the MCD/MLD, add the following section to the project's root `AGENT.md` or `GEMINI.md` file (or `.agents/rules/db-modeling.md`). --- ## Copy-Paste Section for `AGENT.md` / `GEMINI.md` ```markdown ## Database Design & Modification Rules (MANDATORY) > [!IMPORTANT] > **YOU CANNOT PERFORM ANY DATABASE MODIFICATIONS WITHOUT USING THE `mcd-mld-designer` SKILL.** > > Direct editing of database tables, columns, migrations, or ORM models without first updating the documentation is strictly forbidden. ### 1. Source of Truth Files All database models are tracked and versioned in the following project files: - `db/mcd.md`: Conceptual Data Model (MCD) containing the Data Dictionary, Entities, Associations, and Mermaid Flowchart. - `db/mld.md`: Logical Data Model (MLD) containing Relational Schemas, Constraints, and Mermaid ER Diagram. ### 2. Pre-Modification Protocol Before creating a new table, adding/renaming a column, or altering a relationship: 1. Activate the `mcd-mld-designer` skill. 2. Read and analyze the current state in `db/mcd.md` and `db/mld.md`. 3. Update `db/mcd.md` (Entities, Attributes, Associations, Cardinalities). 4. Update `db/mld.md` (Relational Schemas, Foreign Keys, Types, Constraints). 5. Document the modification in the Changelog section of both files. 6. Only after steps 1-5 are completed may code, ORM models, or migration scripts be written. ### 3. Strict Naming Conventions - **Tables**: `<3_CHARS_DB>_` in UPPERCASE (e.g. `ECO_CUSTOMER`). - **Columns**: `<3_CHARS_TABLE>_` in UPPERCASE (e.g. `CUS_EMAIL`, `CUS_ID`). - **Foreign Keys**: `__` (e.g. in `ECO_ORDER`, FK referencing `ECO_CUSTOMER` is `ORD_CUS_ID`). - **Associative Tables**: Meaningful functional name (e.g. `ECO_ORDER_ITEM` with `ITE_ORD_ID`, `ITE_PRO_ID`, `ITE_QUANTITY`) or concatenated entity names. - **Casing**: UPPERCASE for all prefixes, table names, column names, and data types. ``` --- ## Alternative: Local Rule File (`.agents/rules/db-modeling.md`) If the project uses Antigravity directory-based rules, create `.agents/rules/db-modeling.md` with frontmatter: ```markdown --- description: Mandatory database design and modification rules using mcd-mld-designer trigger: always_on --- # Database Modification Enforcement Rule Whenever the user's prompt or task involves database tables, schema design, migrations, or ORM models: 1. Activate and follow the `mcd-mld-designer` skill. 2. Ensure all schema definitions exist and are maintained in `db/mcd.md` and `db/mld.md`. 3. Respect all naming conventions (_ and _) and UPPERCASE casing. ```