| title | Use MegaLinter with coding agents |
|---|---|
| description | Setup, run and fix MegaLinter errors from Claude Code, Cursor, GitHub Copilot CLI, Codex, Gemini CLI, Antigravity, OpenCode and other coding agents, with token-efficient sub-agents orchestration |
Coding agents write code faster than anyone can review it: linters give them deterministic feedback they can not argue with, and catch what they slip in (secrets, vulnerable dependencies, insecure defaults). MegaLinter checks your agent's changes in seconds, guides its fixes, and checks every pull request again in CI. Why it matters and the recommended setup: MegaLinter for coding agents.
MegaLinter works hand in hand with your coding agent:
One command installs the four MegaLinter agent skills and the three sub-agents together, and keeps them updated.
With Claude Code:
claude plugin marketplace add oxsecurity/megalinter
claude plugin install megalinter@megalinterIn a Claude Code session, the same commands are /plugin marketplace add oxsecurity/megalinter then /plugin install megalinter@megalinter.
With another coding agent (details in Coding Agents (Plugins)):
| Coding agent | Install |
|---|---|
| Cursor | Add https://github.com/oxsecurity/megalinter from Customize → Plugins, then install MegaLinter |
| GitHub Copilot | copilot plugin marketplace add oxsecurity/megalinter then copilot plugin install megalinter@megalinter |
| Codex | codex plugin marketplace add oxsecurity/megalinter, then install from the /plugins browser |
| Gemini CLI / Antigravity | gemini extensions install https://github.com/oxsecurity/megalinter |
The sub-agents ship with the plugin on Claude Code and Cursor. The other coding agents install the skills only, which run the same steps in the main conversation.
When your agent has no plugin system, or when you want the skills versioned with your repository, copy them at the root of your repository with the skills CLI.
With Claude Code (the skills are copied into .claude/skills/):
npx skills add oxsecurity/megalinter/skills -s '*' -a claude-code -yWith another coding agent, replace claude-code with your agent's identifier (cursor, github-copilot, codex, antigravity, opencode... full list in the skills CLI documentation) — or let the CLI detect your installed agents and install the skills for all of them at once:
npx skills add oxsecurity/megalinter/skills -s '*' -y --copyThen just talk to your agent:
- "Setup MegaLinter on this repo"
- "Run MegaLinter and fix the errors"
- "Why is the MegaLinter CI job failing? Fix it"
| Skill | Role |
|---|---|
| megalinter | Entry point: detects the repository state and orchestrates the other skills in a check → fix → re-check loop (3 iterations max) |
| megalinter-setup | Installs or upgrades MegaLinter using npx mega-linter-runner --install (non-interactive), then refines .mega-linter.yml |
| megalinter-check | Collects errors: watches a MegaLinter CI job (GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines) or runs MegaLinter locally: natively without Docker when NATIVE_LINTERS is set (seconds per run), otherwise with docker/podman |
| megalinter-fix | Fixes errors guided by a per-linter fix guide (one for each linter, loaded only when its linter has errors), asks you before disabling rules or pushing |
On agents supporting sub-agents (Claude Code, OpenCode, GitHub Copilot custom agents...), megalinter-setup installs three sub-agents that keep large CI logs and linter outputs out of your main agent's context, and run on low-cost models when possible:
flowchart TD
U(["👤 You: <i>run megalinter and fix the errors</i>"]) --> O["🎯 megalinter<br/>(orchestrator skill)"]
O -->|"no config found"| S["🛠️ megalinter-setup"]
S -->|"npx mega-linter-runner --install"| CFG[/".mega-linter.yml<br/>+ CI workflow"/]
O --> C["🔍 megalinter-check"]
C -->|"watch mode"| W[["👀 megalinter-watcher<br/>sub-agent, low-cost model"]]
W --> CI[/"CI job logs<br/>GitHub / GitLab / Azure / Bitbucket"/]
C -->|"local mode"| RUN[["🐳 megalinter-runner<br/>sub-agent, low-cost model"]]
RUN --> IMG[/"Native linters (NATIVE_LINTERS, seconds)<br/>or the MegaLinter Docker image"/]
W --> ERR[/"📋 Compact error list<br/>grouped by linter"/]
RUN --> ERR
ERR --> F["🔧 megalinter-fix"]
F -->|"one sub-agent per failing linter,<br/>in parallel"| FX1[["🤖 megalinter-fixer<br/>+ python_ruff fix guide"]]
F --> FX2[["🤖 megalinter-fixer<br/>+ markdown_markdownlint fix guide"]]
FX1 --> RES[/"✏️ Fixed files<br/>+ proposed rule disables"/]
FX2 --> RES
RES -->|"you confirm disables"| RC["♻️ Targeted re-check<br/>native run, or parallel standalone linter images"]
RC -->|"errors remain (max 3 loops)"| F
RC -->|"clean"| DONE(["✅ Commit on a branch<br/>(never on main)"])
classDef user fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#1b5e20
classDef skill fill:#ede7f6,stroke:#5e35b1,stroke-width:2px,color:#311b92
classDef subagent fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#0d47a1
classDef artifact fill:#fff8e1,stroke:#f9a825,stroke-width:1px,color:#5d4037
classDef recheck fill:#e0f2f1,stroke:#00897b,stroke-width:2px,color:#004d40
class U,DONE user
class O,S,C,F skill
class W,RUN,FX1,FX2 subagent
class CFG,CI,IMG,ERR,RES artifact
class RC recheck
The fix guides combine information generated from the linter descriptors (auto-fix support, rules documentation URLs, MegaLinter tuning variables) with curated fix, inline-disable and ignore instructions grounded in each linter's official documentation.
- Safe fixes are applied automatically; ambiguous ones are asked to you
- Disabling a linter or a rule always requires your confirmation
- Commits are never pushed to the default branch
See also the installation page for coding agents, or install everything at once as an agent plugin.