Infrahub Repo Auditor
Overview
Comprehensive audit of an Infrahub repository against
all rules and best practices from the infrahub-skills
plugin. Produces a structured report covering schemas,
objects, checks, generators, transforms, menus,
.infrahub.yml configuration, and deployment readiness.
Project Context
Project structure:
!find . -maxdepth 2 -type f \( -name "*.yml" -o -name "*.yaml" -o -name "*.py" -o -name "*.gql" -o -name "*.j2" \) 2>/dev/null | head -40
Infrahub config:
!cat .infrahub.yml 2>/dev/null || echo "No .infrahub.yml found"
When to Use
- Before deploying a repository to Infrahub
- When onboarding to an existing Infrahub project
- After significant refactoring to catch regressions
- As a periodic quality gate in development workflows
- When troubleshooting schema loading, object sync,
or pipeline failures
How It Works
When invoked, the auditor:
- Discovers the project structure
(
.infrahub.yml, schemas, objects, checks,
generators, transforms, menus)
- Validates each component against the rules
defined in the infrahub-skills plugin
- Cross-references between components (e.g.,
query names match between Python files and
.infrahub.yml)
- Generates a markdown report with findings organized by severity
The phased procedure that ties these steps together
lives in audit-procedure.md —
read that file when running an audit. It defines the
nine phases (project structure → schema → objects →
Python components → cross-references → registration →
best practices → deployment → YAGNI / cost-to-fix)
and the per-finding severity levels used in the final
report.
Audit Categories
| Priority |
Category |
What It Checks |
| CRITICAL |
Project Structure |
.infrahub.yml exists, paths valid |
| CRITICAL |
Schema Validation |
Naming, relationships, deprecated fields |
| CRITICAL |
Object Validation |
YAML structure, value types, refs |
| CRITICAL |
Python Components |
Class inheritance, required methods |
| HIGH |
Cross-References |
Query names match, target groups |
| HIGH |
Relationships |
Bidirectional IDs, cardinality |
| HIGH |
Registration |
All files registered, no orphans |
| MEDIUM |
Best Practices |
human_friendly_id, display_label |
| MEDIUM–LOW |
YAGNI / Cost-to-Fix |
Python doing what schema, GraphQL, Jinja2, or built-in IPAM/VLAN can do; denormalized data; un-extracted duplicate shapes; a whole domain hand-rolled when the marketplace ships it. Severity tracks the cost-to-fix ladder: steps 1–3 MEDIUM, steps 4–7 LOW |
| MEDIUM |
Deployment |
Git status, bootstrap placement |
| LOW |
Patterns & Style |
Code organization, naming |
Running the Audit
Tell Claude: "Audit this Infrahub repo" or "Run the Infrahub repo auditor"
The auditor will scan the current working directory,
walk the phases defined in
audit-procedure.md, and
produce the report described below.
Report Format
The report is written to AUDIT_REPORT.md in the project root with this structure:
# Infrahub Repository Audit Report
## Summary
- Total findings: N
- Critical: N | High: N | Medium: N | Low: N | Info: N
## Project Structure
...
## Schema Audit
...
## Object Data Audit
...
## Checks Audit
...
## Generators Audit
...
## Transforms Audit
...
## Menus Audit
...
## Cross-Reference Integrity
...
## Deployment Readiness
...
## YAGNI / Cost-to-Fix Findings
Findings sorted by `ladder_step` ascending (cheapest
fix first), then by file path. Each entry names the
rule, the ladder step, the file:line, and the
suggested replacement (schema feature, GraphQL query,
Jinja2 template, `Builtin*`/`Ipam*` inheritance, or
inverse relationship declaration).
...
Audit Rules Reference
The auditor checks rules from all skills:
- ../infrahub-managing-schemas/ -- Naming,
relationships, attributes, hierarchy, display,
extensions, uniqueness, migration
- ../infrahub-managing-objects/ -- Format,
values, children, ranges, organization
- ../infrahub-managing-checks/ --
Architecture, Python class, API, registration
- ../infrahub-managing-generators/ --
Architecture, Python class, tracking, API
- ../infrahub-managing-transforms/ --
Types, Python/Jinja2, hybrid, artifacts, API
- ../infrahub-managing-menus/ -- Format,
item properties, hierarchy, icons
- ../infrahub-common/ -- Git integration,
caching,
.infrahub.yml reference, GraphQL
- ../infrahub-common/rules/workflow-information-priority.md
-- Skill content first; how to consult
docs.infrahub.app
on a genuine gap (e.g. deleting nodes)
Rules and Procedure
- audit-procedure.md — the
nine-phase walkthrough that drives every audit
run
- rules/ — detailed audit rule
definitions referenced from the phases
- examples.md — sample audit
reports and finding patterns
1---2name: infrahub-auditing-repo-33description: Audits 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.4---56# Infrahub Repo Auditor78## Overview910Comprehensive audit of an Infrahub repository against11all rules and best practices from the infrahub-skills12plugin. Produces a structured report covering schemas,13objects, checks, generators, transforms, menus,14`.infrahub.yml` configuration, and deployment readiness.1516## Project Context1718Project structure:19!`find . -maxdepth 2 -type f \( -name "*.yml" -o -name "*.yaml" -o -name "*.py" -o -name "*.gql" -o -name "*.j2" \) 2>/dev/null | head -40`2021Infrahub config:22!`cat .infrahub.yml 2>/dev/null || echo "No .infrahub.yml found"`2324## When to Use2526- Before deploying a repository to Infrahub27- When onboarding to an existing Infrahub project28- After significant refactoring to catch regressions29- As a periodic quality gate in development workflows30- When troubleshooting schema loading, object sync,31 or pipeline failures3233## How It Works3435When invoked, the auditor:36371. **Discovers** the project structure38 (`.infrahub.yml`, schemas, objects, checks,39 generators, transforms, menus)402. **Validates** each component against the rules41 defined in the infrahub-skills plugin423. **Cross-references** between components (e.g.,43 query names match between Python files and44 `.infrahub.yml`)454. **Generates** a markdown report with findings organized by severity4647The phased procedure that ties these steps together48lives in [audit-procedure.md](./audit-procedure.md) —49read that file when running an audit. It defines the50nine phases (project structure → schema → objects →51Python components → cross-references → registration →52best practices → deployment → YAGNI / cost-to-fix)53and the per-finding severity levels used in the final54report.5556## Audit Categories5758| Priority | Category | What It Checks |59| -------- | -------- | -------------- |60| CRITICAL | Project Structure | `.infrahub.yml` exists, paths valid |61| CRITICAL | Schema Validation | Naming, relationships, deprecated fields |62| CRITICAL | Object Validation | YAML structure, value types, refs |63| CRITICAL | Python Components | Class inheritance, required methods |64| HIGH | Cross-References | Query names match, target groups |65| HIGH | Relationships | Bidirectional IDs, cardinality |66| HIGH | Registration | All files registered, no orphans |67| MEDIUM | Best Practices | human_friendly_id, display_label |68| MEDIUM–LOW | YAGNI / Cost-to-Fix | Python doing what schema, GraphQL, Jinja2, or built-in IPAM/VLAN can do; denormalized data; un-extracted duplicate shapes; a whole domain hand-rolled when the marketplace ships it. Severity tracks the cost-to-fix ladder: steps 1–3 MEDIUM, steps 4–7 LOW |69| MEDIUM | Deployment | Git status, bootstrap placement |70| LOW | Patterns & Style | Code organization, naming |7172## Running the Audit7374Tell Claude: **"Audit this Infrahub repo"** or **"Run the Infrahub repo auditor"**7576The auditor will scan the current working directory,77walk the phases defined in78[audit-procedure.md](./audit-procedure.md), and79produce the report described below.8081## Report Format8283The report is written to `AUDIT_REPORT.md` in the project root with this structure:8485```markdown86# Infrahub Repository Audit Report8788## Summary8990- Total findings: N91- Critical: N | High: N | Medium: N | Low: N | Info: N9293## Project Structure9495...9697## Schema Audit9899...100101## Object Data Audit102103...104105## Checks Audit106107...108109## Generators Audit110111...112113## Transforms Audit114115...116117## Menus Audit118119...120121## Cross-Reference Integrity122123...124125## Deployment Readiness126127...128129## YAGNI / Cost-to-Fix Findings130131Findings sorted by `ladder_step` ascending (cheapest132fix first), then by file path. Each entry names the133rule, the ladder step, the file:line, and the134suggested replacement (schema feature, GraphQL query,135Jinja2 template, `Builtin*`/`Ipam*` inheritance, or136inverse relationship declaration).137138...139```140141## Audit Rules Reference142143The auditor checks rules from all skills:144145- **[../infrahub-managing-schemas/](../infrahub-managing-schemas/)** -- Naming,146 relationships, attributes, hierarchy, display,147 extensions, uniqueness, migration148- **[../infrahub-managing-objects/](../infrahub-managing-objects/)** -- Format,149 values, children, ranges, organization150- **[../infrahub-managing-checks/](../infrahub-managing-checks/)** --151 Architecture, Python class, API, registration152- **[../infrahub-managing-generators/](../infrahub-managing-generators/)** --153 Architecture, Python class, tracking, API154- **[../infrahub-managing-transforms/](../infrahub-managing-transforms/)** --155 Types, Python/Jinja2, hybrid, artifacts, API156- **[../infrahub-managing-menus/](../infrahub-managing-menus/)** -- Format,157 item properties, hierarchy, icons158- **[../infrahub-common/](../infrahub-common/)** -- Git integration,159 caching, `.infrahub.yml` reference, GraphQL160- **[../infrahub-common/rules/workflow-information-priority.md](../infrahub-common/rules/workflow-information-priority.md)**161 -- Skill content first; how to consult `docs.infrahub.app`162 on a genuine gap (e.g. deleting nodes)163164## Rules and Procedure165166- [audit-procedure.md](./audit-procedure.md) — the167 nine-phase walkthrough that drives every audit168 run169- [rules/](./rules/) — detailed audit rule170 definitions referenced from the phases171- [examples.md](./examples.md) — sample audit172 reports and finding patterns