.agents/skills/gen-relationship/SKILL.md
Generate schema-backed relationship definitions for Meshery models between given components. This skill ensures that relationships are mathematically accurate, logically sound, and strictly compliant with the canonical v1beta1 relationship schema.
Invoke this skill when you need to define a new relationship between two or more components:
/gen-relationship Define a reference relationship between a Deployment and a PersistentVolumeClaim in the kubernetes model./gen-relationship Create a hierarchical parent-inventory relationship between a ServiceMesh and its ControlPlane.from) and target (to) components. Note their kind and the model they belong to.kind, type, and subType based on the desired interaction.selectors array with allow (and optionally deny) blocks.mutatorRef and mutatedRef as nested arrays of strings.v1beta1 schema structure rigorously.hierarchical: For parent-child or ownership interactions.edge: For peer-to-peer or connective interactions.sibling: For components that occupy the same logical level or group.Parent: Defines a strong hierarchical bond where the child belongs to the parent (child is usually discovered within the parent's inventory).Binding: Defines a functional connection between components.non-binding: Defines a logical or informational connection without functional enforcement.inventory: Hierarchical mapping of resources (e.g., used in Parent type).reference: Binding based on a property reference (e.g., a Deployment referencing a ConfigMap).network: Connectivity mapping (L3/L4/L7 interactions).permission: Authorization or access control mapping.wallet: Cloud billing or cost mapping.relationships.meshery.io/v1beta1allow: Contains from and to arrays of component selectors.deny: (Optional) Excludes specific components from the relationship.kind: The kind of the component (e.g., Deployment).model: The model name (e.g., kubernetes).patch: (Optional) Specifies how properties are mapping.mutatorRef: Source path, formatted as [["path", "to", "field"]].mutatedRef: Target path, formatted as [["path", "to", "field"]].[["settings", "name"]]) to pass upstream evaluation.metadata.capabilities.designer.edit: Must be true for a relationship to be editable in MeshMap.description: A clear, human-readable description of the relationship's purpose.Reasoning: The Deployment is the originator of the reference, containing the field that must match the source PVC. The PVC provides its identity (mutator) to the Deployment's volume configuration (mutated).
{
"schemaVersion": "relationships.meshery.io/v1beta1",
"kind": "edge",
"type": "non-binding",
"subType": "reference",
"metadata": {
"description": "Deployment referencing a PVC via claimName",
"capabilities": {
"designer": { "edit": true }
}
},
"selectors": [
{
"allow": {
"from": [
{
"kind": "Deployment",
"model": "kubernetes",
"patch": {
"mutatedRef": [["configuration", "spec", "template", "spec", "volumes", "0", "persistentVolumeClaim", "claimName"]]
}
}
],
"to": [
{
"kind": "PersistentVolumeClaim",
"model": "kubernetes",
"patch": {
"mutatorRef": [["configuration", "metadata", "name"]]
}
}
]
}
}
]
}
Reasoning: The Namespace is the authoritative parent defining the logical scope. It provides its name (mutator) to be injected into the namespace field of all child components (mutated).
{
"schemaVersion": "relationships.meshery.io/v1beta1",
"kind": "hierarchical",
"type": "parent",
"subType": "inventory",
"metadata": {
"description": "Namespace-level resource containment",
"capabilities": {
"designer": { "edit": true }
}
},
"selectors": [
{
"allow": {
"from": [
{
"kind": "Namespace",
"model": "kubernetes",
"patch": {
"mutatorRef": [["configuration", "metadata", "name"]]
}
}
],
"to": [
{
"kind": "*",
"model": "kubernetes",
"patch": {
"mutatedRef": [["configuration", "metadata", "namespace"]]
}
}
]
}
}
]
}
Reasoning: The Service is the originator of the network connection, defining selection criteria. It provides its selector labels (mutator) to match or be mirrored by the Deployment's pod labels (mutated).
{
"schemaVersion": "relationships.meshery.io/v1beta1",
"kind": "edge",
"type": "binding",
"subType": "network",
"metadata": {
"description": "Service targeting deployment pods",
"capabilities": {
"designer": { "edit": true }
}
},
"selectors": [
{
"allow": {
"from": [
{
"kind": "Service",
"model": "kubernetes",
"patch": {
"mutatorRef": [["configuration", "spec", "selector"]]
}
}
],
"to": [
{
"kind": "Deployment",
"model": "kubernetes",
"patch": {
"mutatedRef": [["configuration", "spec", "template", "metadata", "labels"]]
}
}
]
}
}
]
}
v1beta1 schema rules from meshery/schemas. Do not copy existing v1beta2 or older files blindly as they may contain legacy non-compliant structures.mutatorRef and mutatedRef paths correspond to the actual JSON schema of the components being linked.Kinds, Types, and subTypes that corresponds logically to the components being linked (e.g. inventory for Parent, network for Service connections).grep_search to find component definitions in server/meshmodel to verify valid paths for patch operations.