{
  "id": "recipe.validate-and-repair",
  "goal": "Validate a diagram and repair issues using stable codes and hints.",
  "readFirst": [
    "/llm/validation.shape.json",
    "/llm/schema/wire-diagram.json"
  ],
  "preferredPath": [
    "Run validate through MCP, CLI, or wire-core.",
    "Treat error severity as blocking for save/share workflows.",
    "Match the issue code and apply the smallest canonical JSON repair.",
    "Run validate again after every repair pass.",
    "Continue only when no validation errors remain."
  ],
  "commonRepairs": [
    "schema.invalid_union_discriminator -> use supported lowercase node kinds.",
    "edge.from-missing -> add the source node or change the target node's from.",
    "edge.unknown-branch -> add the branch to the condition node or use a declared branch.",
    "node.forbidden-field -> move source/target/next/connectsTo intent into target from refs.",
    "group.child-parent-mismatch -> align group.children and child.parent."
  ],
  "mcpPath": [
    "validate({ diagramId })",
    "apply_actions({ diagramId, actions: repairs })",
    "validate({ diagramId })"
  ],
  "cliPath": [
    "wire validate <id>"
  ],
  "avoid": [
    "Do not ignore warnings that explain lost or stripped generated fields.",
    "Do not repair by converting to Mermaid.",
    "Do not render/share while errors remain."
  ]
}
