/apache-cayenne-6:cayenne-full-db-syncfrom apache-cayenne-6
Orchestrates three Apache Cayenne skills in sequence to sync an entire project with the database: imports schema metadata, polishes object-layer names, and regenerates Java entity classes.
Ships in apache-cayenne-6. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Bring an entire Cayenne project in line with the database in one pass. This skill is a thin orchestrator — it runs three existing skills in sequence and does not re-implement any of their logic:
cayenne-db-import — import DB schema metadata into the DataMap (the mapping XML).cayenne-model-naming — polish the Object-layer names of what the import just added.cayenne-cgen — regenerate the Java entity classes so the code matches the model.Each sub-skill still runs within its own scope and carries its own required reading, MCP tool usage, failure handling, and anti-patterns. Your job here is to drive them in order, pass the shared project/DataMap identity through, and short-circuit correctly when a stage has nothing to do.
cayenne-db-import.cayenne-cgen.cayenne-model-naming.If the request is ambiguous ("update from the DB"), default to this full sync — it is the common intent — but say what you're about to do (import → clean names → regenerate) before you start.
This skill delegates, so read each sub-skill and let it pull its own references:
${CLAUDE_PLUGIN_ROOT}/skills/cayenne-db-import/SKILL.md${CLAUDE_PLUGIN_ROOT}/skills/cayenne-model-naming/SKILL.md${CLAUDE_PLUGIN_ROOT}/skills/cayenne-cgen/SKILL.md${CLAUDE_PLUGIN_ROOT}/references/project-layout.md — to resolve the project descriptor and DataMap once, up front.All three stages operate on the same project. Resolve these before starting so you can pass them through:
projectPath — absolute path to the top-level project descriptor (cayenne-*.xml), via
project-layout.md. Not a DataMap file.dataMap — the DataMap name from <map name="..."> in the descriptor. If the project has
multiple DataMaps and the user wants "everything", run the whole pipeline once per DataMap. If
ambiguous, ask which DataMap; cache the answer.Tell the user the plan in one line: "I'll import from the DB, clean up the new names, then regenerate the classes."
cayenne-db-import)Follow the cayenne-db-import skill to run dbimport_run for the resolved project/DataMap. Because
you are orchestrating, you drive the follow-up here — do not act on that skill's own Step 5
hand-off prompts (it would suggest naming/cgen again); this skill sequences them instead.
Branch on the result status:
imported with a non-empty summary (entities/relationships added/modified) → the model
changed. Proceed to Step 2.up_to_date (or imported with an all-zero summary) → the mapping already matches the DB.
Skip Step 2 (nothing new to name). Go straight to Step 3 to guarantee the Java classes are in
sync — cgen_run is idempotent and simply reports everything skipped if the code is already
current. Tell the user the model was already up to date.validation_failed → follow cayenne-db-import's remediation table for the error.code. The
common first-run case is dbconnector_not_configured, which routes through the Modeler GUI to save
the connection; once resolved, re-run the import and continue the pipeline. If it can't be resolved,
stop and surface the problem — do not run naming or cgen on a failed import.error (partial/mid-run failure) → surface error.message and the partial summary, then stop.
Don't proceed to naming or cgen.cayenne-model-naming)Only when Step 1 imported real changes. Follow the cayenne-model-naming skill in its changed-only
mode — it scopes itself to the import's additions via git diff, so you don't tell it which entities
changed. Within this pipeline it runs unattended: apply the changed-scope renames and report
what changed; do not pause for per-rename confirmation. (Naming must run before cgen so the classes
are generated with the final names.)
Two carry-overs from that skill still hold: it only touches what the deterministic generator can't get
right (run-together names, team1-style collisions, a table prefix leaking into relationships), and
every rename updates its cross-references per model-naming-rename-safety.md.
cayenne-cgen)Follow the cayenne-cgen skill to run cgen_run for the same project/DataMap. This materializes the
Java entity classes from the now-final model. Report the summary counts and the destination as that
skill describes.
Give the user a single consolidated report of the three stages:
dbimport_run summary).Then the usual follow-ups: remind them not to edit the _<Entity>.java superclasses (regenerated),
and to save the project in the Modeler if it's open.
cayenne-db-import; classes-only →
cayenne-cgen; names-only → cayenne-model-naming. This skill is for the whole pipeline.validation_failed/error stops the
pipeline; up_to_date skips naming (but cgen may still run as an idempotent guarantee).mvn cayenne:cdbimport / cayenne:cgen or the Gradle tasks. The sub-skills use
the MCP tools exclusively; if the server isn't connected, they follow "When the MCP server is
unavailable" in mcp-tools.md and stop.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub apache/cayenne --plugin apache-cayenne-69 skills in this plugin
/cayenne-cgenUse this skill whenever the user wants to (re)generate Cayenne entity Java classes from a DataMap. Trigger on phrases like 'generate Java classes', 'regenerate entities', 'run cgen', 'create the entity classes', 'why is the Artist class missing fields', 'where did the `_Abstract*` classes come from', 'sync the entity classes with the model', or any request to materialize Java from the DataMap. Also trigger as a follow-up after modeling changes (someone added an entity, attribute, or relationship and now the Java side is stale). This skill exclusively uses the `cgen_run` MCP tool — it does NOT use `mvn cayenne:cgen` or the Gradle cgen task./cayenne-db-importUse this skill when the user wants to import database schema metadata into a Cayenne DataMap — the *model/mapping only*, not names or Java classes. Trigger on phrases like 'reverse engineer the database', 'import the schema', 'generate a DataMap from my DB', 'add the new tables from the DB into the model', 'import the customer table', 'create entities from these tables', or any request to read database metadata to populate or update a DataMap's XML. This is the only way the DB layer of the model (DbEntity, DbAttribute, DbRelationship) gets created or changed, whatever the size — a full schema, a batch of tables, or a single new table, column or FK. Hand-editing the DB layer in `cayenne-modeling` is allowed only when the user has explicitly said they do not use DB import; Object-layer edits (ObjEntity, ObjAttribute, ObjRelationship) always belong in `cayenne-modeling`. IMPORTANT — scope: this imports the mapping ONLY; it does not clean up the Object-layer names or (re)generate Java classes. When the user wants their whole project brought in line with the DB ('sync my project with the database', 'my schema changed, update everything', 'update my entities/classes from the DB'), that is the end-to-end `cayenne-full-db-sync` skill, which runs this import and then name cleanup and class generation. To regenerate classes alone use `cayenne-cgen`. The skill runs reverse engineering directly via the `dbimport_run` MCP tool when a DBConnector is already configured; otherwise it opens the CayenneModeler GUI via `open_project` to configure the connection first./cayenne-modelerUse this skill when the user explicitly wants to open CayenneModeler (the GUI) on a Cayenne project, or when the modeling task is one the Modeler has to do — first-time DB connection setup for reverse engineering (delegated to cayenne-db-import), bulk relationship layout, multi-entity visual refactoring. Trigger on phrases like 'open the Modeler', 'open in CayenneModeler', 'launch the GUI', 'edit visually', 'show me the project in the Modeler'. Do NOT trigger for upgrading a project saved by an older Cayenne version — that's the cayenne-upgrade skill. Do NOT trigger as a fallback for ordinary a-la-carte XML edits — those belong in the cayenne-modeling skill, which is faster and doesn't require the user to context-switch./cayenne-modelingUse this skill whenever the user wants to edit, inspect, or extend the Cayenne ORM model in a project — adding or modifying entities, attributes, relationships, embeddables, named queries, stored procedures, or DataNodes. Trigger on phrases like 'add an ObjEntity', 'add a DbEntity', 'add a relationship', 'expose this column as an attribute', 'create a new DataMap', 'add a named query', 'create an embeddable', 'add a stored procedure', 'change the attribute type', 'mark this column as nullable', 'rename this entity', or any mention of a Cayenne `*.map.xml` or `cayenne-*.xml` file. Also trigger when the user references modeling concepts (ObjEntity, DbEntity, ObjAttribute, DbAttribute, ObjRelationship, DbRelationship, Embeddable, dbEntityName, deleteRule, dbAttributePath, dbRelationshipPath, defaultPackage) in the context of a Cayenne-using app. This is the *primary* skill for a-la-carte ORM model manipulation — direct XML edits, not the Modeler GUI. IMPORTANT — DB layer ownership: the DB layer (DbEntity, DbAttribute, DbRelationship) is owned by DB import and is NOT hand-edited by this skill, unless the user has explicitly said they do not use DB import for this project. Otherwise a DB-layer request, even for a single table or column, is routed to `cayenne-db-import`; this skill hand-edits the Object layer, queries, embeddables and config blocks./cayenne-model-namingUse this skill to clean up Object-layer names in a Cayenne DataMap — ObjEntity, ObjAttribute, and ObjRelationship names, plus DbRelationship names (the first-class unit of relationship cleanup — every FK has one whether or not an ObjRelationship was generated; the ObjRelationship name is synced to it when one exists) — so they read as descriptive, consistent Java. Trigger on phrases like 'clean up the model names', 'fix the entity names', 'these names look ugly', 'make the names descriptive', 'normalize the ObjEntity/attribute/relationship names', 'why is this relationship called team1', 'rename entities to be consistent', 'the import produced Gametype instead of GameType'. Invoke it on an explicit user request, or as a manual follow-up after a `cayenne-db-import` to polish the just-imported additions — it is never triggered automatically. IMPORTANT: this is a LIGHT polish pass — CayenneModeler's reverse-engineering already produces good names for the common case; only improve the specific things its deterministic algorithm cannot (run-together names with no separators like `gametype`, meaningless numbered names like `team1` from multiple relationships between two tables, and a common entity prefix that leaks into relationship names like `aaOrders`). Do NOT rewrite names that are already correct. This is Obj-layer naming polish; for structural model edits use `cayenne-modeling`, and for regenerating classes afterward use `cayenne-cgen`./cayenne-queryUse this skill whenever the user wants to write or modify a Cayenne query — fetching entities by criteria, joining, prefetching to avoid N+1, ordering, paginating, aggregating, or running raw SQL through Cayenne. Trigger on phrases like 'query for X', 'fetch all artists where ...', 'write an ObjectSelect', 'use SQLQuery', 'add a prefetch', 'get distinct values', 'count rows', 'find by ID', 'load by primary key', 'build a Cayenne expression', 'why am I getting N+1', 'how do I paginate', 'select a single column', 'select columns into a DTO', 'named query in the DataMap'. Do NOT trigger for modeling changes (use cayenne-modeling) or runtime bootstrap (use cayenne-runtime).Other plugins' skills for the same job