一键导入
generate-doclific-erd-json
Generate JSON for ERD (Entity Relationship Diagram) components. Use when creating database schema diagrams in Doclific documentation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate JSON for ERD (Entity Relationship Diagram) components. Use when creating database schema diagrams in Doclific documentation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate MDX for HttpRequest components. Use when creating API request documentation in Doclific that allows users to make live HTTP requests.
Write MDX documentation for Doclific. Finds documents by title and writes to content.mdx with CodebaseSnippet and ERD components.
Create a new Doclific document. Navigates the doclific directory structure, selects an appropriate icon, and creates the document using insert-doc.js.
| name | generate-doclific-erd-json |
| description | Generate JSON for ERD (Entity Relationship Diagram) components. Use when creating database schema diagrams in Doclific documentation. |
This skill helps you generate the JSON for ERD (Entity Relationship Diagram) components in Doclific MDX documentation.
When the user asks you to create an ERD diagram:
Gather requirements: Ask the user about their database schema - tables, columns, and relationships.
Generate the JSON: Create properly formatted JSON for the tables and relationships attributes.
Output the MDX: Provide the complete <ERD> component with the generated JSON.
<ERD tables="[JSON array of tables]" relationships="[JSON array of relationships]"></ERD>
Each table object must have:
{
"id": "unique-table-id",
"type": "tableNode",
"data": {
"name": "table_name",
"columns": [
{
"name": "column_name",
"dataType": "varchar",
"isPrimaryKey": false,
"isNullable": true
}
]
},
"position": {
"x": 50,
"y": 50
}
}
Table fields:
id (string): Unique identifier for the table (e.g., "t1", "users-table")type (string): The type of node, must be "tableNode"data (object): The data for the tabledata.name (string): The actual table name in the databasedata.columns (array): Array of column definitionsposition (object): The position of the tableposition.x (number): Horizontal position for diagram layout (start at 50, increment by 300 for each table), maximum 1000, minimum -1000position.y (number): Vertical position for diagram layout (typically 50-100), maximum 1000, minimum -1000Each column object must have:
{
"name": "column_name",
"type": "varchar",
"primaryKey": false,
"nullable": true
}
Column fields:
id (string): Unique identifier for the column (e.g., "c1", "users-id")name (string): The column nametype (string): PostgreSQL data type (see list below)primaryKey (boolean): true if this is the primary keynullable (boolean): true if the column allows NULL valuesSupported data types:
smallint, integer, bigint, decimal, numeric, real, double precision, smallserial, serial, bigserialmoneychar, varchar, textbyteadate, time, timetz, timestamp, timestamptz, intervalbooleaninet, cidr, macaddr, macaddr8bit, bit varyinguuidjson, jsonbarrayEach relationship object must have:
{
"table1": "table-name",
"column1": "column-name",
"table2": "table-name",
"column2": "column-name",
"cardinality": "1:N"
}
Relationship fields:
table1 (string): Name of the source table (the "one" side)column1 (string): Name of the source column (usually the primary key)table2 (string): Name of the target table (the "many" side)column2 (string): Name of the target column (the foreign key)cardinality (string): Cardinality of the relationship (one of "1:1", "1:N", "N:N", "N:1")See the example.json file in this directory for a complete example.
tables and relationships arrays in the format described abovevalidate-and-encode.js script with the temporary file path as an argument:
node skills/generate-doclific-erd-json/validate-and-encode.js <temp-file-path>
The script will:
tables and relationships JSON arraystables and relationships properties containing the encoded stringstables and relationships props in the <ERD> component:
<ERD tables="{encoded_tables_string}" relationships="{encoded_relationships_string}"></ERD>