lfx-megalinter
Skill10 starsChanged 2 months agoMITView on GitHub
MegaLinter and CI-standardization playbook for LFX repos: rolling out or upgrading MegaLinter, pinning its version in the workflow and Makefile, fixing MegaLinter failures (zizmor, trivy, grype, osv-scanner, golangci-lint, revive, cspell, yamllint, eslint, gitleaks/betterleaks, checkov), choosing the go.mod Go toolchain version relative to MegaLinter's bundled Go (including minor-only `go` plus `toolchain` pins for importable modules), the GOTOOLCHAIN=auto fix, and cleaning up stale scanner suppressions (.trivyignore, .grype.yaml, osv-scanner.toml). Use when the user mentions MegaLinter, mega-linter.yml, .mega-linter.yml, a failing lint/security CI job, "bump MegaLinter", "go.mod requires go >=", "GOTOOLCHAIN", a CVE suppression, zizmor findings, or asks to standardize CI across repos, even without naming the skill. Do not fire for application security review of code changes (use `/lfx-skills:lfx-security-engineer`) or for addressing PR review comments (use `/lfx-skills:lfx-pr-resolve`).
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- copilot-code-reviewerSkill
- lfx-skills-code-reviewSkill
- lfx-cdp-snowflake-connectorsSkill
- lfx-data-engineerSkill
- lfx-general-code-reviewSkill
- lfx-git-setupSkill
- lfx-intercomSkill
- lfx-itx-integrationSkill
- lfx-local-reviewSkill
- lfx-object-store-designSkill
- lfx-object-store-opsSkill
- lfx-platform-architectureSkill
- lfx-pr-catchupSkill
- lfx-pre-pr-reviewSkill
- lfx-pr-resolveSkill
- lfx-security-engineerSkill
- lfx-setupSkill
- lfxSkill
- lfx-snowflake-accessSkill
- lfx-test-journeySkill
- lfx-v2-ticket-writerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 12 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Read the repo's own CLAUDE.md/AGENTS.md first.
- Very specific: line 47
Keep generic settings in .mega-linter.yml so local runs and CI behave the same.
- Distinctive: line 52
Fix the finding, not the linter: Prefer a code/config fix, then an inline ID-scoped suppression, then an ID-scoped ignore-file entry.
- Distinctive: line 61
Reuse established comment wording: Before writing a new rationale comment, grep sibling repos for the same scenario and copy the existing …
- Distinctive: line 124
When a newer MegaLinter release is needed, update this skill rather than bumping one repo ad hoc:
- Distinctive: line 130
Check the release's bundled Go version (see references/go-toolchain.md) and its removed linters (below).
- Very specific: line 133
Run it against at least one representative repo (make megalinter) and re-verify the fixes in references/ still hold, editing any that …
- Distinctive: line 141
Every major release drops linters (listed at <https://megalinter.io/latest/removed-linters/>).
- Distinctive: line 152
Remove matches along with their rationale comments, unless the removed linter has a named replacement that reads them: then migrate them to …
- Very specific: line 163
Read references/go-toolchain.md whenever you change go.mod's go or toolchain directive, see a go.mod requires go >= error, or see …
- Very specific: line 175
If a dependency CVE fix would raise the go directive past that minor, revert it and record an ID-scoped CVE exception instead.
- Very specific: line 202
Check whether the cited fix is already satisfied by the current go.mod or dependency version.
- Very specific: line 204
If the blocker is a patch-level Go gap within MegaLinter's bundled minor, bump go.mod to the latest patch (the toolchain line for an …
- Distinctive: line 208
If the blocker is a claim about MegaLinter's bundled Go, verify it against the current release (see the reference) — these claims go stale …
- Distinctive: line 210
Remove the entry from every ignore file carrying it (the same CVE is often listed in all three), then confirm the scanner is clean.
- Distinctive: line 213
Don't leave a suppression whose removal condition has been disproven "for later".
- Distinctive: line 216
When a suppression is genuinely needed (e.g.
- Very specific: line 242
Read references/linter-fixes.md when a specific linter fails, or when GO_GOLANGCI_LINT is disabled or non-blocking (the standard is to …
- Very specific: line 250
Read references/adjacent-ci-fixes.md when the repo also has Goa code generation, a ko-build-tag workflow, or a license-header-check …
- Distinctive: line 257
Run what applies to the repo:
- Very specific: line 265
Only run MegaLinter locally (make megalinter) if Docker is confirmed running (docker info).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Copyright The Linux Foundation and each contributor to LFX. --><!-- SPDX-License-Identifier: MIT --><!-- Tool names in this file use Claude Code vocabulary. See docs/tool-mapping.md for other platforms. -->LFX MegaLinter
LFX repos lint and scan with MegaLinter in GitHub Actions. The same failures recur across repos, and each has a known fix. This skill gives the fleet-wide conventions so every repo resolves them the same way instead of rediscovering them PR by PR.
Read the repo's own CLAUDE.md/AGENTS.md first; it wins for anything it
states explicitly (e.g. a deliberately disabled linter), except its Go
version rules, which this skill's policy replaces unless the repo file says
it supersedes this skill (see Go toolchain version).
Where configuration lives
| File | Holds |
.mega-linter.yml | Generic MegaLinter config: DISABLE_LINTERS, DISABLE_ERRORS_LINTERS, <LINTER>_* settings. |
.github/workflows/mega-linter.yml | The SHA-pinned uses: line and Actions-only env: values (secrets, runner behavior). |
Makefile megalinter target | Local Docker run, pinned to the same release by image digest. |
.trivyignore, .grype.yaml, osv-scanner.toml | ID-scoped vulnerability exceptions. |
.cspell.json, revive.toml, .yamllint*, .golangci.yml | Per-linter config. |
Keep generic settings in .mega-linter.yml so local runs and CI behave the
same; only put values in the workflow env: that exist only in Actions.
Core principles
- Fix the finding, not the linter. Prefer a code/config fix, then an
inline ID-scoped suppression, then an ID-scoped ignore-file entry. Never
disable a whole scanner category (e.g.
REPOSITORY_GRYPE) or move it toDISABLE_ERRORS_LINTERSto silence one finding — that hides every future finding too. - Patch the vulnerable dependency directly, not unrelated top-level
dependencies.
go get <module>@<fixed-version> && go mod tidy. - Every suppression carries a rationale and a removal condition that can actually be checked (see Stale suppression cleanup).
- Reuse established comment wording. Before writing a new rationale comment, grep sibling repos for the same scenario and copy the existing phrasing. Comments are sentence case, end with a period, and describe current behavior only — never "this PR", "this rollout", or past states.
MegaLinter version
The fleet standard is MegaLinter v10.2.0. Pin exactly this release, not whatever is newest upstream: the fixes in this skill were tested against it, and a newer release can bundle different linter and Go versions that invalidate them. Moving the fleet to a newer release is done by updating and re-testing this skill first, then rolling the new pin out to repos.
Three places must agree — half-upgrades are easy to miss:
Workflow — SHA-pinned with the tag as a trailing comment. The commit SHA is the same for every flavor:
uses: oxsecurity/megalinter/flavors/go@f2fe8c1cba37091848df3e524066c8c23ef353ed # v10.2.0Makefile — pin the image digest, not just the tag. Example for the Go flavor:
<!-- markdownlint-disable MD010 --># Run MegaLinter locally via Docker (matches CI Go flavor at v10.2.0). # Keep this digest in sync with .github/workflows/mega-linter.yml. MEGALINTER_IMAGE := ghcr.io/oxsecurity/megalinter-go@sha256:e676b8e9dac00d148bf1abb6ab809f1df76f07e804d8061f78631975d0c90925 # v10.2.0 megalinter: docker pull $(MEGALINTER_IMAGE) docker run --rm --platform linux/amd64 -e GOTOOLCHAIN=auto -v '$(CURDIR):/tmp/lint:rw' $(MEGALINTER_IMAGE)<!-- markdownlint-enable MD010 -->v10.2.0 digests by flavor (use the flavor matching the workflow's
flavors/<flavor>path):Flavor MEGALINTER_IMAGEgoghcr.io/oxsecurity/megalinter-go@sha256:e676b8e9dac00d148bf1abb6ab809f1df76f07e804d8061f78631975d0c90925pythonghcr.io/oxsecurity/megalinter-python@sha256:65ccdc8cc09a282112e08a26da1580d33524b8b1c68f1f5eec0f94c0112764d5javascriptghcr.io/oxsecurity/megalinter-javascript@sha256:0fde748d739c85248c033fba141e482f1a3e9053905f2959efbcbd6dcd1d631fcupcakeghcr.io/oxsecurity/megalinter-cupcake@sha256:0e62d95de2e4388530579e1cdf531e3752ac70549ab78666c64429bd734dbae7For any other flavor,
docker buildx imagetools inspect ghcr.io/oxsecurity/megalinter-<flavor>:v10.2.0prints the digest to copy..mega-linter.yml— any version-coupled settings.
The Docker target is always named megalinter. If a repo's lint target
runs the MegaLinter container, rename it to megalinter (and update README,
CI, or other targets that call it). lint is reserved for linting with the
local toolchain (e.g. golangci-lint run, revive), which is fast and
needs no Docker — keeping the names distinct means make lint stays cheap
and predictable across repos.
Updating this skill to a new release
When a newer MegaLinter release is needed, update this skill rather than bumping one repo ad hoc:
- Resolve the new SHA
(
gh api repos/oxsecurity/megalinter/commits/vX.Y.Z --jq .sha) and image digest, and update the pins above. - Check the release's bundled Go version (see references/go-toolchain.md) and its removed linters (below).
- Run it against at least one representative repo (
make megalinter) and re-verify the fixes inreferences/still hold, editing any that changed (e.g. version-specific false positives that are now fixed upstream). - Then roll the new pin out to repos, running the removed-linters sweep in each.
Removed-linters sweep
Every major release drops linters (listed at https://megalinter.io/latest/removed-linters/). Their config keys remain schema-valid but are silently ignored, so stale config rots without failing the build. When moving a repo to the pinned release, grep for every removed linter name across:
.mega-linter.yml(DISABLE_LINTERS,DISABLE_ERRORS_LINTERS,<LINTER>_*keys);- the workflow's
env:block; - the removed linter's dotfiles;
- inline annotations in source referencing the old linter name.
Remove matches along with their rationale comments, unless the removed
linter has a named replacement that reads them: then migrate them to the
replacement's names instead (e.g. gitleaks → betterleaks, see
references/linter-fixes.md). Example: v10 removed
REPOSITORY_KICS (Checkov, enabled by default, covers it), so a
REPOSITORY_KICS entry in DISABLE_ERRORS_LINTERS is dead config.
Then re-check the repo's Go pin against v10.2.0's bundled Go (next section).
Go toolchain version
Read references/go-toolchain.md whenever you
change go.mod's go or toolchain directive, see a
go.mod requires go >= error, or see golangci-lint/govulncheck fail on Go
version. Summary:
- Build with the latest patch of the previous minor Go release (latest stable minor − 1), upgrading or downgrading as needed, with no user input. Never exceed the minor bundled by the pinned MegaLinter.
- An importable module (any exportable package: not
package main, not underinternal/) declares only the minor ingo(e.g.go 1.26) and pins the patch intoolchain go1.26.11, so consumers aren't forced onto its patch. A deployable-only module puts the patch ingo. - If a dependency CVE fix would raise the
godirective past that minor, revert it and record an ID-scoped CVE exception instead. - This replaces Go version rules in the repo's
CLAUDE.md/AGENTS.mdunless they explicitly supersede this skill; ask before rewriting them. - Always set
GOTOOLCHAIN=autofor MegaLinter in Go repos (workflow stepenv:and the Makefiledocker run -e), so ago.modpatch ahead of MegaLinter's bundled Go just works. No*_UNSECURED_ENV_VARIABLESallowlisting is needed. - A minor-level gap (go.mod
1.N+1.x, MegaLinter bundles1.N.x) breaks govulncheck's call analysis, so osv-scanner falls back to version-only matching; golangci-lint depends on the Go it was built with (v10.2.0's handles Go 1.27). The policy above keeps repos out of it.
Stale suppression cleanup
Whenever the Go pin, a dependency, or the MegaLinter version changes, grep the ignore files for entries whose rationale cites a Go version, a MegaLinter bundled-toolchain version, or phrasing like "cannot upgrade until", "requires Go 1.X", or "capped at":
grep -nEi 'go ?1\.[0-9]+|megalinter|cannot upgrade|requires go|capped at' \
.trivyignore .grype.yaml osv-scanner.toml 2>/dev/nullFor each hit:
- Check whether the cited fix is already satisfied by the current
go.modor dependency version. If so, the suppression is just stale — remove it. - If the blocker is a patch-level Go gap within MegaLinter's bundled minor,
bump
go.modto the latest patch (thetoolchainline for an importable module; see Go toolchain version), withGOTOOLCHAIN=autoset as always, instead of keeping the suppression. - If the blocker is a claim about MegaLinter's bundled Go, verify it against the current release (see the reference) — these claims go stale quickly.
- Remove the entry from every ignore file carrying it (the same CVE is often listed in all three), then confirm the scanner is clean.
Don't leave a suppression whose removal condition has been disproven "for later"; these accumulate silently.
When a suppression is genuinely needed (e.g. the fix requires a Go minor newer than the policy's target), add it ID-scoped to each scanner that reports it:
# .grype.yaml
ignore:
# CVE-YYYY-NNNNN is fixed in example.com/mod vA.B.C, which requires Go 1.N+1.
- vulnerability: CVE-YYYY-NNNNN# osv-scanner.toml
[[IgnoredVulns]]
id = "GO-YYYY-NNNN"
reason = "Fixed in example.com/mod vA.B.C, which requires Go 1.N+1."# .trivyignore
# CVE-YYYY-NNNNN is fixed in example.com/mod vA.B.C, which requires Go 1.N+1.
CVE-YYYY-NNNNNFixing specific linter failures
Read references/linter-fixes.md when a specific
linter fails, or when GO_GOLANGCI_LINT is disabled or non-blocking (the
standard is to re-enable it). It covers: Trivy rate limits, golangci-lint
and revive, cspell (including the shared flagWords setup every cspell repo
needs), gitleaks (resolved by upgrading) and betterleaks, zizmor
online/offline mode and the github-app false positive, ESLint flat config,
and yamllint.
Read references/adjacent-ci-fixes.md when
the repo also has Goa code generation, a ko-build-tag workflow, or a
license-header-check workflow — recurring bugs found alongside MegaLinter
rollouts.
Local validation before pushing
Run what applies to the repo:
go build ./... && go vet ./... && go test ./...
zizmor .github/workflows/ # native binary preferred over Docker
actionlintOnly run MegaLinter locally (make megalinter) if Docker is confirmed
running (docker info); otherwise rely on the CI MegaLinter run. Local runs
are slow and pull a multi-GB image, so they're worth it mainly when testing a
version bump or a Go toolchain change.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

