Back to blog

Add prodlint to your AGENTS.md

updated 5 min readprodlint

Your AI writes code. Who checks it?

AGENTS.md is a file you drop into your repo to tell AI coding agents how to work on your project. It's supported by Cursor, GitHub Copilot, OpenAI Codex, Windsurf, Cline, and Factory CLI. It's widely adopted across open-source repos. The idea is straightforward: if you tell the agent to run a linter after writing code, it should. And if the linter finds issues, the agent can try to fix them before showing you the result. That's a tight feedback loop with no human in the middle for the routine stuff. Here's how to add prodlint to that loop.

The AGENTS.md snippet

Add this to your AGENTS.md (or create one in your project root). The key is putting the command early in the file and making the instructions specific. Agents follow concrete commands better than vague advice.

AGENTS.md
# AGENTS.md

## After Writing or Modifying Code

Always run prodlint before committing:

```
npx prodlint --json
```

Fix all findings with `"severity": "critical"` before completing the task.
Re-run prodlint after fixing to verify no new issues were introduced.

If a finding is a false positive, suppress it:
```
// prodlint-disable-next-line <rule-id>
```

Why --json matters

The --json flag gives the agent structured output it can actually parse: file paths, line numbers, rule IDs, severity levels, fix hints. Without it, the agent gets a terminal output with color codes and formatting that it has to guess at. With JSON, the agent can loop through findings, filter by severity, and apply fixes methodically. For even quicker feedback, use --summary to get a pass/fail verdict with just the top 3 blockers.

npx prodlint: written for people
  prodlint v0.10.8
  Scanned 3 files · 1 warnings

src/app/actions.ts
  1:1  WARN  Server action performs mutations without any authentication check — anyone can call this action  server-action-auth
        ↳ Add auth check: const session = await auth(); if (!session) throw new Error("Unauthorized")

  Scores
  security        98 ████████████████████  (1 issues)
  reliability    100 ████████████████████  (0 issues)
  performance    100 ████████████████████  (0 issues)
  ai-quality     100 ████████████████████  (0 issues)

  Overall: 99/100
npx prodlint --json: the same scan, for an agent
{
  "version": "0.10.8",
  "scannedPath": ".",
  "filesScanned": 3,
  "scanDurationMs": 15,
  "findings": [
    {
      "ruleId": "server-action-auth",
      "file": "src/app/actions.ts",
      "line": 1,
      "column": 1,
      "category": "security",
      "message": "Server action performs mutations without any authentication check — anyone can call this action",
      "severity": "warning",
      "fix": "Add auth check: const session = await auth(); if (!session) throw new Error(\"Unauthorized\")"
    }
  ],
  "overallScore": 99,
  "categoryScores": [
    { "category": "security", "score": 98, "findingCount": 1 },
    { "category": "reliability", "score": 100, "findingCount": 0 },
    { "category": "performance", "score": 100, "findingCount": 0 },
    { "category": "ai-quality", "score": 100, "findingCount": 0 }
  ],
  "summary": { "critical": 0, "warning": 1, "info": 0 }
}

Claude Code: use CLAUDE.md

Claude Code reads CLAUDE.md instead of AGENTS.md. Same idea, same format. If you want to support both Claude Code and other agents, you can keep both files or symlink one to the other. The instructions are identical.

CLAUDE.md
## Code Quality

After writing or modifying code, run:
```
npx prodlint --json
```
Fix all critical findings before committing.
Use `npx prodlint --summary` for quick pass/fail check.

Enforce it with a git hook

AGENTS.md instructions are advisory. The agent should follow them, but there's no guarantee. If you want mandatory enforcement, add a pre-commit hook. This catches cases where the agent (or a human) skips the check.

lefthook.yml
pre-commit:
  commands:
    prodlint:
      glob: "*.{js,ts,jsx,tsx}"
      run: npx prodlint --summary
      fail_text: "prodlint found critical issues. Run: npx prodlint"

SARIF, baselines, and profiles

Three features that fit prodlint into agent and CI workflows. SARIF output feeds directly into GitHub Code Scanning, so findings show up in the Security tab alongside CodeQL results. Baselines let you adopt prodlint on an existing codebase without drowning in pre-existing findings. Profiles give you quick presets instead of remembering flag combinations.

CLI flags
# SARIF for GitHub Code Scanning
npx prodlint --sarif > prodlint.sarif

# Quick pass/fail verdict
npx prodlint --summary

# Only critical findings (move fast)
npx prodlint --profile startup

# Save baseline, then only report new findings
npx prodlint --baseline-save .prodlint-baseline.json
npx prodlint --baseline .prodlint-baseline.json

The full CI workflow

Here's everything together: prodlint in AGENTS.md so the coding agent checks itself, a git hook as a safety net, and SARIF upload to GitHub so findings are visible in the Security tab. The agent runs prodlint automatically. The git hook catches anything that slips through. GitHub Code Scanning gives you the dashboard. No human has to remember to run the linter.

.github/workflows/prodlint.yml
name: Prodlint
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write    # the action's comment
      security-events: write  # the SARIF upload
    steps:
      - uses: actions/checkout@v7
      - uses: prodlint/prodlint@v1
        with:
          threshold: 50
      - run: npx prodlint --sarif > prodlint.sarif
      - uses: github/codeql-action/upload-sarif@v4
        with:
          sarif_file: prodlint.sarif
          category: prodlint

Check your own code.

52 production readiness checks. Zero config.