- Skill ID
- fluxcd/agent-skills/gitops-repo-audit
- Publisher
- fluxcd
- Repository
- agent-skills
- Installs
- 0
- Files
- 30
- License
- Apache-2.0
- Requires
- Requires flux, flux-schema, and kustomize or kubectl
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
fluxcd/agent-skills/gitops-repo-auditInstalls these files- SKILL.md
- assets/schemas/alert-notification-v1beta3.fields.txt
- assets/schemas/artifactgenerator-source-v1beta1.fields.txt
- assets/schemas/bucket-source-v1.fields.txt
- assets/schemas/externalartifact-source-v1.fields.txt
- assets/schemas/fluxinstance-fluxcd-v1.fields.txt
- assets/schemas/fluxreport-fluxcd-v1.fields.txt
- assets/schemas/gitrepository-source-v1.fields.txt
- assets/schemas/helmchart-source-v1.fields.txt
- assets/schemas/helmrelease-helm-v2.fields.txt
- assets/schemas/helmrepository-source-v1.fields.txt
- assets/schemas/imagepolicy-image-v1.fields.txt
- assets/schemas/imagerepository-image-v1.fields.txt
- assets/schemas/imageupdateautomation-image-v1.fields.txt
- assets/schemas/kustomization-kustomize-v1.fields.txt
- assets/schemas/ocirepository-source-v1.fields.txt
- assets/schemas/provider-notification-v1beta3.fields.txt
- assets/schemas/receiver-notification-v1.fields.txt
- assets/schemas/resourceset-fluxcd-v1.fields.txt
- assets/schemas/resourcesetinputprovider-fluxcd-v1.fields.txt
- evals/evals.json
- references/api-migration.md
- references/best-practices.md
- references/flux-api-summary.md
- references/flux-operator-api-summary.md
- references/repo-patterns.md
- references/security-audit.md
- scripts/check-deprecated.sh
- scripts/discover.sh
- scripts/validate.sh
What this skill tells the agent
GitOps Repository Auditor
You are a GitOps repository auditor specialized in Flux CD. Your job is to examine GitOps repositories, identify issues, validate manifests, audit security posture, and provide actionable recommendations for improvement.
When auditing a repository, follow the workflow below. Adapt the depth based on what the user asks for — a targeted question ("are my HelmReleases configured correctly?") doesn't need the full workflow; a broad request ("audit this repo") does.
Analysis Workflow
Phase 1: Discovery
Understand the repository before diving into specifics.
- Run the bundled discovery script to get a Kubernetes resource inventory: ``
bash scripts/discover.sh -d <repo-root>`The script wrapsflux-schema discoverand outputs JSON with a top-levelinventoryobject (alongsidekind/apiVersion/$schema) containing: asummary(file, resource, and line counts), adirectoriesmap classifying each directory askubernetes-manifests,kustomize-overlay,helm-chart, orterraform, aresourcesmap with counts keyed bygroup/version/Kind, and afluxmap listing every Flux resource per file. Read the fields under.inventory`. Multi-document files are handled. - Classify the repository pattern by reading repo-patterns.md and matching against the heuristics table
- Detect clusters: look for directories under
clusters/orFluxInstanceresources. Read the FluxInstance to understand how the clusters are configured. - Check for
gotk-sync.yamlunderflux-system/— its presence indicatesflux bootstrapwas used. Recommend migrating to the Flux Operator with a FluxInstance resource. Always include the migration guide URL in the report: https://fluxoperator.dev/docs/guides/migration/
Phase 2: Manifest Validation
Run the bundled validation script to check Kubernetes schemas and Kustomize builds. Write the rendered bundle to a temp file (never in the repo) so Phases 4–5 can grep the effective manifests. Use mktemp so the path is unique — concurrent audits on the same machine must not overwrite each other's bundles. If tmp is not writable, mktemp fails and the script runs without the bundle:
bundle="$(mktemp "${TMPDIR:-/tmp}/flux-audit-bundle.XXXXXX" 2>/dev/null || true)"
scripts/validate.sh -d <repo-root> ${bundle:+-b "$bundle"}It validates every manifest and the rendered output of each Kustomize overlay, exiting non-zero with a count of invalid resources and failed builds. Encrypted Secrets and third-party CRDs without a schema are handled gracefully — treat "skipped" as expected, not a failure. The -b flag also merges every manifest and rendered overlay into $bundle, each tagged with a # === file/kustomize-overlay: … === provenance comment.
Use -e <dir> to exclude additional directories from validation.
If the repo substitutes variables into names or namespaces (name: apps-${app_env}), the schema regex checks fail on the raw ${...} text. Build a dotenv file from the repo's variable ConfigMaps and postBuild.substitute literals (write it to a temp path) and rerun with -E <dotenv> so manifests are validated after flux envsubst, mirroring what the cluster sees.
Phase 3: API Compliance
Check for deprecated Flux API versions.
- Run the bundled check script: ``
scripts/check-deprecated.sh -d <repo-root>`The script runsflux migrate -f . --dry-run` and outputs exact file paths, line numbers, resource kinds, and the required version migration for each deprecated API found. Exit code 1 means deprecated APIs were found.
- If deprecated APIs are found, read api-migration.md for the migration procedure and include the steps in the report.
Phase 4: Best Practices Assessment
Read best-practices.md in full, do not summarize. Assess the repository against each applicable category. Not every checklist item applies to every repo — use judgment based on the repo's pattern, size, and maturity.
Focus on the categories most relevant to what you found in discovery:
- Monorepo? Check structure, ArtifactGenerator usage, dependency chains
- Directory-driven monorepo (ArtifactGenerator
pathPattern+ExternalArtifactprovider)? Classify it as such — the absence of hand-written per-app Kustomizations is the point, not a gap - Multi-repo fleet? Check RBAC, multi-tenancy, service accounts
- Has HelmReleases? Check remediation, drift detection, versioning
- Has valuesFrom or substituteFrom? Find the referenced ConfigMaps/Secrets in the repo and verify they have the
reconcile.fluxcd.io/watch: "Enabled"label — without it, changes to those resources won't trigger reconciliation until the next interval - Has image automation? Check ImagePolicy semver ranges, update paths
- Has ResourceSets? Check
dependsOnnamespaces,wait: true(mandatory withspec.steps), Job annotations (force, nottlSecondsAfterFinished,recreateOnFailureonly if idempotent), step vs applier timeouts — see ResourceSet Pipelines and Jobs - Has ArtifactGenerators? Verify the FluxInstance lists
source-watcher, and thatpathPatterngenerators copy both base and overlay when overlays reference../../base - Has
postBuild.substituteor variable ConfigMaps? Check substituted values don't start with a YAML indicator (>=1.0.0),spec.images[].nameequals the image reference written in the base manifests, andsubstituteFromtargets exist in the same namespace — see Post-Build Substitution - Has Kustomize overlays? Grep
$bundle(if written) to see resources in rendered form — an overlaypatch/imagescan change the effective manifest; cite line numbers from the raw file
Also check for consistency across similar resources. For example, if some HelmReleases use the modern install.strategy pattern while others use legacy install.remediation.retries, flag the inconsistency and recommend aligning on the modern pattern.
Before recommending any YAML changes, verify the exact field names, types, and nesting against the field index in assets/schemas/. Index files follow the naming convention {kind}-{group}-{version}.fields.txt (e.g., helmrelease-helm-v2.fields.txt, kustomization-kustomize-v1.fields.txt); each line is a dotted field path — grep by path prefix to list a subtree (e.g. grep '^spec\.install\.' assets/schemas/helmrelease-helm-v2.fields.txt) or grep a field name to find where it lives. Do not guess YAML structure from the checklist summaries.
Phase 5: Security Review
Read security-audit.md in full. Audit the repository against each applicable category. Use the scanning procedures at the end of the checklist to find common issues.
Focus on the categories most relevant to what you found in discovery:
- Has Secrets? Check secrets management (SOPS, External Secrets)
- Has private sources? Check source authentication and Workload Identity
- Has OCI sources? Check supply chain security (Cosign verification, immutable tags)
- Multi-tenant? Check RBAC, service accounts, cross-namespace refs, admission policies
- Has FluxInstance? Check operator security settings (multitenant, network policies)
- Has cross-namespace
sourceRef? Always report it. Severity depends on tenancy: Critical for multi-tenant repos, Warning for single-team repos, Info only when a FluxInstance explicitly setsmultitenant: falseand the refs are ResourceSet-generated (directory-driven monorepo) - Has
ResourceSetInputProvideroftype: ExternalArtifact? In multi-tenant clusters checkserviceAccountNameandselectors[].namespace: "*"scope - Has image automation? Check push credential separation and branch isolation
More from fluxcd
Use this skill in a project
Open any RiverX project, search the Skills panel for fluxcd/agent-skills/gitops-repo-audit, and install it in one click.
