agentleFS
aborroyaborroy/aiup-alfresco/skills/content-model-validator/SKILL.md

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.

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
  1. Very specific:

    Must contain <namespaces> with at least one <namespace> declaration

    line 18
  2. Very specific:

    If types are declared, they must be inside <types> element

    line 19
  3. Very specific:

    If aspects are declared, they must be inside <aspects> element

    line 20
  4. Very specific:

    Every <type> must have a name attribute in format {prefix}:typeName

    line 23
  5. Very specific:

    Every <type> should declare a <parent> (default: cm:content or cm:folder)

    line 24
  6. Very specific:

    Fix: Use <mandatory>true</mandatory> (no enforced attribute).

    line 34
  7. Very specific:

    Prefer <child-association> for composition (cascade delete) and <association> for peer references — flag a child association used where a …

    line 57
  8. Very specific:

    If a companion *-context.xml exists, verify it registers the model via <bean class="org.alfresco.repo.dictionary.DictionaryBootstrap"> or …

    line 61

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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> with name attribute 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 a name attribute in format {prefix}:typeName
  • Every <type> should declare a <parent> (default: cm:content or cm: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 the IntegrityChecker immediately inside OnAddAspectPolicy, which runs before NodeServiceImpl.addAspect() has written the properties map to the database. The result is a spurious IntegrityException: Mandatory property not set even when the caller passes a fully-populated properties map.
    • Fix: Use <mandatory>true</mandatory> (no enforced attribute). The integrity check is then deferred to beforeCommit, by which time addAspect() 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.

Constraint Validation

  • Each <constraint> must declare a name ({prefix}:{camelCaseConstraintName}) and a type.
  • For built-in constraint types, verify the required parameters are present:
    • LIST — must have an allowedValues <list> parameter with at least one <value>.
    • REGEX — must have an expression parameter; a requiresMatch parameter is recommended.
    • LENGTH — must have minLength and/or maxLength parameters.
    • MINMAX — must have minValue and/or maxValue parameters.
  • For a custom constraint, type is a fully-qualified class name; it should resolve to a class extending org.alfresco.repo.dictionary.constraint.AbstractConstraint. Flag a type that 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 a name ({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.xml exists, verify it registers the model via <bean class="org.alfresco.repo.dictionary.DictionaryBootstrap"> or equivalent
  • The models property 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.