mcpField
I
infrahub-auditing-repo

infrahub-auditing-repo

github.com/opsmillTesting & quality27152 installsUpdated 1d ago
Repository

About infrahub-auditing-repo

A read-only audit skill for Infrahub repositories, intended for deployment checks, project onboarding, and post-refactor reviews. It validates schemas, objects, Python components, configuration, and cross-references, then writes a severity-organized Markdown report.

Key features

  1. 01Scan project structure and configuration
  2. 02Check schemas and objects
  3. 03Validate Python components and registration
  4. 04Cross-check component references
  5. 05Generate a severity-based audit report
  6. 06Write only the report file

Use cases

  1. 01Check a repository before Infrahub deployment
  2. 02Onboard to an existing Infrahub project
  3. 03Find regressions after refactoring
  4. 04Investigate schema loading or pipeline failures

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/opsmill/infrahub-skills --skill infrahub-auditing-repo

After installing, type/infrahub-auditing-repoin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

audit-procedure.md
examples.md
rules/
_sections.md
_template.md
artifact-target-inheritance.md
audit-cites-all-reference-sites.md
audit-is-read-only.md
audit-verifies-proposed-syntax.md
deployment-readiness.md
objects-format.md
practices-schema.md
practices-watch-dependencies.md
python-classes.md
registration-completeness.md
schema-display-labels-deprecated.md
schema-file-object-misuse.md
schema-naming.md
schema-relationships.md
structure-infrahub-yml.md
xref-query-names.md
yagni-custom-domain-primitives-instead-of-builtin.md
yagni-denormalized-vs-indirect-relationship.md
yagni-duplicate-shape-not-extracted-to-generic.md
yagni-generator-hardcoding-data.md
yagni-generator-query-shape-too-broad.md
yagni-generator-that-should-be-template.md
yagni-imperative-allocation-vs-resource-pool.md
yagni-missing-inverse-forces-python-filter.md
yagni-profile-over-default.md
yagni-python-transform-that-could-be-jinja2.md

Details

From the project README

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.

The audit is read-only. The one file it writes is its own report, AUDIT_REPORT.md. Nothing else in the working tree or the index is touched, and no destructive git command is run against them, including to undo the audit's own side effect. An audit is most useful on a tree that holds uncommitted work, which is exactly the tree where a write cannot be undone.

rules/audit-is-read-only.md holds the canonical lists: which git commands are forbidden and which read another revision without touching the tree. Read it, and Phase 0 of the procedure, before Phase 1. The Bash tool is granted for read-only inspection, not for changing state; Write is granted for the report file only.

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:

  1. Discovers the project structure (.infrahub.yml, schemas, objects, checks, generators, transforms, menus)
  2. Validates each component against the rules defined in the infrahub-skills plugin
  3. Cross-references between components (e.g., query names match between Python files and .infrahub.yml)
  4. 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 opens with Phase 0, the read-only constraint every other phase runs under, then 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.

Before emitting the first finding, read rules/audit-cites-all-reference-sites.md and rules/audit-verifies-proposed-syntax.md. A finding states how it was verified, or says in verified_against that it could not be — never by lowering its severity, which belongs to the rule. It enumerates every reference site it wants changed, and it resolves any filter, field or config key it proposes against the version under audit rather than against the published docs. Both apply to every phase, and both add a field to the finding shape.

When Phase 7 reaches .infrahub.yml, read rules/practices-watch-dependencies.md before judging a watch block: a missing key, an incomplete list, and an entry naming an untracked file each fail silently, and the key has to be confirmed against the version under audit before it is proposed.

Audit Categories

PriorityCategoryWhat It Checks
CRITICALConductThe audit writes nothing but its report, and every finding discloses the evidence behind it; constrains the auditor, not the repo
CRITICALProject Structure.infrahub.yml exists, paths valid
CRITICALSchema ValidationNaming, relationships, deprecated fields
CRITICALObject ValidationYAML structure, value types, refs
CRITICALPython ComponentsClass inheritance, required methods
HIGHCross-ReferencesQuery names match, target groups
HIGHRelationshipsBidirectional IDs, cardinality
HIGHRegistrationAll files registered, no orphans
MEDIUMBest Practiceshuman_friendly_id, display_label, watch deps
MEDIUM–LOWYAGNI / Cost-to-FixPython 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
MEDIUMDeploymentGit status, bootstrap placement
LOWPatterns & StyleCode 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
- Working tree at audit time: clean | N uncommitted files
- Tree modified by this audit: no | yes, listing paths
  (the report file itself does not count)

## 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).

A finding also renders the evidence it carries: a
**Sites** line listing every reference the fix must
touch, a **Verified against** line naming what the
proposed syntax was resolved against, and, on a
generic-extraction finding, a **Feasibility** verdict.

...

Audit Rules Reference

The auditor checks rules from all skills:

Rules and Procedure

  • audit-procedure.md — the Phase 0 constraint and nine-phase walkthrough that drive every audit run
  • rules/ — detailed audit rule definitions referenced from the phases
  • examples.md — sample audit reports and finding patterns

Comments

Markdown supported