From apache-cayenne
Imports database schema metadata into a Cayenne DataMap (model/mapping only, not Java classes). Activates on requests to reverse engineer, import, or generate a DataMap from a database.
How this skill is triggered — by the user, by Claude, or both
Slash command
/apache-cayenne:cayenne-db-importThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!--
Import a database schema into a Cayenne DataMap using the mcp__cayenne__dbimport_run MCP tool. If a DBConnector is already stored in preferences for the DataMap the import runs directly without any GUI interaction. When the connection has not been configured yet, the workflow launches CayenneModeler and walks the user through the dialog once to save the connection, then re-runs dbimport_run.
${CLAUDE_PLUGIN_ROOT}/references/project-layout.md — locate or create the project descriptor.${CLAUDE_PLUGIN_ROOT}/references/dbimport-config.md — field semantics for every dialog screen, so you can explain options in user terms.${CLAUDE_PLUGIN_ROOT}/references/mcp-tools.md — dbimport_run and open_project tool references and failure modes.Ask the user (one question, only if not obvious from the request):
Follow project-layout.md to find the existing cayenne-*.xml. If none exists, the user is starting from scratch:
cayenne-modeling's patterns — namespace http://cayenne.apache.org/schema/12/domain, project-version="12", one empty <map name="..."/> plus a sibling empty *.map.xml), orThe descriptor path needs to be absolute when passed to the MCP tools.
dbimport_runCall the MCP tool:
mcp__cayenne__dbimport_run({ "projectPath": "<absolute path to cayenne-*.xml>", "dataMap": "<DataMap name>" })
If the tool is not available (server not registered), surface cayenne-mcp-server/README.md and stop. Do not suggest mvn cayenne:cdbimport or any Gradle equivalent — those build plugins are out of scope.
imported — success. Surface the summary counters (entities added/removed/modified, relationships added) to the user.up_to_date — the DataMap already matches the database. Tell the user nothing changed.error — import started but failed mid-run. Show the error.message and the partial summary.validation_failed — a pre-flight check failed. Use the error.code to guide next steps (see below).| Code | What failed | What to do |
|---|---|---|
project_not_found | Project path not readable | Verify path. |
project_parse_failed | File is not a valid Cayenne descriptor | Confirm the file is a cayenne-*.xml. |
datamap_not_found | DataMap name not in project | The error message lists available names; use one. |
dbconnector_not_configured | No connection saved for this DataMap | → Go to Step 4 to configure via the Modeler dialog. |
jdbc_driver_not_loadable | Driver jar not on the Modeler classpath | Open CayenneModeler → Preferences → Classpath, add the driver jar, save, then re-run. |
jdbc_connection_failed | Connection could not be opened | Check JDBC URL, credentials, and network access. |
This step is only needed when dbimport_run returns dbconnector_not_configured.
mcp__cayenne__open_project({ "projectPath": "<absolute path to cayenne-*.xml>" })
If open_project returns a non-ok status, surface the error code; common ones are modeler_not_found, project_not_found, handshake_timeout. Don't retry blindly — diagnose first.
The user now has the Modeler open. Give them the exact GUI sequence:
org.postgresql.DriverTABLE; add VIEW if needed.dbimport-config.md for what each does.skipPrimaryKeyLoading, skipRelationshipsLoading, etc.After the user saves, the DBConnector is written to CayenneModeler preferences.
dbimport_runGo back to Step 3 and call dbimport_run again. This time it should find the saved connection and proceed.
Once the import succeeds:
<dbImport> block inside the DataMap for repeat runs.cayenne-cgen to regenerate Java classes for the new/changed entities. Quote the DataMap name so the cgen skill can pass it to cgen_run.team1-style relationship names, a table prefix leaking into relationships), you can offer the cayenne-model-naming skill to polish them — ideally before cgen. Only run it if the user asks; do not invoke it automatically.mvn cayenne:cdbimport, the Gradle cdbimport task, or hand-running the cayenne-dbsync Java APIs. dbimport_run is the only supported execution path.forceDataMapCatalog / forceDataMapSchema defensively. They suppress legitimate DB metadata and cause hard-to-debug issues in multi-catalog setups.cayenne-mcp-server/README.md and stop.dbimport_run is available — the GUI path is only for the first-time connection setup.npx claudepluginhub apache/cayenne --plugin apache-cayenneOrchestrates three Cayenne skills (db-import, model-naming, cgen) to sync the entire project — mapping, names, and Java classes — with the database in one pass.
Generates data models and staged, shippable SQL forward/rollback migrations from feature specs. Stack-agnostic, follows repo conventions.
Generates data model documentation including tables, constraints, indexes, retention policies, and migration notes from entities or PRD references.