content-model-validator
Skill14 starsChanged 5 months agoApache-2.0View on GitHub
Validates Alfresco content model XML files for correct namespace URI format, mandatory type/aspect declarations, valid property data types, and absence of reserved prefixes (sys:, cm:, app:). Trigger automatically when generating or editing *-model*.xml or *-context.xml files.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/aiup-alfresco.mdcCursor rule
- aca-extensionSkill
- actionsSkill
- aikauSkill
- aiup-alfrescoSkill
- alfresco-architect-agentSkill
- alfresco-debugger-agentSkill
- alfresco-migrator-agentSkill
- audit-config-validatorSkill
- auditSkill
- behavioursSkill
- bootstrap-loaderSkill
- content-modelSkill
- content-model-validatorSkill
- content-storeSkill
- docker-compose-healthcheck-injectorSkill
- docker-composeSkill
- event-api-topology-checkerSkill
- eventsSkill
- metadata-extractorSkill
- migration-advisorSkill
- permission-aware-query-builderSkill
- permission-model-validatorSkill
- permissionsSkill
- repository-patchSkill
- requirementsSkill
- rest-apiSkill
- rest-api-validatorSkill
- rule-conditionsSkill
- scaffoldSkill
- scheduled-jobsSkill
- sdk-version-detectorSkill
- share-configSkill
- subsystemSkill
- surfSkill
- testSkill
- transformsSkill
- web-scriptsSkill
- workflow-bpmn-validatorSkill
- workflowSkill
- audit-config-validatorSkill
- docker-compose-healthcheck-injectorSkill
- event-api-topology-checkerSkill
- migration-advisorSkill
- permission-aware-query-builderSkill
- permission-model-validatorSkill
- rest-api-validatorSkill
- sdk-version-detectorSkill
- workflow-bpmn-validatorSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Must contain <namespaces> with at least one <namespace> declaration
- Very specific: line 19
If types are declared, they must be inside <types> element
- Very specific: line 20
If aspects are declared, they must be inside <aspects> element
- Very specific: line 23
Every <type> must have a name attribute in format {prefix}:typeName
- Very specific: line 24
Every <type> should declare a <parent> (default: cm:content or cm:folder)
- Very specific: line 34
Fix: Use <mandatory>true</mandatory> (no enforced attribute).
- Very specific: line 57
Prefer <child-association> for composition (cascade delete) and <association> for peer references — flag a child association used where a …
- Very specific: line 61
If a companion *-context.xml exists, verify it registers the model via <bean class="org.alfresco.repo.dictionary.DictionaryBootstrap"> or …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Content Model Validator
Validate the given Alfresco content model XML against these rules:
Namespace Validation
- Namespace URI must follow the pattern
http://www.{company}.com/model/{prefix}/{version} - Namespace prefix must not collide with reserved Alfresco prefixes:
sys,cm,app,usr,act,wcm,wca,lnk,fm,dl,ia,smf,imap,emailserver,bpm,wcmwf,trx,stcp - Prefix must be lowercase alphanumeric, 2-6 characters
Structure Validation
- Root element must be
<model>withnameattribute in format{prefix}:modelName - Must contain
<namespaces>with at least one<namespace>declaration - If types are declared, they must be inside
<types>element - If aspects are declared, they must be inside
<aspects>element
Type and Aspect Validation
- Every
<type>must have anameattribute in format{prefix}:typeName - Every
<type>should declare a<parent>(default:cm:contentorcm:folder) - Property names must use the model prefix:
{prefix}:propertyName - Property
<type>must be a valid Alfresco data type:d:text,d:mltext,d:int,d:long,d:float,d:double,d:date,d:datetime,d:boolean,d:noderef,d:content,d:any,d:category,d:qname,d:locale,d:period
Mandatory Property Enforcement
- FLAG as ERROR any property that uses
<mandatory enforced="true">true</mandatory>.- Why it breaks:
enforced="true"makes ACS fire theIntegrityCheckerimmediately insideOnAddAspectPolicy, which runs beforeNodeServiceImpl.addAspect()has written the properties map to the database. The result is a spuriousIntegrityException: Mandatory property not seteven when the caller passes a fully-populated properties map. - Fix: Use
<mandatory>true</mandatory>(noenforcedattribute). The integrity check is then deferred tobeforeCommit, by which timeaddAspect()has written both the aspect and its properties. - Exception:
enforced="true"is safe only on properties belonging to types (not aspects), where the property must be supplied at node creation time via the REST API and is never set programmatically after the fact.
- Why it breaks:
Constraint Validation
- Each
<constraint>must declare aname({prefix}:{camelCaseConstraintName}) and atype. - For built-in constraint types, verify the required parameters are present:
LIST— must have anallowedValues<list>parameter with at least one<value>.REGEX— must have anexpressionparameter; arequiresMatchparameter is recommended.LENGTH— must haveminLengthand/ormaxLengthparameters.MINMAX— must haveminValueand/ormaxValueparameters.
- For a custom constraint,
typeis a fully-qualified class name; it should resolve to a class extendingorg.alfresco.repo.dictionary.constraint.AbstractConstraint. Flag atypethat is neither a built-in keyword (LIST,REGEX,LENGTH,MINMAX) nor a resolvable class. - A property
<constraints><constraint ref="{prefix}:..."/></constraints>reference must point at a constraint defined in the same model (or an imported one).
Association Validation
<child-association>and<association>must declare aname({prefix}:...) and a<source>/<target>with a<class>; cardinality is expressed via<mandatory>and<many>.- Prefer
<child-association>for composition (cascade delete) and<association>for peer references — flag a child association used where a non-owning reference is intended.
Spring Context Validation
- If a companion
*-context.xmlexists, verify it registers the model via<bean class="org.alfresco.repo.dictionary.DictionaryBootstrap">or equivalent - The
modelsproperty must reference the correct model XML path
Output
Report all violations with file path, line number, rule violated, and suggested fix. If no violations found, confirm the model is valid.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

