From infrahub
Creates, validates, and modifies Infrahub schema YAML files — nodes, generics, attributes, relationships, and extensions. Use when designing data models, validating schemas, or planning migrations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/infrahub:infrahub-managing-schemas [namespace] [node-names...][namespace] [node-names...]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert guidance for designing and building Infrahub
examples.mdreference.mdrules/_sections.mdrules/_template.mdrules/attribute-branch-agnostic.mdrules/attribute-computed-jinja2.mdrules/attribute-defaults-and-types.mdrules/display-human-friendly-id.mdrules/display-menu-placement.mdrules/display-order-weight.mdrules/extension-artifact-target.mdrules/extension-cross-file.mdrules/extension-file-object.mdrules/extension-object-template.mdrules/hierarchy-setup.mdrules/migration-state-absent.mdrules/naming-conventions.mdrules/relationship-component-parent.mdrules/relationship-defaults.mdrules/relationship-identifiers.mdExpert guidance for designing and building Infrahub schemas. Schemas are YAML files defining nodes (concrete types), generics (abstract base types), attributes, relationships, and extensions.
Existing schemas in this project:
!find . -name "*.yml" -path "*/schemas/*" -o -name "*schema*" -name "*.yml" 2>/dev/null | head -20
Infrahub config (if present):
!cat .infrahub.yml 2>/dev/null || echo "No .infrahub.yml found"
If invoked with arguments (e.g., /infrahub:managing-schemas Ipam Vlan VlanGroup),
use the first argument as the namespace and remaining arguments as node names.
| Priority | Category | Prefix | Description |
|---|---|---|---|
| CRITICAL | Branch-First Changes | workflow- | Load schema onto a branch, not the default branch |
| CRITICAL | Naming | naming- | Namespace, node, attribute naming |
| CRITICAL | Relationships | relationship- | IDs, peers, component/parent, on_delete |
| HIGH | Attributes | attribute- | Defaults, dropdowns, computed Jinja2, branch-agnostic, deprecated |
| HIGH | Hierarchy | hierarchy- | Hierarchical generics, parent/children |
| HIGH | Display | display- | human_friendly_id, order_weight, menu placement |
| MEDIUM | Extensions | extension- | Cross-file via extensions block, artifact targets |
| MEDIUM | Uniqueness | uniqueness- | Constraint format, __value suffix |
| MEDIUM | Migration | migration- | Add/remove attributes, state: absent |
| HIGH | Validation | validation- | Load-time string-length caps (description / label / identifier), common error messages, pre-check checklist |
---
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
version: "1.0"
generics: # Abstract base definitions (shared attributes/relationships)
- ...
nodes: # Concrete object types
- ...
extensions: # Add attributes/relationships to existing nodes from other files
nodes:
- ...
Always include the $schema comment for IDE validation.
Only version is required at the top level.
A schema node rarely lives alone. Before finalizing it, walk through how it will be used by other parts of the project and add the inheritance / configuration that those features require:
| If the node will... | Add to the schema | See |
|---|---|---|
Be the target of an artifact (group member referenced by an artifact_definition) | inherit_from: [..., CoreArtifactTarget] on the concrete node | rules/extension-artifact-target.md |
Be the target of a generator (group member referenced by a generator_definition) | inherit_from: [..., CoreArtifactTarget] on the concrete node | rules/extension-artifact-target.md |
| Appear in a custom sidebar menu | include_in_menu: false so the auto-menu doesn't duplicate the manual entry | ../infrahub-managing-menus/rules/schema-integration.md |
| Be cloneable as an object template | generate_template: true | rules/extension-object-template.md |
| Store an uploaded file (PDF, image, Visio, KMZ, contract, …) | inherit_from: [..., CoreFileObject] on the concrete node | rules/extension-file-object.md |
| Be displayed with a stable name across UI lists and APIs | human_friendly_id and display_label | rules/display-human-friendly-id.md |
This audit is the difference between a schema that "validates" and one that "actually works in the broader project." Skipping it forces a schema migration once the downstream feature is wired up — at which point the data is already loaded.
When the task spans multiple skills (schemas + transforms, schemas + menus, etc.), load both skills' rules together rather than treating the boundaries as exclusive.
Follow these steps when creating or modifying a schema:
$schema
comment and version: "1.0". Define generics first
(if any), then nodes. Apply naming, display, and
relationship rules from step 2.CoreArtifactTarget to its inherit_from now, per
rules/extension-artifact-target.md.
Adding it later forces a schema migration on loaded data.human_friendly_id, display_label, and
order_weight per
rules/display-human-friendly-id.md
and rules/display-order-weight.md.infrahubctl schema check to fix errors per
validation.md and
rules/validation-common-errors.md.
Then apply the change on a dedicated branch, not the
default branch (main by convention, but it can be
renamed): infrahubctl branch create <name> →
schema check --branch <name> →
schema load --branch <name>, and merge via a proposed
change once it looks right. A schema load runs
migrations against loaded data immediately, so on a
shared server the default branch gives no preview and no
per-step undo — the branch does. See
rules/workflow-branch-first.md.
The default branch is only reasonable on a local
throwaway instance.Seven recurring patterns — computed Jinja2 attributes, cascade-vs-no-action deletes, menu visibility, branch-agnostic identity, artifact targets, object templates, and file objects — are documented at the top of examples.md. Read those before finalizing a schema; each pattern is easy to miss when building from scratch and expensive to retrofit after data is loaded.
infrahubctl
commands, migration strategies, pre-validation checklistnpx claudepluginhub opsmill/claude-marketplace --plugin infrahubCreates and manages Infrahub object data YAML files for populating infrastructure instances including devices, locations, organizations, and modules.
Creates rigorous, validated models of entities, relationships, and constraints for database schemas, knowledge graphs, ontologies, API data models, and taxonomies. Covers relational, document, graph, event/time-series, and dimensional patterns with lifecycle modeling, soft deletes, polymorphic associations, and hierarchies.
Guides GraphQL schema design with best practices for types, nullability, pagination, errors, and security. Use when designing or reviewing schemas.