/infrahub:infrahub-managing-schemas [namespace] [node-names...]from infrahub
Creates, validates, formats, and modifies Infrahub schema YAML files including nodes, generics, attributes, relationships, and extensions. Also checks the Infrahub Marketplace for reusable schemas.
Ships in infrahub. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Expert guidance for designing and building Infrahub schemas. Schemas are YAML files defining nodes (concrete types), generics (abstract base types), attributes, relationships, and extensions.
Before changing a schema, look at the project with read-only tools:
.yml or .yaml files under a
schemas/ directory, or with schema in the name..infrahub.yml if it exists.These steps contact the Infrahub server, so they come after the read-only look at the project:
infrahubctl command, detect the
project's Python environment as
../infrahub-common/rules/connectivity-python-environment.md
describes.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, order_by, menu placement |
| MEDIUM | Extensions | extension- | Cross-file via extensions block, artifact targets |
| HIGH | Uniqueness | uniqueness- | Constraint format, mandatory relationships, and scope; generic vs concrete kind |
| MEDIUM | Migration | migration- | Add/remove attributes, state: absent |
| MEDIUM | File Formatting | format- | Canonical key order; infrahubctl schema format (offline) |
| HIGH | Validation | validation- | Load-time string-length caps (description / label / identifier), common error messages, pre-check checklist |
| HIGH | Reuse | reuse- | Check the marketplace before modelling; verify a kind exists before referencing it; adopt per generic, not per file |
| HIGH | Generic Membership | generic- | A generic's implementer set is an interface: joining one changes every query, constraint and consumer over it |
---
# 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 (node + its component children) | generate_template: true | rules/extension-object-template.md |
| Provide shared default values across many instances | generate_profile: true (+ Profile instances) | rules/extension-object-profile.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.
A schema choice can remove the need for Python or denormalized data downstream. The schema is the cheapest place to get this right — fixing it later means a migration on already-loaded data. Before adding a field or node, check whether a built-in or structural feature already covers it:
| Signal | Cheaper layer | See rule |
|---|---|---|
| Building any domain from scratch (the marketplace publishes far more than DCIM / location / org — routing, security, compute, and many more) | Search the whole marketplace and reuse a published schema: infrahubctl marketplace get <ns>/<name> then inherit_from. Adoption is a dependency, not a freebie: confirm the kind's tier and record provenance | yagni-reuse-existing-marketplace-schema, reuse-verify-kind-availability, reuse-evaluate-per-generic |
Copying a value onto a node that's reachable by traversing a relationship (region_code when device.location.region.code exists) | An indirect relationship traversal; let consumers follow the link | yagni-denormalized-vs-indirect-relationship |
| Several sibling nodes repeating the same attributes and relationships | Extract a generic and inherit_from it | yagni-duplicate-shape-not-extracted-to-generic |
| Defining custom IP address / prefix nodes | inherit_from the built-in primitive (BuiltinIPAddress, BuiltinIPPrefix). A VLAN primitive is marketplace-published, not core, so confirm it before peering it | yagni-custom-domain-primitives-instead-of-builtin, reuse-verify-kind-availability |
An Attribute + cardinality: one relationship with no inverse on the peer | Declare the matching inverse so consumers filter in the query, not in Python | yagni-missing-inverse-forces-python-filter |
| A Profile carrying a single value that never varies across objects | An attribute default_value — a Profile only earns its cost when values vary or are re-tuned centrally | yagni-profile-over-default |
| Reaching for an Object Template to share live values, or a Profile to clone a node's child components | Match the tool to intent: a Profile shares live values, an Object Template clones structure | yagni-template-profile-confusion |
Enabling generate_profile / generate_template before any Profile or template will use it | Enable the flag when the defaults/cloning workflow actually exists | yagni-unused-generate-flag |
These are the schema-side counterparts to the "Before writing Python" guidance in the checks, transforms, and generators skills. The repo auditor flags them as advisory cost-to-fix findings; catching them at design time avoids both the finding and the later migration.
Follow these steps when creating or modifying a schema:
infrahub-designing-models first and build from its
design brief.infrahubctl marketplace get <namespace>/<name>, then inherit_from the pulled
generics and add only site-specific attributes.
Discovery, collections (-c), the airgap fallback,
and the required SDK version live in
../infrahub-common/marketplace-reference.md.
Judge the published file per generic, not as a
unit, and record provenance for whatever you take
(rules/reuse-evaluate-per-generic.md).
Confirm every kind you inherit or peer actually exists
on a clean instance before depending on it. A
Core/Builtin prefix is a convention, not a
guarantee, and there is no location kind in the
platform core
(rules/reuse-verify-kind-availability.md).cardinality: one you are about to write is also a
write-time data constraint, not only a shape, so read
rules/relationship-cardinality-consequences.md
while choosing them rather than after a load fails.$schema
comment and version: "1.0". Define generics first
(if any), then nodes. Apply naming, display, and
relationship rules from step 3. If a node joins a
generic that already has implementers, treat that
inherit_from line as a change to a published
interface: it passes schema check, produces no
migration, and still changes what every query,
constraint, and consumer over the generic answers. See
rules/generic-membership-is-a-published-interface.md.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.
If a kind needs a default listing order, set order_by
per rules/display-order-by-scope.md
— on a generic it resolves only against fields that
generic declares itself.infrahubctl schema format when your infrahubctl
provides it (offline, no server); otherwise author the
order by hand. See
rules/format-schema-files.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 checklistinfrahubctl marketplace get / list / search / show, airgap)docs.infrahub.app
on a genuine gap (e.g. deleting nodes)examples.md (opens in a new tab)reference.md (opens in a new tab)rules/_sections.md (opens in a new tab)rules/_template.md (opens in a new tab)rules/attribute-branch-agnostic.md (opens in a new tab)rules/attribute-computed-jinja2.md (opens in a new tab)rules/attribute-defaults-and-types.md (opens in a new tab)rules/display-human-friendly-id.md (opens in a new tab)rules/display-menu-placement.md (opens in a new tab)rules/display-order-by-scope.md (opens in a new tab)rules/display-order-weight.md (opens in a new tab)rules/extension-artifact-target.md (opens in a new tab)rules/extension-cross-file.md (opens in a new tab)rules/extension-file-object.md (opens in a new tab)rules/extension-object-profile.md (opens in a new tab)rules/extension-object-template.md (opens in a new tab)rules/format-schema-files.md (opens in a new tab)rules/generic-membership-is-a-published-interface.md (opens in a new tab)rules/hierarchy-setup.md (opens in a new tab)rules/migration-state-absent.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
infrahub@opsmill is listed by opsmill/claude-marketplace — review the source before installing
npx claudepluginhub opsmill/claude-marketplace --plugin infrahub18 skills in this plugin
/infrahub-analyzing-dataAnalyzes and correlates live Infrahub data via the MCP server — answers operational questions, detects drift, and investigates impact. TRIGGER when: querying infrastructure data, checking compliance, investigating change impact, producing ad-hoc reports. DO NOT TRIGGER when: writing automated checks, building transforms, designing schemas, populating data files, planning an Infrahub version upgrade (use infrahub-planning-upgrades). ALWAYS pass the user's question verbatim as args — this skill runs in a forked context and cannot see the parent conversation. Invoking without args will fail./infrahub-analyzing-diagnosticsAnalyze an already-collected infrahub-collect diagnostic bundle — traceback and failure triage across service logs, incident correlation, and known-issue matching against opsmill/infrahub GitHub issues. TRIGGER when: the user says they collected a diagnostic bundle, gives you a bundle path, or pastes bundle contents — and asks what's wrong, wants the logs or tracebacks analyzed, asks "what does this bundle say", wants errors triaged/correlated, or asks whether a crash is a known issue. DO NOT TRIGGER when: no bundle exists yet — collect one first (use infrahub-collecting-diagnostics), filing the issue itself (use infrahub-reporting-issues), or querying live data (use infrahub-analyzing-data)./infrahub-auditing-repoAudits an Infrahub repository against best practices and rules, producing a structured compliance report. TRIGGER when: reviewing repo for compliance, onboarding to existing project, pre-deployment validation, catching issues. DO NOT TRIGGER when: creating schemas, writing checks/generators, querying live data, populating objects, planning an Infrahub version upgrade (use infrahub-planning-upgrades). ALWAYS pass the user's request verbatim as args, with any scope, path, or focus they named. This skill runs in a forked context and cannot see the parent conversation./infrahub-collecting-diagnosticsCollect a redacted local diagnostic bundle (logs, config, version, state) for an OpsMill expert hand-off. TRIGGER when: Infrahub is broken/failing/erroring, the user asks for help debugging, wants to collect logs/diagnostics, prepares a hand-off for OpsMill support, or reports a crash/timeout/connection issue (upgrade failure, stuck branch, container CrashLoopBackOff, 500s, OOM). DO NOT TRIGGER when: debugging a check, transform, generator, menu, or schema in the repository (use the infrahub-managing-* skills), a bundle has already been collected and the user wants it analyzed (use infrahub-analyzing-diagnostics), filing a public GitHub issue (use infrahub-reporting-issues), running operational queries (use infrahub-analyzing-data), or planning an upgrade that has not run yet (use infrahub-planning-upgrades)./infrahub-commonShared references and cross-cutting rules for all Infrahub skills — GraphQL syntax, .infrahub.yml format, and common patterns. DO NOT TRIGGER directly — loaded automatically by other Infrahub skills when they need shared references./infrahub-converting-netbox-device-typesConverts NetBox device-type and module-type definitions (the netbox-community devicetype-library format, also published via the NetBox Data Exchange / NDX) into Infrahub object templates as Infrahub object YAML, using a bundled Python converter driven by a schema mapping profile. TRIGGER when: importing NetBox device types or module types, exporting device types from a running NetBox instance, building object templates from vendor device models, converting line cards / PSUs / transceivers from NetBox module types into Template* objects, re-running a conversion after changing the mapping profile, debugging a wrong or failed conversion. DO NOT TRIGGER when: importing CSV/TSV data (use infrahub-importing-data), authoring schemas from scratch (use infrahub-managing-schemas), writing ordinary object data files (use infrahub-managing-objects), or setting up continuous two-way replication with a live NetBox (that is infrahub-sync, a separate product; a one-off export of device types is in scope here).Other plugins' skills for the same job