Use when the user asks to create, write, generate, modify, update, fix, or validate an API Governance ruleset (Validation Profile). Covers governance rules for OpenAPI, RAML, AsyncAPI, MCP servers, Anypoint API instances, and API projects. Trigger phrases include "governance ruleset", "validation profile", "governance rule", "API conformance", "enforce policy", "create ruleset", "validate ruleset".
73
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Write valid Anypoint API Governance rulesets (Validation Profile 1.0 YAML) using the governance CLI tools for model discovery, validation, and simplification.
A governance ruleset is a YAML file that starts with #%Validation Profile 1.0 and declares validation rules against a domain model (API specs, API instances, MCP servers, etc.). Each rule targets a class, constrains its properties, and is assigned a severity (violation, warning, info).
This skill uses the anypoint-cli-v4 governance:ruleset CLI commands to discover the model, validate rulesets, and simplify output. Do NOT guess class names, property names, or constraint compatibility — always query the CLI.
Before running any governance CLI commands, force-install the latest governance plugin so the model, constraints, and validation logic match this skill. Version 1.0.20 or greater is required:
anypoint-cli-v4 plugins:install mulesoft-anypoint-cli-governance-plugin@latestRun this every time the skill starts, even if the plugin appears to already be installed — @latest guarantees a compatible version (1.0.20 or newer). Only proceed to the steps below once this completes successfully.
Parse the user request. Identify:
If the user uses domain language (e.g., "consumerUrl", "endpointUrl", "rate-limit policy"), resolve it:
anypoint-cli-v4 governance:ruleset:resolve <term>Aliases are author-time helpers ONLY — they must NEVER appear in the ruleset YAML. Use the canonical targetClass + path returned by the resolve command.
List available domains and match the user intent:
anypoint-cli-v4 governance:ruleset:domainsCritical rule: A single ruleset must target only ONE specKind. Never combine api-spec and mcp targets in the same ruleset. Domains without a specKind mix freely.
List the targetable classes for the chosen domain:
anypoint-cli-v4 governance:ruleset:classes --domain <domain-name>Then list properties and their types for the specific class:
anypoint-cli-v4 governance:ruleset:properties <prefix.ClassName>The property type (scalar, node, scalarArray, nodeArray) determines which constraints are valid.
Query valid constraints for the property type:
anypoint-cli-v4 governance:ruleset:constraints --type <propertyType>Where <propertyType> is one of: scalar, node, scalarArray, nodeArray.
Common mistakes to avoid:
pattern or in on a nodeArray or node propertyatLeast/atMost on nodeArray to check "at least one item matches X"containsSome on scalarArray to check "at least one value is X"in on scalarArray to restrict ALL values to an allowed set/ traverse nested nodes; the LAST property determines valid constraintsWrite valid Validation Profile 1.0 YAML to a file:
#%Validation Profile 1.0
profile: <profile-name>
prefixes: # Only needed for non-default namespaces
management: http://anypoint.com/vocabs/management#
validations:
<rule-name>:
targetClass: <prefix.ClassName>
message: <human-readable error message>
propertyConstraints:
<prefix.propertyName>:
<constraint>: <value>
violation: # MUST assign every rule to a severity
- <rule-name>
warning:
- <other-rule>
info:
- <another-rule>Default prefixes (do NOT redeclare these):
apiContract, core, shacl, shapes, raml-shapes, doc, meta, security, data, xsd, rdfs, rdf, sourcemapsNon-default prefixes (MUST declare in prefixes: block):
management: http://anypoint.com/vocabs/management#mulesoft: http://anypoint.com/vocabs/management#mulesoft.com/gcl: http://anypoint.com/vocabs/gcl#api: http://anypoint.com/vocabs/api#catalog: http://anypoint.com/vocabs/digital-repository#mcp: http://anypoint.com/vocabs/mcp#apiExt: http://a.ml/vocabularies/api-extension#After writing or modifying a ruleset, validate it with the CLI:
anypoint-cli-v4 governance:ruleset:validate-authoring <path-to-ruleset.yaml>This checks: YAML syntax, JSON schema conformance, targetClass validity, property path correctness, constraint-type compatibility, and severity assignments.
If validation returns errors, fix them and re-validate. Do NOT present a ruleset to the user until it passes validation with zero errors.
Once validation passes, simplify the ruleset:
anypoint-cli-v4 governance:ruleset:simplify <path-to-ruleset.yaml>This flattens nested property paths and removes redundant logical wrappers. If changes are made, write the simplified output back to the file and validate again.
Show the final validated and simplified ruleset to the user. Briefly explain:
#%Validation Profile 1.0 on line 1governance:ruleset:properties <class> to look them upgovernance:ruleset:constraints --type <type>governance:ruleset:validate-authoring after every write or modificationgovernance:ruleset:simplify after validation passes/ (space-slash-space) to separate segments| (space-pipe-space) between alternatives wrapped in ( )if: / then: at the validation leveland:, or:, not:, or xone: at the validation levelrego:) is a last resort for cross-resource checks — prefer declarative constraints"{{ prefix.property }}"governance:ruleset:domains — never claim something is unsupported without checkingmulesoft/mulesoft-dx
b8cef7d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.