/apache-cayenne-6:cayenne-model-namingfrom apache-cayenne-6
Polishes ObjEntity, ObjAttribute, ObjRelationship, and DbRelationship names in a Cayenne DataMap to idiomatic Java. Fixes run-together names, meaningless numbered names, and leaked entity prefixes without rewriting already-correct names.
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.
Polish the Object-layer names in a Cayenne DataMap so they look like idiomatic Java. This runs on top of the names CayenneModeler's reverse engineering already produced — which are good for the common case. Your job is a surgical touch-up of the few names its deterministic algorithm can't get right, not a rewrite. If a name is already a clean camelCase/PascalCase transliteration of its DB element with the right cardinality, leave it exactly as it is.
${CLAUDE_PLUGIN_ROOT}/references/model-naming-conventions.md — the deterministic baseline (what's
already correct and must be left alone) and the specific gaps where your judgment adds value.${CLAUDE_PLUGIN_ROOT}/references/model-naming-rename-safety.md — the cross-reference checklist for
every rename, so a rename never leaves a dangling reference.${CLAUDE_PLUGIN_ROOT}/references/datamap-schema.md — element shapes for *.map.xml.${CLAUDE_PLUGIN_ROOT}/references/project-layout.md — locate the project descriptor and DataMap.There are two modes, and picking the right one is the most important decision in this skill:
cayenne-db-import) — only
inspect the names on newly-added or just-modified elements. Everything else in the model was
presumably reviewed already; don't churn it.dbimport_run does not report which entities changed (it reports change counts though, so use it as an extra
hint), so detect the changed set with git. Run these from the repo containing the DataMap file:
# Is the DataMap under version control at all?
git -C <repo-dir> rev-parse --is-inside-work-tree
# What did the import change (unstaged), and did anything get staged already?
git -C <repo-dir> diff -- <path/to/datamap>.map.xml
git -C <repo-dir> diff --cached -- <path/to/datamap>.map.xml
From the diff, collect the added/modified <objEntity>, <objAttribute>, <objRelationship>, and
<dbRelationship> lines — that added/changed set is your scope. Notes:
git diff is empty but the file is tracked, there's nothing new to clean — say so and stop
(unless the user asked for an entire-model pass).HEAD), every element is effectively
"new" — treat it as an entire-model pass, but tell the user that's why.For each in-scope element, compare against model-naming-conventions.md. Most names will already be
correct — leave them. Flag only the cases the deterministic generator can't handle:
gametype → GameType, dateofbirth → dateOfBirth.
Split on a real word boundary you're confident about; never invent one.projects / projects1, people / people1) from more than one
relationship between the same two tables. The generator resolves the common cases itself: to-one
names are FK-based even without an _ID suffix (HOME_TEAM_ID → homeTeam, BIRTH_COUNTRY →
birthCountry), and to-many names pick up a FK role qualifier when the FK embeds the source
entity name, even one sans a common table prefix (HOME_TEAM_ID → homeGames; home_team_id
referencing aa_team → homeGames too). What still collides: to-many collections whose FK role is
unrelated to the entity name (MANAGER_ID / AUDITOR_ID → projects / projects1 — rename by
role: managedProjects / auditedProjects), and — in models imported by older Cayenne versions —
to-one ends whose FK columns lack an _ID suffix and collapsed to employee / employee1.AaCustomer, AaOrder), the prefix can leak into
relationship names. The generator already keeps it out of to-many names (the leading _-tokens
shared by the source and target table names are dropped → orders, not aaOrders); what leaks is
to-one names built from prefixed FK columns (AA_CUSTOMER_ID → aaCustomer) and to-many names in
models imported by older Cayenne versions (aaOrders). Strip the prefix from those relationship
names (customer, orders); a relationship is a role/property, and the prefix is noise there.
Leave the entity names alone — the prefix on classes is the user's choice, and renaming
entities regenerates classes.class / objectId are auto-qualified with the entity name by the generator, though older
imports may carry them raw), lost acronym casing, obvious cryptic abbreviations applied
consistently, plural-table-to-singular-entity. Conservative by default; when unsure, leave the
baseline name and ask.Relationship cleanup is anchored on the DbRelationship — it's the first-class citizen, since
every FK has one whether or not an ObjRelationship was generated on top. The rules above (run-together,
numbered collisions, prefix leak) apply to DbRelationship names directly, derived from their own DB
metadata (FK column for to-one, pluralized target DbEntity for to-many). When an ObjRelationship is
built on a DbRelationship, keep the two names in sync — rename both together, per direction.
DbRelationships with no ObjRelationship (an ungenerated reverse direction, a skipped FK, a hop inside
a flattened many-to-many) are cleaned the same way — don't skip them. Any rename must update every
dbRelationshipPath segment that names it (see Step 4).
Show the user a table of old → new grouped by entity, plus the mirrored DbRelationship renames, and
state plainly what you're leaving alone so it's clear this isn't a blanket rewrite.
If there are many domain abbreviations to expand, ask the user for a glossary rather than guessing.
Edit the *.map.xml. For every rename, walk the matching checklist in
model-naming-rename-safety.md and update all references in the same edit:
className, every objRelationship source/target, query rootName,
resultEntity.dbRelationshipPath is unaffected).dbAttributePath is unaffected).dbRelationshipPath segment that names it, including inside dotted
flattened chains. This holds whether or not the DbRelationship backs an ObjRelationship — a
standalone DbRelationship can still be named as a segment in another entity's flattened path.Keep every name unique within its scope, and preserve the file's existing formatting and element order.
source/target, rootName, dbRelationshipPath
segment, and className still resolve?cayenne-cgen to (re)generate the Java classes with the final names. Naming must
happen before cgen — if classes were already generated with the old names, point out the now-stale
.java files so the user can regenerate/delete them.git diff; default
to changed-only.gametype → GameType only when the boundary is real; don't
break single words (status, metadata).className, every reference, and regenerating — a
bare rename orphans the old class and dangles relationship source/target and query rootName.dbRelationshipPath segment, including
flattened chains on other entities.dbAttributePath / dbRelationshipPath targets. You rename the element; you
never change what a path points to.cayenne-cgen.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.Other plugins' skills for the same job