eslint-plugin-ai-guardrails logo

Introduction

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

eslint-plugin-ai-guardrails logo

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.

ProblemWhat AI DoesWhat Guardrails Catches
God filesKeeps appending to one file instead of splittingmax-file-lines warns when a file exceeds 300 lines
God functionsGenerates monolithic functions with everything inlinedmax-function-lines warns when a function exceeds 50 lines
Orphan TODOsLeaves TODO / FIXME / HACK with no trackingno-orphan-todos errors without a link or deadline
Redundant commentsAdds massive blocks of unnecessary explanationsno-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/parser

Or use the one-command setup:

npx eslint-plugin-ai-guardrails init

Explore the Docs

On this page