Introduction
ESLint guardrails for AI-assisted codebases — stop AI-generated code from becoming long-term tech debt.

eslint-plugin-ai-guardrails
ESLint guardrails for AI-assisted codebases.
Stop AI-generated code from becoming long-term tech debt. eslint-plugin-ai-guardrails enforces structure-first linting rules that catch the patterns AI coding tools get wrong most often.
Works with Copilot, Cursor, ChatGPT, Claude, and any AI coding assistant. Supports ESLint v8 & v9, TypeScript ≥ 5, Node.js ≥ 18.
Why AI Guardrails?
AI coding assistants are incredibly productive — but they introduce predictable quality drift. These aren't style nitpicks; they're the exact patterns that turn a productive AI sprint into months of refactoring.
| Problem | What AI Does | What Guardrails Catches |
|---|---|---|
| God files | Keeps appending to one file instead of splitting | max-file-lines warns when a file exceeds 300 lines |
| God functions | Generates monolithic functions with everything inlined | max-function-lines warns when a function exceeds 50 lines |
| Orphan TODOs | Leaves TODO / FIXME / HACK with no tracking | no-orphan-todos errors without a link or deadline |
| Redundant comments | Adds massive blocks of unnecessary explanations | no-ai-obvious-comments enforces max density (20%), length, and quality |
Quick Install
# npm
npm install --save-dev eslint-plugin-ai-guardrails @typescript-eslint/parser
# pnpm
pnpm add -D eslint-plugin-ai-guardrails @typescript-eslint/parser
# bun
bun add -d eslint-plugin-ai-guardrails @typescript-eslint/parserOr use the one-command setup:
npx eslint-plugin-ai-guardrails init