infrahub-managing-schemas

Creates, validates, and modifies Infrahub schema YAML files defining nodes, generics, attributes, and relationships.

9|2|Updated Aug 27, 2025
One-click install
npx skills add https://github.com/opsmill/infrahub-solution-ai-dc --skill infrahub-managing-schemas-opsmill
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: infrahub-managing-schemas
Source: https://github.com/opsmill/infrahub-solution-ai-dc/tree/main/.agents/skills/infrahub-managing-schemas
Command: npx skills add https://github.com/opsmill/infrahub-solution-ai-dc --skill infrahub-managing-schemas-opsmill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Designing Infrahub schemas by hand is error-prone: naming pattern violations, mismatched relationship identifiers, missing human_friendly_id values, and mandatory-by-default attributes all cause validation failures or silent data-model bugs that surface only after data is loaded. ## Core Features & Use Cases - Schema Authoring Guidance: Step-by-step workflow for building schema YAML with generics, nodes, extensions, dropdowns, computed Jinja2 attributes, and hierarchical location trees. - Rule Library by Category: Prioritized rules covering naming conventions, Component/Parent relationship pairing, display properties, uniqueness constraints, migrations with state: absent, and branch-first rollout. - Validation & Migration Support: infrahubctl schema check/load commands, common error explanations, and a pre-validation checklist. - Use Case: You need to model a new DCIM domain with devices, racks, and module bays. The skill walks you through defining the generics, wiring bidirectional relationships with matching identifiers, setting human_friendly_id, and loading the schema on a dedicated branch. ## Quick Start Ask the assistant to create an Infrahub schema for a given namespace and node names, for example by invoking the skill with arguments like a namespace followed by the node names you want modeled.

Frequently Asked Questions about infrahub-managing-schemas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an Infrahub schema YAML file?▼

Start with the $schema comment and version: "1.0", then define generics first followed by nodes. Apply PascalCase node names, snake_case attributes, and run infrahubctl schema check against a running server before loading on a dedicated branch.

How do I set up bidirectional relationships in Infrahub schemas?▼

Define both sides with a matching identifier field, pairing kind: Component on the parent with kind: Parent on the child. The child side should use cardinality: one with optional: false, and peer values must use the full kind including namespace.

Why does my Infrahub schema fail validation with naming errors?▼

Infrahub enforces strict regex patterns: node names must be PascalCase, namespaces start uppercase with lowercase rest, and attribute or relationship names must be snake_case. Typos in property names also fail because the JSON schema disallows additional properties.

Should I load Infrahub schema changes on the main branch?▼

No, on any shared server load schemas onto a dedicated branch using infrahubctl branch create and schema load --branch. A schema load runs migrations against loaded data immediately, so the default branch gives no preview or undo; merge via a proposed change after validation.

How do I remove or rename an attribute in an existing Infrahub schema?▼

Mark the attribute with state: absent to remove it during the next schema load. For renames, add the new attribute as optional first, migrate the data, then remove the old attribute with state: absent.

When should a node inherit from CoreArtifactTarget or CoreFileObject?▼

Add CoreArtifactTarget to concrete nodes that artifact or generator definitions target, and CoreFileObject to nodes that store uploaded files like PDFs or images. Apply these at design time since adding them later forces a migration on already-loaded data.