Help us improve
Share bugs, ideas, or general feedback.
From apache-cayenne
Edits Cayenne ORM model XML files — DataMaps and project descriptors — to add or modify entities, attributes, relationships, embeddables, named queries, stored procedures, and DataNodes.
npx claudepluginhub apache/cayenne --plugin apache-cayenneHow this skill is triggered — by the user, by Claude, or both
Slash command
/apache-cayenne:cayenne-modelingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!--
Imports database schema metadata into a Cayenne DataMap by driving the CayenneModeler reverse-engineering wizard through MCP. For full-schema sync or bulk table import.
Generates ORM models, migrations, and relations for Prisma, TypeORM, Sequelize, SQLAlchemy, Django ORM, Drizzle from Postgres, MySQL schemas via introspection.
Designs a data model and generates paired forward/rollback SQL migrations in one pass, staged under docs/features/<slug>/migrations/. Stack-agnostic and follows the repo's own DB conventions. Useful during feature design before implementation begins.
Share bugs, ideas, or general feedback.
Edit Cayenne DataMap (*.map.xml) and project descriptor (cayenne-*.xml) files directly. This is the default path for granular model changes — adding one entity, one relationship, one query. Use the Modeler GUI (cayenne-modeler skill) only for inherently visual work like reverse engineering.
Read these before making any edit — they describe the XML formats this skill operates on:
${CLAUDE_PLUGIN_ROOT}/references/project-layout.md — locate the project descriptor and DataMaps in the user's repo.${CLAUDE_PLUGIN_ROOT}/references/datamap-schema.md — every element shape for *.map.xml.${CLAUDE_PLUGIN_ROOT}/references/project-descriptor-schema.md — cayenne-*.xml shape.Follow project-layout.md. If the user has multiple Cayenne projects and the request is ambiguous, ask which one. Cache the answer for the rest of the session.
Decide whether the change belongs in a DataMap or the project descriptor (table at the end of project-layout.md):
*.map.xml).cayenne-*.xml).Apply the change following the schema in datamap-schema.md or project-descriptor-schema.md.
Element order matters. The DataMap schema requires this order inside <data-map>: <property>, <procedure>, <embeddable>, <db-entity>, <obj-entity>, <db-relationship>, <obj-relationship>, <query>, <cgen>, <dbImport>. Insert at the right place — don't append blindly.
Cross-link consistently.
<obj-entity> references a <db-entity> by dbEntityName="...". Make sure that DbEntity exists.<obj-attribute> references a DbAttribute by db-attribute-path="COLUMN_NAME". Make sure that column exists on the DbEntity (or on a related one if using a dotted path through a relationship).<obj-relationship> requires a backing <db-relationship> (or chain of them) via db-relationship-path. Never add an ObjRelationship without the DB-layer counterpart.<db-relationship> entries, one per direction. They are not auto-derived.Use the right type on attributes.
db-attribute type — JDBC type names: VARCHAR, INTEGER, BIGINT, DATE, TIMESTAMP, BOOLEAN, NUMERIC, BLOB, CLOB, VARBINARY, etc. VARCHAR/CHAR/VARBINARY also need length. NUMERIC/DECIMAL also need scale.obj-attribute type — Java FQN: java.lang.String, java.lang.Integer, java.util.Date, java.math.BigDecimal, byte[], etc. Use wrapper types (Integer, not int) for nullable columns.PK handling. PK columns get isPrimaryKey="true" isMandatory="true" on the DbAttribute. They are normally not mirrored as ObjAttributes — Cayenne handles them implicitly. Map a PK as an ObjAttribute only if the user wants a "meaningful PK" (visible on the Java side).
Preserve formatting. Match the indentation and quote style of the file (the standard Cayenne style uses tabs and double quotes, but follow what's actually in the file you're editing).
After writing the XML, mentally walk through:
obj-entity.dbEntityName resolve to an existing <db-entity>?obj-attribute.db-attribute-path resolve to a column on the right DbEntity?obj-relationship.db-relationship-path resolve to a chain of existing <db-relationship> entries?isMandatory="true" where the DB enforces NOT NULL?If anything fails, fix it before reporting done.
<cgen> block: suggest invoking the cayenne-cgen skill to regenerate Java classes. Mention which entities are affected.cayenne-cgen.cayenne-reverse-engineer. Do not try to script this via XML edits.cayenne-modeler skill. Otherwise do not._<Entity>.java superclass files. They are regenerated by cgen and your changes will be overwritten. Edit the user <Entity>.java subclass instead.obj-relationship without a db-relationship. Cayenne will validate-fail at runtime.int, long, boolean) as obj-attribute type for nullable columns. Primitives can't represent NULL. Use wrappers.cayenne-cgen's job — invoke that skill instead of calling the MCP tool directly here.mvn cayenne:cdbimport or any Maven/Gradle plugin goal. Those are explicitly out of scope for this plugin.