Content model validator
Skill aborroy/aiup-alfresco/.cursor/skills/content-model-validator
A Claude Code plugin that packages Alfresco extension development as slash commands, skills, and agents
npx -y skills add aborroy/aiup-alfresco --skill content-model-validatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
4.2 KB, as published. Nobody here has run it
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.