Skip to content
Cloud & Infrastructure
Skill

/gitops-repo-audit

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

From plugin
agent-skills
2456 skills2 agents1 MCP

Claude Code

$ npx -y skills add fluxcd/agent-skills --skill gitops-repo-audit --agent claude-code

SKILL.md

gitops-repo-audit.SKILL.md
name: gitops-repo-audit
description: >
  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.
license: Apache-2.0
compatibility: Requires flux (v2.10+) and flux-schema

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.

1. Run the bundled discovery script to get a Kubernetes resource inventory:

   scripts/discover.sh -d <repo-root>

The script wraps `flux-schema discover` and outputs JSON with a top-level `inventory` object (alongside `kind`/`apiVersion`/`$schema`) containing: a `summary` (file, resource, and line counts), a `directories` map classifying each directory as `kubernetes-manifests`, `kustomize-overlay`, `helm-chart`, or `terraform`, a `resources` map with counts keyed by `group/version/Kind`, and a `flux` map listing every Flux resource per file. Read the fields under `.inventory`. Multi-document files are handled. 2. Classify the repository pattern by reading [repo-patterns.md](references/repo-patterns.md) and matching against the heuristics table 3. Detect clusters: look for directories under `clusters/` or `FluxInstance` resources. Read the FluxInstance to understand how the clusters are configured. 4. Check for `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/

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.

1. Run the bundled check script:

   scripts/check-deprecated.sh -d <repo-root>

It runs `flux migrate -f . --dry-run` and prints file:line, kind and target version per finding. Exit codes:

  • `0`: scan completed, no deprecated APIs found
  • `1`: scan completed, deprecated APIs found
  • `2`: scan incomplete. Report Phase 3 as failed with the output, never as clean, even if some migration lines were printed

2. If deprecated APIs are found, include the steps from [api-migration.md](references/api-migration.md). Notification `v1beta3` (Alert, Provider) is deprecated in 2.10 but still served: a Warning, not Critical. Flag Alert `spec.summary` and Provider `spec.proxy`/`spec.interval` on any version (dropped in `v1`).

Phase 4: Best Practices Assessment

Read [best-practices.md](references/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` + `ExternalArtifact` provider)? 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 `dependsOn` namespaces, `wait: true` (mandatory with `spec.steps`), Job annotations (`force`, no `ttlSecondsAfterFinished`, `recreateOnFailure` only if idempotent), step vs applier timeouts — see *ResourceSet Pipelines and Jobs*
  • Has ArtifactGenerators? Verify the FluxInstance lists `source-watcher`, and that `pathPattern` generator
Read more
@fluxcd
Ships withagent-skills

A collection of reusable skills that give AI Agents expertise in Flux CD, Kubernetes, and GitOps best practices for generating manifests, answering Flux questions, auditing repository structure, security, operational readiness, and debugging live cluster

2456 skills2 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
245
Star history of fluxcd/agent-skills on GitHub, a chart by star-history.com

Other skills on agent-skills.

commit-assisted-by

commit-assisted-by

Add an `Assisted-by: <agent-name>/<model-id>` git trailer to commits made during an AI-assisted coding session. Trigger on any…

@fluxcd@fluxcdInstall Skill
gitops-cluster-debug

gitops-cluster-debug

Debug and troubleshoot Flux CD on live Kubernetes clusters via the Flux MCP server — inspects Flux resource status, events and…

@fluxcd@fluxcdInstall Skill
gitops-knowledge

gitops-knowledge

Flux CD and Flux Operator expert — answers questions and generates schema-validated YAML for all Flux CRDs (not repo auditing or…

@fluxcd@fluxcdInstall Skill

More skills from other plugins.

container

container

Use when running, building, or managing Linux containers on macOS, or when a task involves Docker, docker compose, Lima, Colima,…

@apple@appleInstall Skill
agent-advisor

agent-advisor

Entry point for AI-agent work on AWS: pick a runtime, plan a migration for existing workloads, and build an executable POC — one…

@aws@awsInstall Skill
agents-sdk
Auto-invoked

agents-sdk

Build, debug, or review Cloudflare Agents SDK applications using the agents package.

@cloudflare@cloudflareInstall Skill

Questions about gitops-repo-audit.

Which coding agents can use gitops-repo-audit?
gitops-repo-audit installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.