.agents/skills/gitops-repo-audit/SKILL.md
Audit and validate Flux CD GitOps repositories by scanning local repo files (not live clusters) — runs Kubernetes schema validation, detects deprecated Flux APIs, reviews RBAC/multi-tenancy/secrets management, and produces a prioritized GitOps report. Use when users ask to audit, analyze, validate, review, or security-check a GitOps repo.
npx skillsauth add Sandesh-Solabannavar/flux-homelab gitops-repo-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Understand the repository before diving into specifics.
scripts/discover.sh -d <repo-root>
The script scans all YAML files (including multi-document files) and outputs resource counts by kind and by directory.clusters/ or FluxInstance resources. Read the FluxInstance to understand how the clusters are configured.gotk-sync.yaml under flux-system/ — its presence indicates flux bootstrap was 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/Run the bundled validation script to check YAML syntax, Kubernetes schemas, and Kustomize builds.
scripts/validate.sh -d <repo-root>
Use -e <dir> to exclude additional directories from validation.
Check for deprecated Flux API versions.
Run the bundled check script:
scripts/check-deprecated.sh -d <repo-root>
The script runs flux 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.
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:
reconcile.fluxcd.io/watch: "Enabled" label — without it, changes to those resources won't trigger reconciliation until the next intervalAlso 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, read the relevant OpenAPI schema from
assets/schemas/ to verify the exact field names and nesting.
Schema files follow the naming convention {kind}-{group}-{version}.json
(e.g., helmrelease-helm-v2.json, kustomization-kustomize-v1.json).
Do not guess YAML structure from the checklist summaries.
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:
Structure findings as a markdown report with these sections if applicable:
Use this table to check API versions and read the OpenAPI schema before recommending YAML changes.
| Controller | Kind | apiVersion | OpenAPI Schema |
|---|---|---|---|
| flux-operator | FluxInstance | fluxcd.controlplane.io/v1 | fluxinstance-fluxcd-v1.json |
| flux-operator | FluxReport | fluxcd.controlplane.io/v1 | fluxreport-fluxcd-v1.json |
| flux-operator | ResourceSet | fluxcd.controlplane.io/v1 | resourceset-fluxcd-v1.json |
| flux-operator | ResourceSetInputProvider | fluxcd.controlplane.io/v1 | resourcesetinputprovider-fluxcd-v1.json |
| source-controller | GitRepository | source.toolkit.fluxcd.io/v1 | gitrepository-source-v1.json |
| source-controller | OCIRepository | source.toolkit.fluxcd.io/v1 | ocirepository-source-v1.json |
| source-controller | Bucket | source.toolkit.fluxcd.io/v1 | bucket-source-v1.json |
| source-controller | HelmRepository | source.toolkit.fluxcd.io/v1 | helmrepository-source-v1.json |
| source-controller | HelmChart | source.toolkit.fluxcd.io/v1 | helmchart-source-v1.json |
| source-controller | ExternalArtifact | source.toolkit.fluxcd.io/v1 | externalartifact-source-v1.json |
| source-watcher | ArtifactGenerator | source.extensions.fluxcd.io/v1beta1 | artifactgenerator-source-v1beta1.json |
| kustomize-controller | Kustomization | kustomize.toolkit.fluxcd.io/v1 | kustomization-kustomize-v1.json |
| helm-controller | HelmRelease | helm.toolkit.fluxcd.io/v2 | helmrelease-helm-v2.json |
| notification-controller | Provider | notification.toolkit.fluxcd.io/v1beta3 | provider-notification-v1beta3.json |
| notification-controller | Alert | notification.toolkit.fluxcd.io/v1beta3 | alert-notification-v1beta3.json |
| notification-controller | Receiver | notification.toolkit.fluxcd.io/v1 | receiver-notification-v1.json |
| image-reflector-controller | ImageRepository | image.toolkit.fluxcd.io/v1 | imagerepository-image-v1.json |
| image-reflector-controller | ImagePolicy | image.toolkit.fluxcd.io/v1 | imagepolicy-image-v1.json |
| image-automation-controller | ImageUpdateAutomation | image.toolkit.fluxcd.io/v1 | imageupdateautomation-image-v1.json |
Load reference files when you need deeper information:
sops: metadata blocks are encrypted — don't flag them as malformed YAML. The validation script already skips Secrets.flux-system/gotk-components.yaml is auto-generated by Flux bootstrap. Don't analyze it for best practices — it's managed by Flux itself.${VARIABLE} patterns are using Flux's variable substitution. Don't flag these as broken YAML — they're resolved at reconciliation time.ClusterIssuer or Kyverno's ClusterPolicy will show as "skipped" in kubeconform (missing schemas). This is expected — only Flux CRD schemas are downloaded. Don't flag these as validation failures.kustomization.yaml files with apiVersion: kustomize.config.k8s.io/v1beta1 are Kustomize build configs, not Flux CRDs.tools
Debug and troubleshoot Flux CD on live Kubernetes clusters (not local repo files) via the Flux MCP server — inspects Flux resource status, reads controller logs, traces dependency chains, and performs installation health checks. Use when users report failing, stuck, or not-ready Flux resources on a cluster, reconciliation errors, controller issues, artifact pull failures, or need live cluster Flux Operator troubleshooting.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.