Managing Objects Skill
Relevant source files
The following files were used as context for generating this wiki page:
Managing Objects is an expert guidance skill for creating, modifying, and managing Infrahub object data YAML files. Objects are infrastructure instances—such as devices, locations, and organizations—that populate schema nodes. This skill provides the workflow and rules to ensure data adheres to defined schemas, handles component hierarchies, and maintains correct load orders.
Sources: skills/infrahub-managing-objects/SKILL.md:1-26, AGENTS.md:144-145
System Architecture
The Managing Objects skill follows a three-level progressive disclosure model to manage AI context. Metadata triggers the skill, the SKILL.md body provides the workflow and pointers, and supporting files (rules, examples, references) provide specific implementation details.
Sources: dev/knowledges/architecture.md:43-62, dev/guides/adding-a-skill.md:20-33
This diagram illustrates the hierarchical structure of the skill's components and how information is disclosed to the AI assistant.
Sources: skills/infrahub-managing-objects/SKILL.md:41-80, dev/knowledges/architecture.md:43-62
Workflow and Execution
The skill enforces a specific sequential workflow to manage infrastructure data safely.
- Branch-First Planning: You must plan to load data onto a dedicated branch rather than the default branch to prevent unreviewed changes to the source of truth.
- Schema Analysis: You identify target node kinds, attributes, and relationships from existing schema files.
- Structure Planning: You determine YAML structure and file naming based on required load orders.
- Attribute Mapping: You set values for attributes and relationships, including metadata for lineage or protection.
- Hierarchy Handling: You configure component children or hierarchical nesting.
- Validation and Loading: You verify syntax and references using
infrahubctlbefore loading the branch.
The sequence diagram shows the interaction between the user, the skill, the underlying schema, and the Infrahub CLI during the object lifecycle.
Sources: skills/infrahub-managing-objects/SKILL.md:82-119, skills/infrahub-managing-objects/SKILL.md:123-125
Data Model and File Basics
Object files use a specific YAML structure to target node kinds defined in the schema.
Core Structure
| Field | Requirement | Description |
|---|---|---|
apiVersion | Required | Must be infrahub.app/v1. |
kind | Required | Must be Object. |
spec.kind | Required | The schema node kind (e.g., DcimDevice). |
spec.data | Required | List of object instances with attributes and values. |
Sources: skills/infrahub-managing-objects/SKILL.md:74-80
YAML Example
---
apiVersion: infrahub.app/v1
kind: Object
spec:
kind: DcimDellServer
data:
- name: "server-01"
status: "active"
Sources: skills/infrahub-managing-objects/SKILL.md:74-80
Rule Categories and Priorities
Rules are modular best practices organized by priority and category prefixes.
| Priority | Category | Prefix | Focus |
|---|---|---|---|
| CRITICAL | Branch-First Loading | workflow- | Loading data onto branches, not default. |
| CRITICAL | File Format | format- | Structural YAML requirements. |
| CRITICAL | Value Mapping | value- | Attribute and relationship resolution. |
| HIGH | Children | children- | Component nesting and hierarchy. |
| MEDIUM | Range | range- | Collapsing sequential interfaces. |
| MEDIUM | Organization | organization- | Naming and load order conventions. |
Sources: skills/infrahub-managing-objects/SKILL.md:41-51, skills/infrahub-managing-objects/rules/_sections.md:3-9
Schema Dependencies
The Managing Objects skill relies on specific schema features to function correctly. If a feature is missing in the schema, you must perform a schema migration before objects can be loaded.
- Cross-file References: Requires a
human_friendly_idon the target node. - Hierarchies: Requires generics with
parent/childrenrelationships. - Dropdowns: Requires
choicesobjects with names defined in the schema. - Inline Components: Requires shared identifiers between Parent and Component relationships.
Sources: skills/infrahub-managing-objects/SKILL.md:53-72
Summary
The Managing Objects skill provides a structured method for populating Infrahub with infrastructure data. It prioritizes branch-based workflows and strict adherence to schema definitions to maintain data integrity. By following the modular rules for value mapping, hierarchy, and organization, you ensure that objects are loaded in the correct order and validate against the system's requirements.
Sources: skills/infrahub-managing-objects/SKILL.md:32-40, skills/infrahub-common/rules/_sections.md:11-17