v1.0.0 — Now available on npm

Keep AI code clean
not chaotic

ESLint guardrails that catch the patterns AI coding assistants get wrong most often — god files, god functions, orphan TODOs, and redundant comments.

$

npm install --save-dev eslint-plugin-ai-guardrails

Copy
The Problem

Why AI Guardrails?

AI coding assistants are incredibly productive — but they introduce predictable quality drift. These aren't style nitpicks — they're the patterns that turn a productive sprint into months of refactoring.

📄

God files

What AI does: Keeps appending to one file instead of splitting

✓ Guardrails catches: max-file-lines warns when a file exceeds 300 lines

🔧

God functions

What AI does: Generates monolithic functions with everything inlined

✓ Guardrails catches: max-function-lines warns when a function exceeds 50 lines

📝

Orphan TODOs

What AI does: Leaves TODO / FIXME / HACK with no tracking

✓ Guardrails catches: no-orphan-todos errors without a link or deadline

💬

Redundant comments

What AI does: Adds "// Set x to 5" above const x = 5

✓ Guardrails catches: no-ai-obvious-comments flags comments that repeat the code


4 Rules, Zero Chaos

Catch AI mistakes before review

Each rule targets a specific pattern that AI coding assistants produce. Fully configurable thresholds and severity levels.

📄

max-file-lines

warn

Prevent files from exceeding a maximum number of lines

Default: 300 lines
// ⚠ File has 342 lines (max: 300) // Split into smaller, focused modules

🔧

max-function-lines

warn

Prevent functions and methods from growing too long

Default: 50 lines
// ⚠ Function 'processData' has 87 lines (max: 50) // Extract helpers and reduce complexity

📝

no-orphan-todos

error

Require TODO/FIXME/HACK to include a tracking reference

Default: reference required
// ✗ TODO: fix this later // ✓ TODO(#123): fix auth edge case by 2025-06

💬

no-ai-obvious-comments

warn

Detect comments that just repeat the following code

Default: enabled
// ✗ // Set count to zero // const count = 0; // ✓ // Reset for next batch iteration // const count = 0;

Get Started

Setup in seconds

One command or a few lines of config — works with every popular framework and ESLint version.

Terminal
npx eslint-plugin-ai-guardrails init
One command sets up ESLint config, strict scripts, tsconfig baseline, and framework integrations.
Installation
Terminal
# npm
npm install --save-dev eslint-plugin-ai-guardrails @typescript-eslint/parser

# pnpm
pnpm add -D eslint-plugin-ai-guardrails @typescript-eslint/parser

# yarn
yarn add -D eslint-plugin-ai-guardrails @typescript-eslint/parser

# bun
bun add -d eslint-plugin-ai-guardrails @typescript-eslint/parser

The Story

Built from real frustration

As a vibe coder, I fully understand the benefits and clutter that AI can bring to code. I often find myself frustrated when AI leaves behind giant files, long functions, and comments that simply repeat the code. This plugin is a solution I built from personal experience — to keep code structure tidy even when working intensively with AI.

Hanif Maulana

Hanif Maulana

Creator of eslint-plugin-ai-guardrails

Works Everywhere

Built for your stack

Integration-tested against every popular framework and config format. ESM, CJS, flat config, legacy — it just works.

Node.jsNode.js
≥ 18.0.0
ESLintESLint
v8.x · v9.x
TypeScriptTypeScript
≥ 5.0.0
@typescript-eslint/parser@typescript-eslint/parser
v6 · v7 · v8
Integration-Tested With
ViteVite
Next.jsNext.js
NestJSNestJS
ExpressExpress
SvelteKitSvelteKit
ElysiaElysia
HonoHono
ViteVite
Next.jsNext.js
NestJSNestJS
ExpressExpress
SvelteKitSvelteKit
ElysiaElysia
HonoHono